Initial commit
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "PayMentFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma link "PNGButton"
|
||||
#pragma resource "*.dfm"
|
||||
TPayMentForm *PayMentForm;
|
||||
#define PANEL_LEFT 20
|
||||
#define PANEL_TOP 42
|
||||
#define PANEL_BOTTOM 15
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#define LEN_BKG_EXTERNAL_ROUND (1)
|
||||
#define LEN_BKG_EXTERNAL_FRMAE (1)
|
||||
#define LEN_BKG_INTERNAL_LINE (23)
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TPayMentForm::TPayMentForm(TComponent* Owner, int iOperation, int nIdCount,
|
||||
UINT *aIdStyle, int *aStyleCost,
|
||||
int nCost, int nBalance)
|
||||
: TForm(Owner)
|
||||
{
|
||||
int nLbHeight = (m_pTextButtonOK->Top - 23 - PANEL_HEIGHT)/2;
|
||||
char bufBalance[200];
|
||||
sprintf( bufBalance, "当前账户现有 %d 唱作音符", nBalance );
|
||||
m_pLabelBlance->Caption = bufBalance;
|
||||
|
||||
m_pPayMentPanel = new TPayMentPanel(this);
|
||||
m_pPayMentPanel->Parent = this;
|
||||
m_pPayMentPanel->Font->Size = m_pLabelBlance->Font->Size;
|
||||
m_pPayMentPanel->Left = PANEL_LEFT;
|
||||
m_pPayMentPanel->Top = 23 + nLbHeight;
|
||||
m_pPayMentPanel->Width = Width - 2*PANEL_LEFT;
|
||||
m_pPayMentPanel->Height = 120;
|
||||
m_pPayMentPanel->SetContent(iOperation, nIdCount, aIdStyle,
|
||||
aStyleCost, nCost, nBalance);
|
||||
|
||||
m_pLabelMessage = NULL;
|
||||
m_lbVip = NULL;
|
||||
char bufCost[200];
|
||||
if( nBalance<nCost ){
|
||||
m_pTextButtonOK->Visible = false;
|
||||
|
||||
sprintf( bufCost, "账户余额不足,请登录网站充值兑换");
|
||||
m_pLabelMessage = new TUrlLabel(this);
|
||||
m_pLabelMessage->Parent = this;
|
||||
m_pLabelMessage->ColorNor = CLR_TEXT_LEAVE;
|
||||
m_pLabelMessage->ColorEnt = CLR_TEXT_ENTER;
|
||||
m_pLabelMessage->ColorLea = CLR_TEXT_LEAVE;
|
||||
m_pLabelMessage->Caption = bufCost;
|
||||
char strURLMsg[256];
|
||||
f_CS_GetWebPageURL( URL_RECHARGE, strURLMsg );
|
||||
String StrUrl = (String)strURLMsg;
|
||||
StrUrl += L"&coin=" + IntToStr(nCost - nBalance);
|
||||
m_pLabelMessage->StrUrl = StrUrl;
|
||||
m_pLabelMessage->Font->Name = m_pLabelBlance->Font->Name;
|
||||
m_pLabelMessage->Font->Size = m_pLabelBlance->Font->Size;// int(8 * 96.0 / g_yDpi + 0.5);
|
||||
m_pLabelMessage->Font->Style = TFontStyles()<<fsUnderline;
|
||||
}
|
||||
|
||||
if(0==g_infoUser.accountInfo.vipPeriod){
|
||||
|
||||
m_lbVip = new TUrlLabel(this);
|
||||
m_lbVip->Parent = this;
|
||||
m_lbVip->ColorNor = CLR_TEXT_LEAVE;
|
||||
m_lbVip->ColorEnt = CLR_TEXT_ENTER;
|
||||
m_lbVip->ColorLea = CLR_TEXT_LEAVE;
|
||||
m_lbVip->Caption = L"成为VIP:免功能费,风格八折";
|
||||
char strURL[256];
|
||||
f_CS_GetWebPageURL( URL_VIPMEMBER, strURL );
|
||||
m_lbVip->StrUrl = strURL;
|
||||
m_lbVip->Font->Name = m_pLabelBlance->Font->Name;
|
||||
m_lbVip->Font->Size = m_pLabelBlance->Font->Size;//int(8 * 96.0 / g_yDpi + 0.5);
|
||||
m_lbVip->Font->Style = TFontStyles()<<fsUnderline;
|
||||
}
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TPayMentForm::~TPayMentForm()
|
||||
{
|
||||
if( m_pPayMentPanel ){
|
||||
delete m_pPayMentPanel;
|
||||
m_pPayMentPanel = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TPayMentForm::WMNCHitTest(TWMNCHitTest &Msg)
|
||||
{
|
||||
TForm::Dispatch(&Msg);
|
||||
|
||||
if( Msg.Result==HTCLIENT &&
|
||||
(Msg.YPos<Top+LEN_BKG_INTERNAL_LINE) &&
|
||||
(Msg.XPos<(Left+ m_PNGButtonClose->Left) ) )
|
||||
{
|
||||
Msg.Result = HTCAPTION;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TPayMentForm::FormShow(TObject *Sender)
|
||||
{
|
||||
//绘制圆角窗体
|
||||
HRGN hRgn = CreateRoundRectRgn( 0, 0, Width+1, Height+1, 16, 16 );
|
||||
SetWindowRgn( Handle, hRgn, false );
|
||||
DeleteObject( hRgn );
|
||||
|
||||
int nLbHeight = (m_pTextButtonOK->Top - 23 - PANEL_HEIGHT)/2;
|
||||
m_pLabelBlance->Left = (Width - m_pLabelBlance->Width)/2;
|
||||
m_pLabelBlance->Top = 23 + (nLbHeight - m_pLabelBlance->Height)/2;
|
||||
|
||||
nLbHeight = Height - (m_pPayMentPanel->Top + m_pPayMentPanel->Height);
|
||||
if( m_pLabelMessage ) {
|
||||
|
||||
m_pLabelMessage->Left = m_pPayMentPanel->Left;
|
||||
if(m_lbVip) {
|
||||
m_pLabelMessage->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height
|
||||
+ (nLbHeight/2 - m_pLabelMessage->Height)/2 + 5;
|
||||
}
|
||||
else {
|
||||
m_pLabelMessage->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height
|
||||
+ (nLbHeight - m_pLabelMessage->Height)/2;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_lbVip ) {
|
||||
|
||||
m_lbVip->Left = m_pPayMentPanel->Left;
|
||||
if( m_pLabelMessage ) {
|
||||
m_lbVip->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height + nLbHeight/2 +
|
||||
(nLbHeight/2 - m_lbVip->Height)/2 - 5;
|
||||
}
|
||||
else {
|
||||
m_lbVip->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height +
|
||||
(nLbHeight - m_lbVip->Height)/2;
|
||||
}
|
||||
}
|
||||
|
||||
m_pTextButtonCancel->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height
|
||||
+ (nLbHeight - m_pTextButtonCancel->Height)/2;
|
||||
m_pTextButtonOK->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height
|
||||
+ (nLbHeight - m_pTextButtonOK->Height)/2;
|
||||
m_pPayMentPanel->SetSB();
|
||||
m_pPayMentPanel->SetFocus();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user