cod*_*rix 2 .net c# gdi
我想将矩形的大小增加10像素.以下代码似乎无效.假设sampleRect是我的矩形.请告诉我.
Rectangle temp = new Rectangle( sampleRect.X - 10, sampleRect.Y - 10, sampleRect.Width + 2*10, sampleRect.Height + 2*10);
Tom*_*cek 12
它会工作,但您可以使用该Inflate方法更优雅地编写相同的东西:
Inflate
rect.Inflate(10, 10);
您的方法和Inflate方法之间的一个重要区别是您创建了一个新的矩形实例,同时Inflate修改了现有的矩形.
归档时间:
15 年,3 月 前
查看次数:
7474 次
最近记录: