网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

vb.net绘制二的简单介绍

VB.net绘图具体如何设置双缓冲

VB.NET画图是不能设置双缓冲的,双缓冲是指窗体,从来没说是针对控件。

创新互联是一家专业提供沙县企业网站建设,专注与成都网站设计、做网站、H5页面制作、小程序制作等业务。10年已为沙县众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。

不用graphic.clear清理重画就不会闪烁。你可以先把容器删了再重新建立一个再去画。

简单举例:

Graphics g;

Pen p;

Panel pl;

构造函数初始化:

p=new Pen(Color.Red,2);

pl=panel1;

造成闪烁的画法:

g=pl.CreateGraphics();

g.Clear(SystemColor.ButtonFace);

//.....画新的

不会闪烁的办法:

this.Controls.ReMoveAt(panel1);

pl=new Panel();

pl.Name="panel1";

//....创建容器控件

this.Controls.Add(pl);

//继续画

vb.net绘图问题

代码:

Public Class Form1

'*********************************************************************   

'作者:章鱼哥,QQ:3107073263 群:309816713       

'如有疑问或好的建议请联系我,大家一起进步     

'*********************************************************************     

'绘制圆角矩形函数

Private Function GetRoundedRectPath(ByVal rect As Rectangle, ByVal radius As Integer) As System.Drawing.Drawing2D.GraphicsPath

rect.Offset(-1, -1)

Dim RoundRect As New Rectangle(rect.Location, New Size(radius - 1, radius - 1))

Dim path As New System.Drawing.Drawing2D.GraphicsPath

path.AddArc(RoundRect, 180, 90)     '左上角

RoundRect.X = rect.Right - radius   '右上角

path.AddArc(RoundRect, 270, 90)

RoundRect.Y = rect.Bottom - radius  '右下角

path.AddArc(RoundRect, 0, 90)

RoundRect.X = rect.Left             '左下角

path.AddArc(RoundRect, 90, 90)

path.CloseFigure()

Return path

End Function

'绘制矩形

Private Sub DrawingRect()

Dim g As Graphics = Me.CreateGraphics

Dim Pen As New Pen(Brushes.DarkRed, 2)

Dim Hei As Integer = Me.Height

Dim Wid As Integer = Me.Width

'矩形的位置和长宽随着窗体的变化而改变

Dim Rec As New Rectangle(Int(Wid / 5), Int(Hei / 5), Int(Wid / 2), Int(Hei / 2))

'  g.DrawRectangle(Pen, Rec)

'清楚现有的矩形

g.Clear(Me.BackColor)

g.DrawPath(Pen, GetRoundedRectPath(Rec, 30))

End Sub

Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

DrawingRect()

End Sub

Private Sub Form1_SizeChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged

Me.Invalidate() '此函数可引发Paint事件

End Sub

End Class

效果截图:

原窗口:

缩小后:

VB.net中如何画图?

VB.net与VB不同。

VB.net已经有专门绘图的类。

可以定义笔刷然后用Drawing类中的方法绘制。

Private Sub DrawEllipse()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawEllipse(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub

Private Sub DrawRectangle()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawRectangle(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub


网站名称:vb.net绘制二的简单介绍
网页URL:http://bjjierui.cn/article/phijcc.html

其他资讯