TestHMXFormView.cpp
上传用户:yinguanfa
上传日期:2022-02-19
资源大小:400k
文件大小:3k
源码类别:
ListView/ListBox
开发平台:
Visual C++
- // TestHMXFormView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "Test_HMXControls.h"
- #include "TestHMXFormView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CTestHMXFormView
- IMPLEMENT_DYNCREATE(CTestHMXFormView, CFormView)
- CTestHMXFormView::CTestHMXFormView()
- : CHMXFormView(CTestHMXFormView::IDD)
- {
- //{{AFX_DATA_INIT(CTestHMXFormView)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- CTestHMXFormView::~CTestHMXFormView()
- {
- }
- void CTestHMXFormView::DoDataExchange(CDataExchange* pDX)
- {
- CHMXFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CTestHMXFormView)
- DDX_Control(pDX, IDC_CHK_API, m_chkAPI);
- DDX_Control(pDX, IDC_CHK_CD, m_chkCD);
- DDX_Control(pDX, IDC_CHK_GPF, m_chkGPF);
- DDX_Control(pDX, IDC_CMB_SELECT, m_cmbSelect);
- DDX_Control(pDX, IDC_EDT_FIRST, m_edtFirst);
- DDX_Control(pDX, IDC_EDT_LAST, m_edtLast);
- DDX_Control(pDX, IDC_LBL_COMBO, m_lblCombo);
- DDX_Control(pDX, IDC_LBL_FIRST, m_lblFirst);
- DDX_Control(pDX, IDC_LBL_LAST, m_lblLast);
- DDX_Control(pDX, IDC_LBL_MAIN, m_lblMain);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CTestHMXFormView, CHMXFormView)
- //{{AFX_MSG_MAP(CTestHMXFormView)
- ON_BN_CLICKED(IDC_BTN_SET_BK_COLOR, OnBtnSetBkColor)
- ON_BN_CLICKED(IDC_BTN_SET_BK_BMP, OnBtnSetBkBmp)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CTestHMXFormView diagnostics
- #ifdef _DEBUG
- void CTestHMXFormView::AssertValid() const
- {
- CFormView::AssertValid();
- }
- void CTestHMXFormView::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CTestHMXFormView message handlers
- void CTestHMXFormView::OnInitialUpdate()
- {
- GetParentFrame()->RecalcLayout();
- ResizeParentToFit(FALSE);
- GetDocument()->SetTitle("HMXFormView");
- CHMXFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- m_lblMain.SetTextFont( 10, true, false, "Courier New" );
- m_lblMain.SetTextClr( RGB( 128, 128, 200 ) );
- m_chkAPI.SetTextFont( 10, true, false, "Verdana" );
- m_chkAPI.SetTextClr( RGB( 255, 0, 0) );
- m_chkGPF.SetTextFont( 10, true, false, "Verdana" );
- m_chkGPF.SetTextClr( RGB( 0, 128, 0) );
- m_chkCD.SetTextFont( 10, true, false, "Verdana" );
- m_chkCD.SetTextClr( RGB( 0, 0, 255) );
- m_edtFirst.SetTextClr( RGB( 128, 0, 0) );
- m_edtFirst.SetBkClr( RGB(255, 255, 0) );
- m_edtFirst.SetBkClrFocus( RGB( 255, 255, 128) );
- m_edtFirst.SetFontBold();
- m_cmbSelect.SetTextFont( 12, true, false, "Arial" );
- m_cmbSelect.SetBkClr( RGB( 0, 0, 0) );
- m_cmbSelect.SetTextClr( RGB( 255, 255, 200 ) );
- // set bk image
- SetBitmap( "water.bmp", CHMXFormView::BITMAP_STRETCH);
- }
- void CTestHMXFormView::OnBtnSetBkColor()
- {
- // TODO: Add your control notification handler code here
- CColorDialog dlg;
- // choose your color
- if( dlg.DoModal() == IDOK ) {
- // set bk color
- SetBkClr( dlg.GetColor() );
- }
- }
- void CTestHMXFormView::OnBtnSetBkBmp()
- {
- // TODO: Add your control notification handler code here
- CFileDialog dlg( TRUE, NULL, NULL, 0, "Bitmap |*.BMP|", this );
- // let's choose our preferred background image
- if( dlg.DoModal() == IDOK ) {
- // set bk image
- SetBitmap( dlg.GetPathName(), CHMXDialog::BITMAP_STRETCH );
- }
- }