C#實現(xiàn)圖形區(qū)域組合操作的方法
更新時間:2015年06月12日 16:17:07 作者:zhuzhao
這篇文章主要介紹了C#實現(xiàn)圖形區(qū)域組合操作的方法,涉及C#操作圖片實現(xiàn)組合操作的相關(guān)技巧,需要的朋友可以參考下
本文實例講述了C#實現(xiàn)圖形區(qū)域組合操作的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace advanced_drawing { public partial class Form17 : Form { public Form17() { InitializeComponent(); } private void Form17_Paint(object sender, PaintEventArgs e) { Rectangle regionRect = new Rectangle(20, 20, 100, 100); e.Graphics.DrawRectangle(Pens.Black, regionRect); RectangleF unionRect = new RectangleF(90, 30, 100, 100); e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(unionRect)); Region myRegion = new Region(regionRect); //myRegion.Union(unionRect); //myRegion.Intersect(unionRect); //myRegion.Exclude(unionRect); //myRegion.Complement(unionRect); myRegion.Xor(unionRect); SolidBrush myBrush = new SolidBrush(Color.Blue); e.Graphics.FillRegion(myBrush, myRegion); } } }
希望本文所述對大家的C#程序設(shè)計有所幫助。
相關(guān)文章
c#數(shù)據(jù)庫與TXT導(dǎo)入導(dǎo)出的實例
最近剛學(xué)完ADO.NET,做了個數(shù)據(jù)導(dǎo)入導(dǎo)出的題目,是將txt中的數(shù)據(jù)導(dǎo)入數(shù)據(jù)庫,然后將數(shù)據(jù)庫中的數(shù)據(jù)導(dǎo)出到txt中,這里說的數(shù)據(jù)的格式是“tom|23”,tom指名字,23指年齡。廢話也不多說了,大家直接看代碼。2013-04-04.NET操作NPOI實現(xiàn)Excel的導(dǎo)入導(dǎo)出
NPOI是指構(gòu)建在POI 3.x版本之上的一個程序,NPOI可以在沒有安裝Office的情況下對Word或Excel文檔進行讀寫操作,下面小編為大家介紹了如何操作NPOI實現(xiàn)Excel的導(dǎo)入導(dǎo)出,需要的可以參考一下2023-09-09.NET創(chuàng)建、刪除、復(fù)制文件夾及其子文件的實例方法
.NET創(chuàng)建、刪除、復(fù)制文件夾及其子文件的實例方法,需要的朋友可以參考一下2013-03-03C#使用Oracle.ManagedDataAccess.dll組件連接Oracle數(shù)據(jù)庫
這篇文章介紹了C#使用Oracle.ManagedDataAccess.dll組件連接Oracle數(shù)據(jù)庫的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-05-05