大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
如果是简单的移动,先把图形绘制到大小和PictureBox的Bitmap上,然后再绘制到PictureBox就行。
十多年的宁乡网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整宁乡建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“宁乡网站设计”,“宁乡网站推广”以来,每个客户项目都认真落实执行。
不过在VB.NET中用GDI绘制最好用BufferedGraphics图形缓冲区,速度马马虎虎(VB就这样了),但是不闪烁,不存在背景擦除的问题。
GDI绘图用字体必须安装才能使用
在客户机部署应用程序时,安装该字体就行
绘图代码写在Paint事件中,如
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()
123456789101112Dim picX, picY, x1, y1, x2, y2, a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aX, a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aYpicX = 0 '要转换的Picture1坐标XpicY = 0 '要转换的Picture1坐标Yx1 = Picture1.ScaleLefty1 = Picture1.ScaleTopx2 = Picture1.ScaleLeft + Picture1.ScaleWidthy2 = Picture1.ScaleTop + Picture1.ScaleHeight '记录原先的坐标系统Picture1.ScaleMode = 3 '坐标系统设为像素a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aX = Round((picX - x1) / (x2 - x1) * Picture1.ScaleWidth)gdiY = Round((picY - y1) / (y2 - y1) * Picture1.ScaleHeight)MsgBox "Picture1的坐标(" picX "," picY ")转为GDI坐标是(" gdiX "," gdiY ")"Picture1.Scale (x1, y1)-(x2, y2) '改回原先的坐标系统