博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C++语言 填充选区
阅读量:4308 次
发布时间:2019-06-06

本文共 1356 字,大约阅读时间需要 4 分钟。

void CSelRectDlg::OnPaint() {    if (IsIconic())    {        CPaintDC dc(this); // device context for painting        SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);        // Center icon in client rectangle        int cxIcon = GetSystemMetrics(SM_CXICON);        int cyIcon = GetSystemMetrics(SM_CYICON);        CRect rect;        GetClientRect(&rect);        int x = (rect.Width() - cxIcon + 1) / 2;        int y = (rect.Height() - cyIcon + 1) / 2;        // Draw the icon        dc.DrawIcon(x, y, m_hIcon);    }    else    {        CRgn r1, r2, r3;        bool combin;        CPaintDC dc(this);        combin = true;        CRect rect1(20, 20, 200, 200);        CRect rect2(150, 20, 330, 200);        dc.BeginPath();        dc.Ellipse(&rect1);        dc.EndPath();        r1.CreateFromPath(&dc); //创建一个圆形路径        dc.Ellipse(&rect1); //画出圆形        dc.BeginPath();        dc.Ellipse(&rect2);        dc.EndPath();        r2.CreateFromPath(&dc);        dc.Ellipse(&rect2);        CString str1;        if(r1.CombineRgn(&r1, &r2, RGN_AND) == NULLREGION) //合并重叠区            combin = false;        if(combin == true)        {            CBrush br;            br.CreateSolidBrush(RGB(128, 128, 128));            dc.FillRgn(&r1, &br);        }        CDialog::OnPaint();    }}

转载于:https://www.cnblogs.com/pythonschool/archive/2012/11/21/2781038.html

你可能感兴趣的文章
JMter随记
查看>>
ssky-keygen + ssh-copy-id 无密码登陆远程LINUX主机
查看>>
AFO
查看>>
linux下面安装maven
查看>>
LTTng 简介&使用实战
查看>>
oracle internal: VIEW: X$KCBKPFS - PreFetch Statistics - (9.0)
查看>>
字符串匹配,KMP算法
查看>>
WCF netTcpBinding寄宿到IIS7
查看>>
基础练习
查看>>
rpm的用法 详解
查看>>
从壹开始 [vueAdmin后台] 之三 || 动态路由配置 & 项目快速开发
查看>>
Node mysql
查看>>
学习 WCF (6)--学习调用WCF服务的各种方法
查看>>
ListView几个比较特殊的属性
查看>>
NEC学习 ---- 模块 - 带点文字链接列表
查看>>
20165301 预备作业二:学习基础和C语言基础调查
查看>>
【AGC005F】Many Easy Problems (NTT)
查看>>
jquery背景自动切换特效
查看>>
【微信小游戏实战】零基础制作《欢乐停车场》二、关卡设计
查看>>
【bzoj2500】幸福的道路 树形dp+倍增RMQ+二分
查看>>