今天才发现,网上误人子弟的事还很多----关于做不规窗体
2004-03-30 09:32
501 查看
关于不规窗体偶看到两种方法:
http://tech.ccidnet.com/pub/disp/Article?columnID=294&articleID=25457&pageNO=1
关键是这几句话:
Graphics g = e.Graphics;
Rectangle mainRect = new Rectangle(0, 0, 695, 278);
Region mainRegion = new Region(mainRect);
e.Graphics.SetClip(mainRegion, CombineMode.Replace);
Point point1 = new Point(0, 32);
Point point2 = new Point(9, 20);
Point point3 = new Point(21, 13);
Point point4 = new Point(34, 9);
// 创建一个以点为元素的数组
Point[] curvePoints = { point1, point2, point3, point4 };
// 创建一个GraphicsPath对象并添加一条曲线
GraphicsPath myPath = new GraphicsPath();
myPath.AddCurve(curvePoints, 0, 3, 0.8f);
myPath.AddLine(36, 9, 378, 9);
point1.X=378;point1.Y=9;
point2.X=387;point2.Y=5;
point3.X=394;point3.Y=0;
Point[] curvePoints2 = { point1, point2, point3 };
myPath.AddCurve(curvePoints2, 0, 2, 0.8f);
myPath.AddLine(394, 0, 0, 0);
Region ExcludeRegion3 = new Region(myPath);
e.Graphics.ExcludeClip(ExcludeRegion3);
GraphicsPath myPath3 = new GraphicsPath();
point1.X=0;point1.Y=180;
point2.X=19;point2.Y=198;
point3.X=62;point3.Y=204;
point4.X=83;point4.Y=221;
Point point5 = new Point(93, 248);
Point point6 = new Point(102, 267);
Point point7 = new Point(125, 278);
Point[] curvePoints3 = { point1, point2, point3, point4,
point5, point6, point7 };
myPath3.AddCurve(curvePoints3, 0, 6, 0.8f);
myPath3.AddLine(125, 278, 90, 300);
myPath3.AddLine(90, 300, 0, 300);
Region ExcludeRegion2 = new Region(myPath3);
e.Graphics.ExcludeClip(ExcludeRegion2);
point1.X=454;point1.Y=0;
point2.X=470;point2.Y=12;
point3.X=481;point3.Y=34;
Point[] curvePoints4 = { point1, point2, point3 };
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddCurve(curvePoints4, 0, 2, 0.8f);
myPath2.AddLine(481, 30, 481, 76);
myPath2.AddLine(481, 76, 495, 76);
myPath2.AddLine(495, 76, 495, 0);
Region ExcludeRegion4 = new Region(myPath2);
e.Graphics.ExcludeClip(ExcludeRegion4);
GraphicsPath myPath5 = new GraphicsPath();
point1.X=481;point1.Y=76;
point2.X=494;point2.Y=115;
point3.X=481;point3.Y=158;
Point[] curvePoints5 = { point1, point2, point3 };
myPath5.AddCurve(curvePoints5, 0, 2, 0.8f);
myPath5.AddLine(481, 158, 481, 279);
myPath5.AddLine(481, 255, 495, 279);
myPath5.AddLine(495, 279, 495, 0);
Region ExcludeRegion6 = new Region(myPath5);
e.Graphics.ExcludeClip(ExcludeRegion6);
point1.X=480;point1.Y=250;
point2.X=469;point2.Y=264;
point3.X=446;point3.Y=278;
Point[] curvePoints6 = { point1, point2, point3 };
GraphicsPath myPath4 = new GraphicsPath();
myPath4.AddCurve(curvePoints6, 0, 2, 0.8f);
myPath4.AddLine(450, 277, 495, 279);
Region ExcludeRegion5 = new Region(myPath4);
e.Graphics.ExcludeClip(ExcludeRegion5);
e.Graphics.DrawImage(img, 0, 0, 695,278);
// 重设剪切好的区域
e.Graphics.ResetClip();
和这样一种:
(最好不要用:为什么,呵呵,用了就知道.)
http://www.6to23.com/s11/s11d8/s11d8d2/200416113027.htm
http://tech.ccidnet.com/pub/disp/Article?columnID=294&articleID=25457&pageNO=1
关键是这几句话:
Graphics g = e.Graphics;
Rectangle mainRect = new Rectangle(0, 0, 695, 278);
Region mainRegion = new Region(mainRect);
e.Graphics.SetClip(mainRegion, CombineMode.Replace);
Point point1 = new Point(0, 32);
Point point2 = new Point(9, 20);
Point point3 = new Point(21, 13);
Point point4 = new Point(34, 9);
// 创建一个以点为元素的数组
Point[] curvePoints = { point1, point2, point3, point4 };
// 创建一个GraphicsPath对象并添加一条曲线
GraphicsPath myPath = new GraphicsPath();
myPath.AddCurve(curvePoints, 0, 3, 0.8f);
myPath.AddLine(36, 9, 378, 9);
point1.X=378;point1.Y=9;
point2.X=387;point2.Y=5;
point3.X=394;point3.Y=0;
Point[] curvePoints2 = { point1, point2, point3 };
myPath.AddCurve(curvePoints2, 0, 2, 0.8f);
myPath.AddLine(394, 0, 0, 0);
Region ExcludeRegion3 = new Region(myPath);
e.Graphics.ExcludeClip(ExcludeRegion3);
GraphicsPath myPath3 = new GraphicsPath();
point1.X=0;point1.Y=180;
point2.X=19;point2.Y=198;
point3.X=62;point3.Y=204;
point4.X=83;point4.Y=221;
Point point5 = new Point(93, 248);
Point point6 = new Point(102, 267);
Point point7 = new Point(125, 278);
Point[] curvePoints3 = { point1, point2, point3, point4,
point5, point6, point7 };
myPath3.AddCurve(curvePoints3, 0, 6, 0.8f);
myPath3.AddLine(125, 278, 90, 300);
myPath3.AddLine(90, 300, 0, 300);
Region ExcludeRegion2 = new Region(myPath3);
e.Graphics.ExcludeClip(ExcludeRegion2);
point1.X=454;point1.Y=0;
point2.X=470;point2.Y=12;
point3.X=481;point3.Y=34;
Point[] curvePoints4 = { point1, point2, point3 };
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddCurve(curvePoints4, 0, 2, 0.8f);
myPath2.AddLine(481, 30, 481, 76);
myPath2.AddLine(481, 76, 495, 76);
myPath2.AddLine(495, 76, 495, 0);
Region ExcludeRegion4 = new Region(myPath2);
e.Graphics.ExcludeClip(ExcludeRegion4);
GraphicsPath myPath5 = new GraphicsPath();
point1.X=481;point1.Y=76;
point2.X=494;point2.Y=115;
point3.X=481;point3.Y=158;
Point[] curvePoints5 = { point1, point2, point3 };
myPath5.AddCurve(curvePoints5, 0, 2, 0.8f);
myPath5.AddLine(481, 158, 481, 279);
myPath5.AddLine(481, 255, 495, 279);
myPath5.AddLine(495, 279, 495, 0);
Region ExcludeRegion6 = new Region(myPath5);
e.Graphics.ExcludeClip(ExcludeRegion6);
point1.X=480;point1.Y=250;
point2.X=469;point2.Y=264;
point3.X=446;point3.Y=278;
Point[] curvePoints6 = { point1, point2, point3 };
GraphicsPath myPath4 = new GraphicsPath();
myPath4.AddCurve(curvePoints6, 0, 2, 0.8f);
myPath4.AddLine(450, 277, 495, 279);
Region ExcludeRegion5 = new Region(myPath4);
e.Graphics.ExcludeClip(ExcludeRegion5);
e.Graphics.DrawImage(img, 0, 0, 695,278);
// 重设剪切好的区域
e.Graphics.ResetClip();
和这样一种:
(最好不要用:为什么,呵呵,用了就知道.)
http://www.6to23.com/s11/s11d8/s11d8d2/200416113027.htm
相关文章推荐
- 今天发现一个关于CSS的东东,解决了我很多疑问
- 真是学无止境阿——关于PCA投影建模,今天又学到了很多
- 网上很多Rose2003的破解方式都无效,下面是几经尝试发现的方法。
- 今天在网上发现一个不错的软件外包的网站
- 今天才发现badkeeper关于Resource Manager的设计真是妙啊!
- 今天看StarterKit.Communities中的关于获取路径部分,发现一个问题?难道老外也会不仔细看MSDN,还是?
- 网上查了点关于windows注册表的知识,发现基本名词没理解好,于是整理这篇笔记(可能个别地方不准确,先这么理解吧),有了这个理解,再去看网上的文章,就差不读了
- python3.x的torndb使用记录(发现网上没有关于torndb的使用说明,可能太简单了吧:-P)
- 自己写的两个方法,关于bean和map的转化,比网上的效率快很多
- 今天发现的关于gridview不显示内容的问题
- 关于Activity启动模式(launchMode)和intent设置测试后 发现和网上说的不符 是不是我错了 求解
- 今天,突然发现,我的一篇文章被很多网站相继转载。
- 发现万方数据库中很多的内容是关于技术的研究 很奇怪
- 今天发现关于Ajax异步的问题
- 在经营景城网过程中,发现了很多自身存在的问题,五十四句关于人性的些许总结,惊醒自己,也警示别人。
- JQuery怎么取Label的值(哥发现网上很多发”Jquery取值集锦“的大侠 都没有提及”innerText“)
- 关于Activity启动模式(launchMode)和intent设置测试后 发现和网上说的不符 是不是我错了 求解
- 今天发现了JBuilder 2006 一个BUG,关于资源文件重构后的BUG
- 今天碰到一个问题,在网上查了一下,发现有人碰到。转一下
- 今天发现一个Java的关于java.io.File在处理com1到com9为文件名的Bug.