VC实现屏幕变暗效果
【打印文章】
网络上有很多利用VB编程实现屏幕变暗的效果(像关闭Win95时的效果),我用VC改写了一下,权利属于原文作者!
正文
HDC hdc;
//屏幕的宽度个高度
int SCRWidth,SCRHeight;
if(m_Bool)
{
BYTE bybits[] = {0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0};
hBitmap = ::CreateBitmap(8, 8, 1, 1, bybits);
hBrush = ::CreatePatternBrush(hBitmap);
hdc = ::GetDC(NULL);
SCRWidth = ::GetSystemMetrics(SM_CXSCREEN);
SCRHeight = ::GetSystemMetrics(SM_CYSCREEN);
::SelectObject(hdc,hBrush);
//0xA000C9
::PatBlt(hdc,0,0,SCRWidth,SCRHeight,0xA000C9);
::DeleteObject(hBrush);
::ReleaseDC(0, hdc);
}
else
//重画整个屏幕
::InvalidateRect(NULL, 0, 1);
正文完,本文源代码:
http://www.vchelp.net/ASP/ibr_upload/656.rar
正文
HDC hdc;
//屏幕的宽度个高度
int SCRWidth,SCRHeight;
if(m_Bool)
{
BYTE bybits[] = {0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0,
0x55, 0x0, 0xAA, 0x0};
hBitmap = ::CreateBitmap(8, 8, 1, 1, bybits);
hBrush = ::CreatePatternBrush(hBitmap);
hdc = ::GetDC(NULL);
SCRWidth = ::GetSystemMetrics(SM_CXSCREEN);
SCRHeight = ::GetSystemMetrics(SM_CYSCREEN);
::SelectObject(hdc,hBrush);
//0xA000C9
::PatBlt(hdc,0,0,SCRWidth,SCRHeight,0xA000C9);
::DeleteObject(hBrush);
::ReleaseDC(0, hdc);
}
else
//重画整个屏幕
::InvalidateRect(NULL, 0, 1);
正文完,本文源代码:
http://www.vchelp.net/ASP/ibr_upload/656.rar
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】