图纸问题 [英] Drawing Issue

查看:40
本文介绍了图纸问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于Win32的应用程序上工作.当我单击一个按钮时,使用WinExec打开命令提示符,但是当我移动命令窗口时,我感觉我的应用程序未完成绘制.

我要做的是:

I am working on a win32 based application. When Iclick on a button, the command prompt is opened using WinExec, but when I move the command window than I feel that drawing is not done on my application.

What I do is:

case WM_ERASEBKGND:
        InvalidateRect(hwnd,NULL,TRUE);
        break;


最后,它运行良好,但是当我在Windows CE机器上对其进行测试时,问题仍然相同.

仅供参考,此应用程序在那里充当外壳.
我没有使用WinExec,而是使用CreateProcess


It is working fine at my end but when I test it on Windows CE machine than the problem remains the same.

FYI this application works as a shell there.
Instead of using WinExec i used CreateProcess

STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
TCHAR  wchCmdPath[MAX_PATH];
memset(wchCmdPath,_T(''\0''),MAX_PATH);
GetSystemDirectory(wchCmdPath,MAX_PATH);
wcscat(wchCmdPath,_T("\\cmd.exe"));
// Start the child process.
 if( !CreateProcess( NULL,   // No module name (use command line)
     wchCmdPath,        // Command line
     NULL,           // Process handle not inheritable
     NULL,           // Thread handle not inheritable
     FALSE,          // Set handle inheritance to FALSE
     0,              // No creation flags
     NULL,           // Use parent''s environment block
     NULL,           // Use parent''s starting directory
     &si,            // Pointer to STARTUPINFO structure
     &pi )           // Pointer to PROCESS_INFORMATION structure
 )
 {
    return;
 }
 CloseHandle( pi.hProcess );
 CloseHandle( pi.hThread );




提前谢谢.

理查德,你好,
感谢您的答复.
所有绘图均在WM_PAINT中完成.当单击按钮的图像显示在优化校准上时,应用程序有6个按钮.图片控件是动态创建的.
如果图片大于滚动条.
在WM_PAINT上,所有绘制均已完成.
对于按钮,有一个类可以加载图像并绘制按钮.
EnglishBtn.LoadFromRec(IDB_BITMAP_SR);//按钮中的图像是从资源中加载的
EnglishBtn.Paint();//绘制按钮.
我在
时编写InvalidateRect的代码 1)单击按钮并显示图像.
2)用户滚动图片.
当我单击按钮,滚动图像等时,一切工作正常.但是,当我执行命令提示符并快速移动时,该部分显示为灰色.
现在请告诉我我错了:(
再次感谢. -Shilpi Boosar 7小时前




Thanks in advance.

Hi Richard,
Thanks for ur reply.
All drawing is done in WM_PAINT. Application have 6 buttons when click on buttons image is displayed on Picture control. Picture control is dynamically created.
If picture is large than scrolling is enabled.
on WM_PAINT all painting is done.
For button there is a class that load the image and paint the button.
EnglishBtn.LoadFromRec(IDB_BITMAP_SR);// Image in button is loaded from resource
EnglishBtn.Paint();// Paint button.
I write the code of InvalidateRect when
1) Button is clicked and image is displayed.
2) User scroll the picture.
Everything working fine when i click on button, scroll the image etc. But when i execute the command prompt and move quickly than that portion displayed gray.
Now please tell me where i am wrong :(
Thanks again. - Shilpi Boosar 7 hrs ago

推荐答案

您应该使用MFC或WTL框架(WTL是原始Win32中最接近的框架),通常,您将浪费更多时间来解决此问题而不是学习其中任何一项的ABC.
You should use MFC or WTL framework (WTL is the nearest of raw Win32) , typically you will waste more time trying to solve this problem(s) than learning the ABC of any one of these.


尝试使用CreateProcess(..)函数
或在辅助线程中调用WinExec(..)函数:)

(我会删除WM_ERASEBKGND情况... :))
Try to use CreateProcess(..) function
or call the WinExec(..) function in a secondary thread :)

(I would remove the WM_ERASEBKGND case... :) )


仅当应用程序的某些内容已更改并且需要重新粉刷时,才应使用InvalidateRect().当您得到 WM_ERASEBKGND [
You should only use InvalidateRect() when some of the content of your application has changed and you need to repaint it. When you get a WM_ERASEBKGND[^] the invalidate has already occurred, and you should take action as required. The actual repaint of your window should happen in response to a WM_PAINT; you may want to check you are responding correctly there.


这篇关于图纸问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆