InvalidateRect的参数问题,以及还有其他两个问题
1,原先用Invalidate,发现程序软件闪屏很厉害,后来查了下,改成InvalidateRect,起先是用InvalidateRect(&rc,1);
后面用多了,就给漏了&,成了InvalidateRect(rc,1);,又貌似2个好像都可以,那到底是用哪个呢》
还有 参数2,true跟false的差别是什么?
2,关于最小化与还原问题
我的MFC工程的对话框是无border的,最小化前的样式如下图
之后我最小化后,然后还原,窗口莫名多了个border的样子,怎么回事?如下图
3,怎么在任务管理器的应用程序选卡上显示 程序图标?
[解决办法]
InvalidateRect()
lpRect
[in] Pointer to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is NULL, the entire client area is added to the update region.
bErase
[in] Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged.
第一个参数加不加&都可以
[解决办法]
1. CWnd::InvalidateRect()
- C/C++ code
void InvalidateRect( LPCRECT lpRect, BOOL bErase = TRUE );
[解决办法]
1.如果rc是CRect对象,有&,相当于取RECT指针(CRect继承于RECT),无&,CRect重载了LPCRECT运算符
两种都可以,严谨的写法应该是不加&
参数2,true跟false的说明参看 InvalidateRect 的说明文档,跟背景重绘有关的。
2.不像是系统加上去的,1单位的白色边框,更像是自绘的。
3.任务管理器无显示程序图标的功能吧。
[解决办法]
1、加不加 &号都是一样,漏了&,函数会自动给加上。
bErase:指出无效矩形被标记为有效后,是否重画该区域,重画时用预先定义好的画刷。当指定TRUE时需要重画。
2、??
3、构造函数中,加载自己的应用程序图标:m_hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
[解决办法]
你用spy++看看你的窗口是不是有WS_THICKFRAME
有的话就取消
图标的问题你是不是没有为应用程序设置图标