包含gdi+vb.net的词条
vb.net GDI绘图刷新问题
绘图代码写在Paint事件中,如
创新互联建站主要从事网站建设、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务苏尼特右,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = Me.CreateGraphics
g.DrawLine(Pens.Red, 100, 100, 200, 100)
End Sub
'方法二:在 PictureBox1上显示图像----图画在Bitmap
PictureBox1.Image = Nothing
Dim wid As Integer = PictureBox1.ClientSize.Width
Dim hgt As Integer = PictureBox1.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim g As Graphics = Graphics.FromImage(bm)
'画图代码
'画图代码
PictureBox1.Image = bm
PictureBox1.Refresh()
g.Dispose()
vb.net GDI+
当然是全部重画。
层只不过是制图软件弄出来的一个方便的东西而已。
就像你画画,画上去如果你要擦掉当然是擦到底色咯。(当然GDI+也可以像你画画一样只擦一部分)
GDI+时钟我写过一个VB6的。代码详见我博客。地址显然百度不让贴上= =。所以你可以看下我的资料。
你可以模拟层,就是把所有绘制信息都保存起来。你的流程应当是:
如果要绘制了,更新绘制信息(可以是数组啥的。),交给一个Draw过程
Draw过程:根据绘制信息,全部绘制。
By vIstaswx ,before junior school graduation exam.
VB.NET怎么应用GDI画串口通讯数据的实时曲线
拖一个PictureBox1控件
创建一个Paint事件。在事件中加入
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints)
End Sub
得到数据后,改point的数据。然后PictureBox1.Refresh()就行了
vb.net中使用GDI画图,然后平移,可是平移之前的图还在,怎么去掉平移之前的,保留平移之后的?
如果是简单的移动,先把图形绘制到大小和PictureBox的Bitmap上,然后再绘制到PictureBox就行。
不过在VB.NET中用GDI绘制最好用BufferedGraphics图形缓冲区,速度马马虎虎(VB就这样了),但是不闪烁,不存在背景擦除的问题。
当前名称:包含gdi+vb.net的词条
文章源于:http://azwzsj.com/article/dsiijhh.html