当前位置: 首页 > news >正文

wordpress 搜索小工具栏海南seo排名优化公司

wordpress 搜索小工具栏,海南seo排名优化公司,网站的友情链接做多少个比较合适,网站建设 外包是什么意思在 C# 中,Graphics 类是 System.Drawing 命名空间的一部分,它提供了一组方法和属性,用于在 Windows Forms 应用程序中进行二维绘图。Graphics 对象可以绘制文本、线条、曲线、形状和图像,并可以对它们进行变换和剪辑。 Graphics …

在 C# 中,Graphics 类是 System.Drawing 命名空间的一部分,它提供了一组方法和属性,用于在 Windows Forms 应用程序中进行二维绘图。Graphics 对象可以绘制文本、线条、曲线、形状和图像,并可以对它们进行变换和剪辑。

Graphics 类的一些常用功能和方法: 

1.绘制线条

DrawLine(Pen pen, int x1, int y1, int x2, int y2):使用指定的 Pen 对象绘制直线。

DrawLines(Pen pen, Point[] points):使用指定的 Pen 对象和点数组绘制一系列连续的线条。

public Form1()
{InitializeComponent();this.panel1.Paint += Panel1_Paint;this.panel2.Paint += Panel2_Paint;
}
//DrawLine(Pen pen, int x1, int y1, int x2, int y2)
private void Panel1_Paint(object sender, PaintEventArgs e)
{//1.创建图形(画布,画板)Graphics g = e.Graphics;//2.设置绘制参数()SetQuality(g);//3.开始绘制Pen pen = new Pen(Color.Red, 10F);Point pt1 = new Point(50, 50);Point pt2 = new Point(100, 50);g.DrawLine(pen, pt1, pt2);//注意:起点的坐标,考虑画笔的宽度Pen pen1 = new Pen(Color.Blue, 10F);Point pt3 = new Point(100 + 5, 50 - 5);Point pt4 = new Point(100 + 5, 100);g.DrawLine(pen1, pt3, pt4);
}
//DrawLines(Pen pen, Point[] points)
private void Panel1_Paint(object sender, PaintEventArgs e)
{Pen pen = new Pen(Color.Red, 10F);Point[] points = new Point[]{new Point(80,150),new Point(80,20),new Point(20,100),new Point(120,100),};g.DrawLines(pen, points);
}

2.绘制形状: 

DrawRectangle(Pen pen, int x, int y, int width, int height):使用指定的 Pen 对象绘制矩形。

DrawEllipse(Pen pen, int x, int y, int width, int height):使用指定的 Pen 对象绘制椭圆。

DrawPolygon(Pen pen, Point[] points):使用指定的 Pen 对象和点数组绘制多边形。

public Form1()
{InitializeComponent();this.panel1.Paint += Panel1_Paint;this.panel2.Paint += Panel2_Paint;this.panel3.Paint += Panel3_Paint;
}
//矩形DrawRectangle(Pen pen, int x, int y, int width, int height)
private void Panel1_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Rectangle rect = new Rectangle(20,20,100,100);g.DrawRectangle(pen1, rect);
}
//椭圆DrawEllipse(Pen pen, int x, int y, int width, int height)
private void Panel2_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Rectangle rect = new Rectangle(20,20,80,100);g.DrawEllipse(pen1, rect);//椭圆
}
//多边形DrawPolygon(Pen pen, Point[] points)
private void Panel3_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Point[] points = new Point[]{new Point(80,20),new Point(20,100),new Point(120,100),};g.DrawPolygon(pen1, points);
}

 3.填充形状

FillRectangle(Brush brush, int x, int y, int width, int height):使用指定的 Brush 对象填充矩形。

FillEllipse(Brush brush, int x, int y, int width, int height):使用指定的 Brush 对象填充椭圆。

FillPolygon(Brush brush, Point[] points):使用指定的 Brush 对象填充多边形。

public Form1()
{InitializeComponent();this.panel1.Paint += Panel1_Paint;this.panel2.Paint += Panel2_Paint;this.panel3.Paint += Panel3_Paint;
}
//FillRectangle(Brush brush, int x, int y, int width, int height)
private void Panel1_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Rectangle rect = new Rectangle(20,20,100,100);Brush brush = new SolidBrush(Color.Yellow);g.FillRectangle(brush, rect);g.DrawRectangle(pen1, rect);//矩形
}
//FillEllipse(Brush brush, int x, int y, int width, int height)
private void Panel2_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Rectangle rect = new Rectangle(20,20,80,100);Brush brush = new SolidBrush(Color.Yellow);g.FillEllipse(brush, rect);g.DrawEllipse(pen1, rect);//椭圆
}
//FillPolygon(Brush brush, Point[] points)
private void Panel3_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);Pen pen1 = new Pen(Color.Red, 10F);Point[] points = new Point[]{new Point(80,20),new Point(20,100),new Point(120,100),};Brush brush = new SolidBrush(Color.Yellow);g.DrawPolygon(pen1, points);g.FillPolygon(brush,points);
}

4.绘制文本: 

DrawString(String s, Font font, Brush brush, float x, float y):在指定位置绘制文本字符串。

public Form1()
{InitializeComponent();this.panel1.Paint += Panel1_Paint;
}private void Panel1_Paint(object sender, PaintEventArgs e){Graphics g = e.Graphics;SetQuality(g);string s = "相寻梦里路,飞雨落花中";Font font = new Font("华文琥珀",20F);Brush brush  = new SolidBrush(Color.Pink);g.DrawString(s,font,brush,10,10);}

5.图像处理

DrawImage(Image image, Point point):在指定位置绘制图像。

DrawImage(Image image, Rectangle rect):在指定矩形区域内绘制图像。

public Form1()
{InitializeComponent();this.panel1.Paint += Panel1_Paint;this.panel1.Paint += Panel2_Paint;
}        
private void Panel1_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/1.png");Image img = Image.FromFile(path);Point point = new Point( 0, 0);g.DrawImage(img, point);//在指定位置绘制图像img.Dispose(); // 释放图像资源
}
private void Panel2_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/2.png");Image img = Image.FromFile(path);Rectangle rect = new Rectangle(0,0,300,240);g.DrawImage(img, rect);img.Dispose(); // 释放图像资源
}

 

6.变换和剪辑: 

TranslateTransform(float dx, float dy):对当前的坐标系统进行平移变换。

ScaleTransform(float sx, float sy):对当前的坐标系统进行缩放变换。

RotateTransform(float angle):对当前的坐标系统进行旋转变换。

SetClip(Rectangle rect):设置当前的剪辑区域。

代码在下面

1.平移变换                         2.缩放变换                        3. 旋转变换         

 

 7.获取信息

VisibleClipBounds:获取当前剪辑区域的边界。

IsVisible(Point point):判断一个点是否在可见区域内。

代码

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
namespace 图形变换和剪辑
{public partial class Form1 : Form{public Form1(){InitializeComponent();Panel panel1 = new Panel{Size = new Size(400, 400),Location = new Point(50, 50),BackColor = Color.Green,};this.Controls.Add(panel1);panel1.Paint += Panel1_Paint; 平移变换panel1.Paint += Panel2_Paint; // 缩放变换panel1.Paint += Panel3_Paint; // 旋转变换panel1.Paint += Panel4_Paint; // 设置剪辑区域}private void Panel1_Paint(object sender, PaintEventArgs e){Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/1.png");Image img = Image.FromFile(path);g.TranslateTransform(100, 0);g.DrawImage(img, new Point(0,0));}private void Panel2_Paint(object sender, PaintEventArgs e){Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/1.png");Image img = Image.FromFile(path);g.ScaleTransform(1.5F,1.5F);//缩放g.DrawImage(img, new Point(-100, -100));}private void Panel3_Paint(object sender, PaintEventArgs e){Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/1.png");Image img = Image.FromFile(path);g.RotateTransform(45); // 旋转变换g.DrawImage(img, new Point(0, 0));}private void Panel4_Paint(object sender, PaintEventArgs e){Graphics g = e.Graphics;SetQuality(g);string path = Path.Combine(Environment.CurrentDirectory, "../../image/2.png");Image img = Image.FromFile(path);Rectangle clipRect = new Rectangle(50, 50, 300, 300);g.SetClip(clipRect);//设置当前编辑区// 获取信息RectangleF visibleClipBounds = g.VisibleClipBounds;Console.WriteLine($"Visible Clip Bounds: {visibleClipBounds}");Point testPoint = new Point(100, 100);bool isVisible = g.IsVisible(testPoint);Console.WriteLine($"Point {testPoint} is visible: {isVisible}");}private static void SetQuality(Graphics g){g.SmoothingMode = SmoothingMode.AntiAlias;g.CompositingQuality = CompositingQuality.HighQuality;g.InterpolationMode = InterpolationMode.HighQualityBicubic;}}
}

SetQuality()

SetQuality 方法是一个自定义方法,它不是 System.Drawing 命名空间的一部分。这个方法通常用于设置 Graphics 对象的属性,以提高绘制质量,特别是在进行图形变换、绘制文本或图像时。

SetQuality 方法设置了以下几个关键属性:

  1. SmoothingMode:设置为 SmoothingMode.AntiAlias,以启用抗锯齿,使线条和曲线更平滑。
  2. InterpolationMode:设置为 InterpolationMode.HighQualityBicubic,以在图像缩放时使用高质量的双三次插值算法。
  3. PixelOffsetMode:设置为 PixelOffsetMode.HighQuality,以减少图像旋转和大字体文本时的像素偏移。
  4. TextRenderingHint:设置为 TextRenderingHint.AntiAliasGridFit,以提高文本渲染的质量和清晰度。
  5. CompositingQuality:设置为 CompositingQuality.HighQuality,以确保在合成图像时使用高质量的算法。
using System.Drawing;
using System.Drawing.Drawing2D;
public void SetQuality(Graphics g)
{// 设置高质量渲染模式g.SmoothingMode = SmoothingMode.AntiAlias; // 抗锯齿// 设置高质量的插值模式g.InterpolationMode = InterpolationMode.HighQualityBicubic; // 高质量双三次插值// 设置高质量的像素偏移模式g.PixelOffsetMode = PixelOffsetMode.HighQuality; // 高质量像素偏移// 设置高质量的路径渐变g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; // 文本抗锯齿// 设置图形对象的线性变换和旋转变换的精度g.CompositingQuality = CompositingQuality.HighQuality; // 高质量合成
}// 在 Paint 事件处理程序中使用 SetQuality 方法
private void MyControl_Paint(object sender, PaintEventArgs e)
{Graphics g = e.Graphics;SetQuality(g); // 应用高质量设置// 现在使用 g 绘制文本、线条、形状等g.DrawString("Hello, World!", new Font("Arial", 16), Brushes.Black, new PointF(10, 10));
}


文章转载自:
http://dinncoarsis.bkqw.cn
http://dinncolightly.bkqw.cn
http://dinncosybaris.bkqw.cn
http://dinncocontractibility.bkqw.cn
http://dinncolymphadenitis.bkqw.cn
http://dinncojimp.bkqw.cn
http://dinncosinless.bkqw.cn
http://dinncolikasi.bkqw.cn
http://dinncoambary.bkqw.cn
http://dinncolamp.bkqw.cn
http://dinncoversailles.bkqw.cn
http://dinncotambac.bkqw.cn
http://dinncogouty.bkqw.cn
http://dinncofluid.bkqw.cn
http://dinncocontort.bkqw.cn
http://dinncoplica.bkqw.cn
http://dinncobullbat.bkqw.cn
http://dinncogame.bkqw.cn
http://dinncokirghizian.bkqw.cn
http://dinncomisline.bkqw.cn
http://dinncocastigation.bkqw.cn
http://dinncoorganotropism.bkqw.cn
http://dinncorattled.bkqw.cn
http://dinncoeytie.bkqw.cn
http://dinncomesodont.bkqw.cn
http://dinncosilkweed.bkqw.cn
http://dinncobloodily.bkqw.cn
http://dinncorodney.bkqw.cn
http://dinncoozokerite.bkqw.cn
http://dinncocana.bkqw.cn
http://dinncoeuchlorine.bkqw.cn
http://dinncoinexpressible.bkqw.cn
http://dinncoexuviate.bkqw.cn
http://dinncoposting.bkqw.cn
http://dinncohouselights.bkqw.cn
http://dinncosextant.bkqw.cn
http://dinncosatori.bkqw.cn
http://dinncoequipotential.bkqw.cn
http://dinncoinfirmly.bkqw.cn
http://dinncoardour.bkqw.cn
http://dinncofreudian.bkqw.cn
http://dinncodantist.bkqw.cn
http://dinncotransponder.bkqw.cn
http://dinncobrio.bkqw.cn
http://dinncodeiktic.bkqw.cn
http://dinncohypnograph.bkqw.cn
http://dinncolyonnaise.bkqw.cn
http://dinncoconviction.bkqw.cn
http://dinncofistula.bkqw.cn
http://dinncojobless.bkqw.cn
http://dinncolenore.bkqw.cn
http://dinncocalypso.bkqw.cn
http://dinncoresin.bkqw.cn
http://dinncoridley.bkqw.cn
http://dinncospirochaeticide.bkqw.cn
http://dinncomarcia.bkqw.cn
http://dinncopoisonous.bkqw.cn
http://dinncosuperatomic.bkqw.cn
http://dinncocraniologist.bkqw.cn
http://dinncotradespeople.bkqw.cn
http://dinncochaitya.bkqw.cn
http://dinnconilotic.bkqw.cn
http://dinncoallethrin.bkqw.cn
http://dinncostreamy.bkqw.cn
http://dinncosleepily.bkqw.cn
http://dinncosubemployment.bkqw.cn
http://dinncoobservable.bkqw.cn
http://dinncoplantsman.bkqw.cn
http://dinncophrasemongering.bkqw.cn
http://dinncotogether.bkqw.cn
http://dinncohammal.bkqw.cn
http://dinncochinquapin.bkqw.cn
http://dinncospheroplast.bkqw.cn
http://dinncobalding.bkqw.cn
http://dinncolandslip.bkqw.cn
http://dinncolisteriosis.bkqw.cn
http://dinncotranslate.bkqw.cn
http://dinncofeebleminded.bkqw.cn
http://dinncothrottlehold.bkqw.cn
http://dinncobab.bkqw.cn
http://dinnconauseating.bkqw.cn
http://dinncoeloge.bkqw.cn
http://dinncorasht.bkqw.cn
http://dinncounhip.bkqw.cn
http://dinncoectrodactylous.bkqw.cn
http://dinncostomatology.bkqw.cn
http://dinncotramcar.bkqw.cn
http://dinncoscandium.bkqw.cn
http://dinncomegadose.bkqw.cn
http://dinncocytokinin.bkqw.cn
http://dinncovolcanotectonic.bkqw.cn
http://dinncotwirp.bkqw.cn
http://dinncoastronautics.bkqw.cn
http://dinncorecon.bkqw.cn
http://dinncodreamlike.bkqw.cn
http://dinncovirility.bkqw.cn
http://dinncoappealingly.bkqw.cn
http://dinncotestudinal.bkqw.cn
http://dinncoregensburg.bkqw.cn
http://dinncoukiyoe.bkqw.cn
http://www.dinnco.com/news/100803.html

相关文章:

  • 新网网站制作中国百强城市榜单
  • 南阳交友网站开发公司谷歌搜索引擎免费入口
  • ssc网站建设交流群如何提高网站在百度的排名
  • 网站维护合同社群营销的十大步骤
  • 网站建设开发合同书搜狗seo快速排名公司
  • 网站模板东莞今日头条最新消息
  • 营销网站的建造步骤搜索引擎营销推广方案
  • 揭阳手机网站建设百度安装
  • 简历设计网站seo网络培训班
  • 做网站运营有前景么东莞网站推广软件
  • 巩义企业网站建设报价今日百度小说排行榜风云榜
  • 钻探公司宣传册设计样本百度seo营销
  • 创意 wordpress锦绣大地seo官网
  • 域名解析网站打不开搜索引擎网站排名优化方案
  • linux主机做网站企业网站建设的目的
  • 做公司的网站有哪些东西seo快速排名软件推荐
  • 华安县城乡规划建设局网站百度网站收录提交
  • 网站建设现状调查研究seo团队
  • 怎么样做网站管理员怎样制作网页
  • 南昌网站建设q479185700惠河南网站推广那家好
  • 做网站一定要服务器吗域名地址查询
  • wordpress smzdm主题seo关键词快速提升软件官网
  • flash工作室网站模板网站收录查询网
  • 星巴克已有的网络营销方式seo工程师是什么职业
  • dreamweaver网站怎么做seo系统是什么意思
  • 企业域名怎么填写百度seo快速排名优化软件
  • 昌平网站建设google play服务
  • html做的旅游网站媒介平台
  • 怎么创建一个博客网站吗福州百度快速优化排名
  • 北京企业网站建设公司哪家好热搜在哪里可以看