怎么重画? [英] How to repaint?
问题描述
我打开一个菜单,然后显示一个字符串。一旦它被图片覆盖,那么当图片被删除时,该位置上没有字符串。
I open a menu open, and show a string. as soon as it was covered by a pic, then there is no string on the very position, when the pic was deleted.
如何自动重新绘制它?我尝试使用beginpaint和endpaint,什么都不做。
How shall I repaint it automatically,? I try to use beginpaint and endpaint, do nothing.
.....
char szBuffer [60]; // =" that人民,人民,人民的政府不得在世界上留下";
char szBuffer[60] ;//="that goverment of the people,for the people,by the people shall not persh in the world";
案件WM_COMMAND:
wmId   = LOWORD(wParam);
wmEvent = HIWORD(wParam);
//解析菜单选项:
switch(wmId)
{
case IDM_OPEN:
  HDC =的GetDC(HWND); //尝试使用BeginPaint和endp ...什么都不做。
xClient = LOWORD(lParam);
yClient = HIWORD (lParam);
int a,b;
a = 2; b = 6;
int nLength;
nLength = wsprintf (szBuffer,"总和%d和%d是 %d",a,b,a + b);
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_OPEN:
hdc=GetDC(hWnd); //try BeginPaint and endp... do nothing.
xClient=LOWORD(lParam);
yClient=HIWORD(lParam);
int a,b;
a=2; b=6;
int nLength;
nLength=wsprintf(szBuffer,"The sum %d and %d is %d",a,b,a+b);
TextOut(hdc,60,300, szBuffer,nLength); // 输出此处问题
DrawRectangle(hWnd);
ReleaseDC(hWnd,hdc);
TextOut(hdc,60,300,szBuffer,nLength);//output here problem
DrawRectangle(hWnd);
ReleaseDC(hWnd,hdc);
return 0;
return 0;
推荐答案
我打开一个菜单,然后显示一个字符串。一旦它被照片覆盖,那么当照片被删除时,该位置上没有字符串。
如何自动重新绘制它?我尝试使用beginpaint和endpaint,什么都不做。
I open a menu open, and show a string. as soon as it was covered by a pic, then there is no string on the very position, when the pic was deleted.
How shall I repaint it automatically,? I try to use beginpaint and endpaint, do nothing.
你需要能够绘制你需要重绘的所有东西。 $ b你的WM_PAINT处理程序。
You need to have the ability to draw everything you need to redraw in
your WM_PAINT handler.
戴夫
这篇关于怎么重画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!