首页 技术 正文
技术 2022年11月16日
0 收藏 342 点赞 2,209 浏览 1452 个字
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
static RECT rect,rect2,rect3;
static cxClient, cyClient;
static HBRUSH hBrush, hOldBrush;
POINT pt; switch (message)
{
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
break;
case WM_LBUTTONDOWN:
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
if (PtInRect(&rect2,pt))
{
MessageBox(NULL, L"clicked", L"info", NULL);
} break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
//处理矩形
// rect.left = cxClient / 2 - 50;
// rect.right = cxClient / 2 + 50;
// rect.top = cyClient / 2 - 50;
// rect.bottom = cyClient / 2 + 50; hBrush = CreateSolidBrush(RGB(,,));
//1.fillrect 填充矩形
//FillRect(hdc, &rect, hBrush);
//2.framerect 改画笔为画刷来绘制边框
//FrameRect(hdc, &rect, hBrush);
//3.invertrect 翻转矩形内所有的像素
//InvertRect(hdc, &rect);//4.生成矩形SetRect
SetRect(&rect, cxClient / - , cyClient / - , cxClient/ + , cyClient/ + );
//5.偏移矩形OffsetRect
OffsetRect(&rect, -, -);
FillRect(hdc, &rect, hBrush);
InvertRect(hdc, &rect); //先显示图像,后翻转
//6.增大减小,长宽同时InflateRect
SetRect(&rect, cxClient / - , cyClient / - , cxClient / + , cyClient / + );
InflateRect(&rect, , );
FillRect(hdc, &rect, hBrush);
//7.setrectEmpty 设置矩形为空
FillRect(hdc, &rect, hBrush); //不会显示
//8.copyrect 多用在映射中
CopyRect(&rect2, &rect); //将rect的坐标拷贝给rect2
SetRectEmpty(&rect);//将矩形的各个坐标设为0,则会显示rect2
hBrush = CreateSolidBrush(RGB(, , ));
FillRect(hdc, &rect2, hBrush);
//9.intersectrect 两个矩形交集
//10.unionrect 两个矩形并集
//11.Isrectempty 判断是否为空
//12.ptinrect 判断点是否在矩形中(重要) EndPaint(hwnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage();
return ;
} return DefWindowProc(hwnd, message, wParam, lParam);
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,965
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,486
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,331
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,114
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,747
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,781