167 lines
5.3 KiB
C++
167 lines
5.3 KiB
C++
//---------------------------------------------------------------------------
|
|
|
|
#include <vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "PayMentFormUnit.h"
|
|
#include "GlobalUnit.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma package(smart_init)
|
|
#pragma link "GeneralDialogPanel"
|
|
#pragma link "TextButton"
|
|
#pragma resource "*.dfm"
|
|
TPayMentForm *PayMentForm;
|
|
#define CLIENT_TOP 23
|
|
#define PANEL_LEFT 20
|
|
#define PANEL_TOP 42
|
|
#define PANEL_BOTTOM 15
|
|
#define PANEL_HEIGHT 150
|
|
|
|
//---------------------------------------------------------------------------
|
|
__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(m_pGeneralDialogPanel);
|
|
m_pPayMentPanel->Parent = m_pGeneralDialogPanel;
|
|
m_pPayMentPanel->Left = PANEL_LEFT;
|
|
m_pPayMentPanel->Top = 23 + nLbHeight;
|
|
m_pPayMentPanel->Width = Width - 2*PANEL_LEFT;
|
|
m_pPayMentPanel->Height = PANEL_HEIGHT;
|
|
m_pPayMentPanel->SetContent(iOperation, nIdCount, aIdStyle,
|
|
aStyleCost, nCost, nBalance);
|
|
|
|
/* char bufCost[200];
|
|
if( nBalance>=nCost ){
|
|
sprintf( bufCost, "本次操作将消耗 %d 唱作音符\n是否立即支付?", nCost);
|
|
}else{
|
|
m_pTextButtonOK->Visible = false;
|
|
sprintf( bufCost, "唱作音符余额不足,请登录网站获取。");
|
|
m_pLabelMessage->Font->Color = CLR_TEXT_LEAVE;
|
|
}
|
|
m_pLabelMessage->Caption = bufCost;
|
|
*/
|
|
m_nUnPayment = nCost - nBalance;
|
|
|
|
SetTransparent( this );
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
__fastcall TPayMentForm::~TPayMentForm()
|
|
{
|
|
if( m_pPayMentPanel ){
|
|
delete m_pPayMentPanel;
|
|
m_pPayMentPanel = NULL;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::FormShow(TObject *Sender)
|
|
{
|
|
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_pTextButtonOK->Visible == false){
|
|
// m_lblRecharge->Left = (m_pTextButtonCancel->Left - m_pLabelMessage->Width)/2;
|
|
// }else{
|
|
// m_lblRecharge->Left = (m_pTextButtonOK->Left - m_pLabelMessage->Width)/2;
|
|
// }
|
|
// m_pLabelMessage->Top = m_pPayMentPanel->Top + m_pPayMentPanel->Height
|
|
// + (nLbHeight - m_pLabelMessage->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();
|
|
|
|
m_pTextButtonOK->Visible = m_nUnPayment<=0;
|
|
m_lblRecharge->Visible = m_nUnPayment>0;
|
|
m_lblVIP->Visible = g_infoUser.accountInfo.vipPeriod==0;
|
|
|
|
if( m_lblVIP->Visible && m_lblRecharge->Visible ){
|
|
m_lblVIP->Top += 3;
|
|
m_lblRecharge->Top += 3;
|
|
}
|
|
else if( m_lblRecharge->Visible ){
|
|
m_lblRecharge->Top = m_lblVIP->Top;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::RechargeClick(TObject *Sender)
|
|
{
|
|
// if(m_pTextButtonOK->Visible == false){
|
|
char strURL[256];
|
|
f_CS_GetWebPageURL( URL_RECHARGE, strURL );
|
|
String StrUrl = (String)strURL;
|
|
StrUrl += L"&coin=" + IntToStr(m_nUnPayment);
|
|
|
|
ShellExecute(Handle, NULL, StrUrl.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
// ModalResult = mrCancel;
|
|
// }
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::RechargeMouseEnter(TObject *Sender)
|
|
{
|
|
// if(m_pTextButtonOK->Visible == false){
|
|
// Screen->Cursor = crHandPoint;
|
|
m_lblRecharge->Font->Color = clAqua;
|
|
// }
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::RechargeMouseLeave(TObject *Sender)
|
|
{
|
|
// if(m_pTextButtonOK->Visible == false){
|
|
// Screen->Cursor = crDefault;
|
|
m_lblRecharge->Font->Color = clHighlight;
|
|
// }
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::VIPMouseEnter(TObject *Sender)
|
|
{
|
|
m_lblVIP->Font->Color = clAqua;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::VIPMouseLeave(TObject *Sender)
|
|
{
|
|
m_lblVIP->Font->Color = clHighlight;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::VIPClick(TObject *Sender)
|
|
{
|
|
char strURL[256];
|
|
f_CS_GetWebPageURL( URL_VIPMEMBER, strURL );
|
|
|
|
String StrUrl = (String)strURL;
|
|
ShellExecute(Handle, NULL, StrUrl.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
// ModalResult = mrCancel;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TPayMentForm::FormCreate(TObject *Sender)
|
|
{
|
|
m_pGeneralDialogPanel->Font->Size = g_szFont9;
|
|
m_pTextButtonOK->FontSize = g_szFont9;
|
|
m_pTextButtonCancel->FontSize = g_szFont9;
|
|
m_pPayMentPanel->SetTextFontSize( g_szFont9 );
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|