// DlgRegionSelect.cpp : implementation file // #include "stdafx.h" #include "ryllogin.h" #include "DlgRegionSelect.h" #include "../LoginRes/Resource.h" #include "RYLLOGIN_DEFINITIONS.H" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDlgRegionSelect dialog IMPLEMENT_DYNAMIC(CDlgRegionSelect, CDialog) CDlgRegionSelect::CDlgRegionSelect(CWnd* pParent /*=NULL*/) : CDialog(CDlgRegionSelect::IDD, pParent) { //{{AFX_DATA_INIT(CDlgRegionSelect) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_nRegionIndex = 0; } void CDlgRegionSelect::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgRegionSelect) // NOTE: the ClassWizard will add DDX and DDV calls here //DDX_Control(pDX, IDC_LIST_SERVER, m_RegionList); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDlgRegionSelect, CDialog) //{{AFX_MSG_MAP(CDlgRegionSelect) ON_WM_PAINT() ON_WM_LBUTTONDOWN() ON_WM_CTLCOLOR() //ON_LBN_SELCHANGE(IDC_LIST_SERVER, OnLbnSelchangeListServer) //ON_LBN_DBLCLK(IDC_LIST_SERVER, OnLbnDblclkListServer) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgRegionSelect message handlers void CDlgRegionSelect::RenderBack( CDC &rDC, CBitmap &rBitmap, int Px, int Py , int SizeX, int SizeY ) { CBitmap *pOldBitmap; CDC memDC; memDC.CreateCompatibleDC(&rDC); pOldBitmap=memDC.SelectObject(&rBitmap); CSize sBitmap=rBitmap.GetBitmapDimension(); BITMAP bmInfo; rBitmap.GetBitmap(&bmInfo); if( SizeX == -1 && SizeY == -1 ) rDC.BitBlt(Px,Py,bmInfo.bmWidth,bmInfo.bmHeight,&memDC,0,0,SRCCOPY); else rDC.BitBlt(Px,Py,SizeX,SizeY,&memDC,0,0,SRCCOPY); memDC.SelectObject(pOldBitmap); } void CDlgRegionSelect::OnPaint() { CPaintDC dc(this); // device context for painting RenderBack( dc, m_btmBack, 0, 0 ); // TODO: Add your message handler code here // Do not call CDialog::OnPaint() for painting messages } BOOL CDlgRegionSelect::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here SetDllResource(); m_btmBack.LoadBitmap( IDB_BITMAP_SERVERSEL ); SetDefaultResource(); SetWindowPos( NULL, 0, 0, 286, 237, SWP_NOZORDER | SWP_NOMOVE ); m_RegionList.SetWindowPos( NULL, 17, 24, 150-17, 203-24, SWP_NOZORDER ); for( int i = 0; i < m_vec_strRegionName.size(); ++i ) { m_RegionList.InsertString( -1, m_vec_strRegionName[i] ); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgRegionSelect::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( point.x, point.y) ); CDialog::OnLButtonDown(nFlags, point); } HBRUSH CDlgRegionSelect::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); switch(nCtlColor) { case CTLCOLOR_LISTBOX: pDC->SetBkMode(TRANSPARENT); pDC->SetTextColor(RGB( 200,200,200 )); return (HBRUSH)GetStockObject(NULL_BRUSH); break; } // TODO: Change any attributes of the DC here // TODO: Return a different brush if the default is not desired return hbr; } void CDlgRegionSelect::OnLbnSelchangeListServer() { //m_ServerList.Invalidate( FALSE ); Invalidate( FALSE ); // TODO: Add your control notification handler code here } void CDlgRegionSelect::OnLbnDblclkListServer() { // TODO: Add your control notification handler code here if( m_RegionList.GetCurSel() == -1 ) { AfxMessageBox( RYLLoginGetMessage( 0 ) ); return; } m_nRegionIndex = m_RegionList.GetCurSel(); CDialog::OnOK(); }