//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "AboutFormUnit.h"
#include "GlobalUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PNGButton"
#pragma link "GeneralDialogPanel"
#pragma resource "*.dfm"
TAboutForm *AboutForm;
//---------------------------------------------------------------------------
__fastcall TAboutForm::TAboutForm(TComponent* Owner)
	: TForm(Owner)
{
	Font->Color = RGB(60,43,23);
}
//---------------------------------------------------------------------------
void __fastcall TAboutForm::FormCreate(TObject *Sender)
{
	m_lblVersion->Caption = g_strCurrentVersion;

	int wMaj, wMin, wMod, wBld;
	sscanf( g_strCurrentVersion, "%d.%d.%d.%d", &wMaj, &wMin, &wMod, &wBld );

	if( SOFTWARE_ID==e_Pro_Lite )
        m_lblType->Caption = L"教学版";
	else if( wMaj==0 )
		m_lblType->Caption = L"测试版";
	else
		m_lblType->Caption = L"正式版";

	m_lblType->Left = m_lblVersion->Left + m_lblVersion->Width + 3;

	int nOrigin, nDownload, nShare, nLocal;
	f_CS_GetStyleNumsEx( nOrigin, nDownload, nShare, nLocal );
	char strNums[64];
	sprintf( strNums, "发布/下载风格数：%d/%d", nOrigin, nDownload );
	m_lblStyleNums->Caption = strNums;

	m_lblURL->Caption = g_strServerURL;

	SetTransparent( this );
}
//---------------------------------------------------------------------------
void __fastcall TAboutForm::WMNCHitTest(TWMNCHitTest &Msg)
{
	TForm::Dispatch(&Msg);

	if( Msg.Result==HTCLIENT && Msg.YPos<Top+24 && Msg.XPos<Left+275 )
		Msg.Result = HTCAPTION;
}
//---------------------------------------------------------------------------
void __fastcall TAboutForm::URLClick(TObject *Sender)
{
	if( m_lblURL->Caption.Length()>0 ){
		ShellExecute(Handle,NULL, m_lblURL->Caption.c_str(), NULL,NULL,SW_SHOWNORMAL);
	}
}
//---------------------------------------------------------------------------

void __fastcall TAboutForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
	switch( Key ){
	case VK_RETURN:
	case VK_ESCAPE:
		ModalResult = mrCancel;
		break;
	}
}
//---------------------------------------------------------------------------


