'添加模塊一個模塊聲明如下APIPublic Declare Function GdiTransparentBlt Lib "gdi32" (ByVal hdc1 As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal W1 As Long, ByVal H1 As Long, ByVal Hdc2 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal W2 As Long, ByVal H2 As Long, ByVal Color As Long) As Long'hdc1 要繪圖目標(biāo)句柄'x1圖片顯示的橫坐標(biāo)位置'y1圖片顯示的縱坐標(biāo)位置'w1圖片縮放比例寬度'h1圖片縮放比例高度'hdc2要繪制透明色的圖片或控件(這里指picture)'x2一般這里填0(圖片左上角起始坐標(biāo))'y2一般這里填0(圖片左上角起始坐標(biāo))'w2圖片寬度'h2圖片高度'color繪制顏色(RGB(255,255,255)為透明色)'picture控件屬性設(shè)置成visible=falseautosize=trueautoredraw=trueborderstyle=0窗體autoredraw=true簡單例子Private Sub Form_Load()GdiTransparentBlt form1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, form1.picture1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, RGB(255, 255, 255) '畫圖End Sub
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、淶水ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的淶水網(wǎng)站制作公司
微軟上有Microsoft Chart控件的示例程序,非常詳細(xì),一看就會。
但我微軟站上的剛沒找到,這里找到一個
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim g As Graphics = PictureBox1.CreateGraphics
Dim hs As HatchStyle = HatchStyle.Cross
Dim sb As HatchBrush = New HatchBrush(hs, Color.Black, Color.White)
Dim p(3) As Point
p(0).X = 100
p(0).Y = 50
p(1).X = 0
p(1).Y = 100
p(2).X = 200
p(2).Y = 100
p(3).X = 100
p(3).Y = 50
g.FillPolygon(sb, p)
g.DrawPolygon(Pens.Black, p)
End Sub
End Class
記得VB6當(dāng)中有Shape控件,但是VB.net里這個控件不存在了。
提個思路:使用Picture控件或Label控件,通過代碼在控件里繪圖想要的圖形,可以試試。