vc 常用语句

1)

CMainFrame* pmainframe=(CMainFrame*)AfxGetMainWnd();
CChildFrame *m_finderframe=(CChildFrame*)pmainframe->GetActiveFrame();

CImageView *m_View=(CImageView*)pmainframe->GetActiveFrame()->GetActiveView();

 CXXXView* pV = (CXXXView*)m_wndSplitter.GetPane(i,j);

2)

menu

1\ON_COMMAND(ID_creat_template, Oncreattemplate)     ".cpp"   //BEGIN_MESSAGE_MAP

2\void CMainFrame::Oncreattemplate()    ".cpp"

3\afx_msg void Oncreattemplate();      ".H"    //DECLARE_MESSAGE_MAP()

 

button

1\ON_BN_CLICKED(IDC_com_showsource, Oncomshowsource)  ".cpp"   //BEGIN_MESSAGE_MAP

2\void CControlDlg::Oncomshowsource()        ".cpp"              

 3\afx_msg void Oncomshowsource();     ".h"   //DECLARE_MESSAGE_MAP()

3)clw show

1、BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ".cpp"     
 //{{AFX_MSG_MAP(CMainFrame)
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()

2、 //{{AFX_MSG(CMainFrame)     ".h" 
 //}}AFX_MSG
 DECLARE_MESSAGE_MAP()

 3、// Overrides               ".h" 
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMainFrame)
 //}}AFX_VIRTUAL

3)

 CMainFrame* pmainframe=(CMainFrame*)AfxGetMainWnd();

//CImageView *m_View=(CImageView*)pmainframe->GetActiveFrame()->GetActiveView();

4)

  str2.Format ("%d",i);
      m_runtime_combo.InsertString(i,(str2));
   m_source_combo.InsertString(i,(str2));

 

location: all
CComboBox* pcom_run =(CComboBox*) GetDlgItem(IDC_COMBO_runtime);
     pcom_run->GetWindowText(str4);

5)

CString CBMP::GetExeAbsolutePath()
{
    char buffer[ MAX_PATH ];
    CString ExePath = "";
    GetModuleFileName( NULL, buffer, MAX_PATH );
    ExePath=CString( buffer );
    ExePath=ExePath.Left(
                ExePath.ReverseFind( '\\' )>ExePath.ReverseFind( '/' )?
                ExePath.ReverseFind( '\\' )+ 1:
                ExePath.ReverseFind( '/' )+1       
                );
    return ExePath;
}

6) draw Rectangle

 CClientDC dc(pView);

       dc.SetROP2(R2_NOT); //创建一个矩形3
       dc.SelectStockObject(NULL_BRUSH);
       dc.Rectangle(CRect(px,pe));

  

 CClientDC dc(pView);

CBrush brushBlue(RGB(0, 0, 255));  //set color
   CBrush* pOldBrush = dc.SelectObject(&brushBlue); //set color

      dc.Rectangle(CRect(px,pe));

      dc.SelectObject(pOldBrush);  //set color

 

posted on 2013-09-21 13:06  song2013  阅读(442)  评论(0编辑  收藏  举报

导航