FillRectangle可以填充Rectangle的内部,如果我想填充Rectangle的外部该怎么办?

qiuxin425 2010-10-19 10:58:40
如题,填充Rectangle的外部,代码是什么?

在线等,解决马上结贴
...全文
494 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiuxin425 2010-10-19
  • 打赏
  • 举报
回复
picturebox的内部有个矩形,怎么把这个矩形框的外部填充一下底色也行

最笨的方法是分成四部分来填充,不知道还有没有别的好方法

等待高手......
qiuxin425 2010-10-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 errorcode1987 的回复:]

这个是相对来说的~~
只不过填充了之后颜色不同,我也可以说填充了外部啊(以内部颜色为基本色)
[/Quote]
您回答了我的关于
http://topic.csdn.net/u/20101019/09/871e60a0-34c8-446f-be07-a95b959174fd.html
知道我想填充外部,也就是画完把矩形框外面的再涂一下
ErrorCode1987 2010-10-19
  • 打赏
  • 举报
回复
这个是相对来说的~~
只不过填充了之后颜色不同,我也可以说填充了外部啊(以内部颜色为基本色)
qiuxin425 2010-10-19
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 lorenliu 的回复:]

用XOR来得到外部的Region

C# code

public partial class Form1 : Form
{
Region m_Region;
public Form1()
{
InitializeComponent();
// The rectangle in the ……
[/Quote]

牛人
LorenLiu 2010-10-19
  • 打赏
  • 举报
回复
用XOR来得到外部的Region


public partial class Form1 : Form
{
Region m_Region;
public Form1()
{
InitializeComponent();
// The rectangle in the picture box
Region rec1 = new Region(new Rectangle(10, 10, 30, 30));

// The picture box region
Region rec2 = new Region(pictureBox1.ClientRectangle);

// Get the region out of the retangle
rec2.Xor(rec1);

m_Region = rec2;
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillRegion(Brushes.Red, m_Region);
}
}
qiuxin425 2010-10-19
  • 打赏
  • 举报
回复
没有方法了么

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧