| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 741 人关注过本帖
标题:请教各位superman一个问题
只看楼主 加入收藏
xudidi
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-3-31
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
请教各位superman一个问题
如何求解两个图形的交集、并集以及两个图形相减后的图形?求编程思路,能有程序就更好啦!
谢谢啦。。。
搜索更多相关主题的帖子: superman 
2010-03-31 15:02
james230932
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:2
帖 子:162
专家分:629
注 册:2008-1-20
收藏
得分:0 
坐等SUPERMAN的出现..

老天给了我十根纤纤玉指,我却用它们来挖鼻屎。
2010-03-31 15:11
xydddaxia
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:33
帖 子:466
专家分:2307
注 册:2009-3-20
收藏
得分:20 
程序代码:
    Rectangle rec = new Rectangle(0,0,100, 72);//0,0坐标,长100高72的矩形
    private void button1_Click(object sender, EventArgs e)
        {
            Bitmap bmp=new Bitmap(this.Width,this.Height);//申请图片
            Graphics myGraphics = Graphics.FromImage(bmp);
            GraphicsPath myGraphicsPath = new GraphicsPath();//声明路径myGraphicsPath
            FontFamily myFontFamily = new FontFamily("黑体");
            Point myPoint = new Point(0, 0);
            StringFormat myStringFormat = new StringFormat();
            myGraphicsPath.AddString("要取交集的文字",myFontFamily, 1, 72, myPoint, myStringFormat);
            Pen myPen = new Pen(Color.Red, 1);
            myGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;//反锯齿
            myGraphics.DrawPath(myPen, myGraphicsPath); //绘制路径myGraphicsPath
            SolidBrush myBrash = new SolidBrush(Color.Red);
            else
            {
                Region re = new Region(rec);//声明Region对象并用rec初始化
                re.Intersect(myGraphicsPath); //区交集
                myGraphics.FillRegion(myBrash, re); ////用myBrash填充re的内部
                this.CreateGraphics().DrawImage(bmp,0,0);//将内存中的图片显示出来
                myGraphics.Dispose();//释放资源
            }
}
//一个文字与一个矩形取交集的例子,希望有帮助~~

站在春哥的肩膀上
2010-03-31 18:27
xudidi
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-3-31
收藏
得分:0 
以下是引用xydddaxia在2010-3-31 18:27:08的发言:

    Rectangle rec = new Rectangle(0,0,100, 72);//0,0坐标,长100高72的矩形
    private void button1_Click(object sender, EventArgs e)
        {
            Bitmap bmp=new Bitmap(this.Width,this.Height);//申请图片
            Graphics myGraphics = Graphics.FromImage(bmp);
            GraphicsPath myGraphicsPath = new GraphicsPath();//声明路径myGraphicsPath
            FontFamily myFontFamily = new FontFamily("黑体");
            Point myPoint = new Point(0, 0);
            StringFormat myStringFormat = new StringFormat();
            myGraphicsPath.AddString("要取交集的文字",myFontFamily, 1, 72, myPoint, myStringFormat);
            Pen myPen = new Pen(Color.Red, 1);
            myGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;//反锯齿
            myGraphics.DrawPath(myPen, myGraphicsPath); //绘制路径myGraphicsPath
            SolidBrush myBrash = new SolidBrush(Color.Red);
            else
            {
                Region re = new Region(rec);//声明Region对象并用rec初始化
                re.Intersect(myGraphicsPath); //区交集
                myGraphics.FillRegion(myBrash, re); ////用myBrash填充re的内部
                this.CreateGraphics().DrawImage(bmp,0,0);//将内存中的图片显示出来
                myGraphics.Dispose();//释放资源
            }
}//一个文字与一个矩形取交集的例子,希望有帮助~~
嗯。。。非常感谢!思路应该是一样的!谢谢啦
2010-04-01 14:21
快速回复:请教各位superman一个问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017752 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved