WEB开发网
开发学院软件开发VC Visual C++入门常见问题小结 阅读

Visual C++入门常见问题小结

 2009-04-24 20:03:19 来源:WEB开发网   
核心提示: void CSampleDialog : : OnLbuttonDown (UINT nFlags, Cpoint point ) {Cdialog : : OnLButtonDow (nFlags, goint );//Fool dialog into thinki

 void CSampleDialog : : OnLbuttonDown (UINT nFlags, Cpoint point )
 

  {

  Cdialog : : OnLButtonDow (nFlags, goint );

  //Fool dialog into thinking simeone clicked on its caption bar .

  PostMessage (WM_NCLBUTTONDOWN , HTCAPTION , MAKELParm (point.x , point. y) )

  }

19.如何改变视窗的背景颜色

Windows向窗口发送一个WM_ERASEBKGND消息通知该窗口擦除背景,可以使用ClassWizard重载该消息的缺省 处理程序来擦除背景(实际是画),并返回TRUE以防止Windows擦除窗口。

 

  //Paint area that needs to be erased.

  BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)

  {

  // Create a pruple brush.

  CBrush Brush (RGB (128 , 0 , 128) );

  // Select the brush into the device context .

  CBrush* pOldBrush = pDC—>SelcetObject (&brush);

  // Get the area that needs to be erased .

  CRect reClip ;

  pDC—>GetCilpBox (&rcClip);

  //Paint the area.

  pDC—> PatBlt (rcClip.left , rcClip.top ,

  rcClip.Width ( ) , rcClip.Height ( ) , PATCOPY );

  //Unselect brush out of device context .

  pDC—>SelectObject (pOldBrush );

  // Return nonzero to half fruther processing .

  return TRUE;

  }

 

上一页  2 3 4 5 6 7 8  下一页

Tags:Visual 入门 常见问题

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接