About Memory DC's BitBlt(), that so complex for me.

sybaselu 2007-01-31 04:41:52
1 Suppose there are 3 lines texts for scrolling from bottom to top.
2 some clips source code be illustrated as follow:
ScrollStatic::OnPaint()
{
...
CPaintDC PaintDC(this);
MemDC dc(&PaintDC);
...
CRect rect;
GetClientRect(&rect);
for( int i = 0 ; i <3; i ++ )
{
...
dc.DrawText(..., rect, ... );
rect.top += Height_Of_Font;
}
}
I have been stucking in the a pices of code for servel days,so I have no chioces but to do for helping. in the loop of the function, to my pointview, the drawing process should be like this:
(top)
|
|
|
------------>

|
|
------------>

poxY
|
------------>posX
(bottom)
suppose "|" be represented by Hight_Of_Font and the direction of scroll is from bottom to top.
3 firstly, dc object be initialized with address of PaintDC, so
a memeory DC should be created in memory, the dimension of m_rect is alternative:left = 0, top = 0, height = xx, width = xx
my question is that
what's relationship between m_rect and rect?
how does BitBlt works?



...全文
207 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sybaselu 2007-02-01
  • 打赏
  • 举报
回复
是这么想的,BitBlt(...)的本质是先用DrawText(...)在memory中先画好将要显示的stuff,当需要显示时, 然后一次性从memory中拷贝的screen的memory中,这样的好处就是避免边DrawText(),便于流畅显示,不会闪烁,抖动,毕竟便画,便显示,很好时。
sybaselu 2007-01-31
  • 打赏
  • 举报
回复
Whatever how many dc objects were created, the worth of left and top of m_rect are always equal 0 , on other hand, the value of Height() and Width() are always constant , why? so I think the block-bit data be copied from memory to rect
wormwormwormworm 2007-01-31
  • 打赏
  • 举报
回复
UP

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧