龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC实用小知识总结 (一)(8)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
int nEllipse = nUnits/3 // calculate how many to draw int nIndex // current ellipse that is being draw CBrush brush // bursh used for ellipse fill color CBrush *pBrushOld // previous brush that was se

  int nEllipse = nUnits/3 // calculate how many to
  draw
  int nIndex
  // current ellipse that is being draw

  CBrush brush
  // bursh used for ellipse fill color
  CBrush *pBrushOld // previous
  brush that was selected into dc
  //draw ellipse , gradually moving towards upper-right
  corner
  for (nIndex = 0 nIndes < + nEllipse nIndes++)
  {
  //creat solid brush
  brush . CreatSolidBrush (RGB ( ( (nIndex*byRed ) /nEllipse ).
  ( ( nIndex * byGreen ) /nEllipse ), ( (nIndex * byBlue)
  /nEllipse ) ) )

  //select brush into dc
  pBrushOld= dc .SelectObject (&brhsh)

  //draw ellipse
  dc .Ellipse ( (int) fltStepHorz * 2, (int) fltStepVert * nIndex ,
  rect. right -( (int) fltStepHorz * nIndex )+ 1,
  rect . bottom -( (int) fltStepVert * (nIndex *2) ) +1)

  //delete the brush
  brush.DelecteObject ( )
  }
  }

  最后,处理WM_NCHITTEST消息,使当击打窗口的任何位置时能移动窗口。

   UINT CRoundDlg : : OnNchitTest (Cpoint point )
  {
  //Let user move window by clickign anywhere on thewindow .
  UINT nHitTest = CDialog : : OnNcHitTest (point)
  rerurn (nHitTest = = HTCLIENT)? HTCAPTION: nHitTest

  }

  (25) 如何获取应用程序的 实例句柄?

  应用程序的实例句柄保存在CWinApp m_hInstance 中,可以这么调用AfxGetInstancdHandle获得句柄.

   Example: HANDLE hInstance=AfxGetInstanceHandle()

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接