放入一個(gè)按鈕復(fù)制下面代碼即可
創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括息縣網(wǎng)站建設(shè)、息縣網(wǎng)站制作、息縣網(wǎng)頁(yè)制作以及息縣網(wǎng)絡(luò)營(yíng)銷(xiāo)策劃等。多年來(lái),我們專(zhuān)注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,息縣網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到息縣省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
Private Sub Command1_Click()
Print "/\/\"
Print "\ /"
Print " \/"
End Sub
Dim X1, Y1, X2, Y2 As Integer
Dim I As Integer
Dim J As Boolean
Dim K As IntegerDim WithEvents Label1 As Label
Dim WithEvents Timer1 As TimerPrivate Sub Form_Activate()
I = 100
K = 100
X1 = Me.Width / 2
Y1 = Me.Height / 3
X2 = X1
Y2 = Y1
Label1.Top = Me.Height / 2 - Label1.Height / 2
Label1.Left = Me.Width / 2 - Label1.Width / 2
End SubPrivate Sub Form_Load() Me.BackColor = H0
Me.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Me.DrawMode = 13
Me.DrawWidth = 2
Me.FillStyle = 7
Set Label1 = Me.Controls.Add("VB.Label", "Label1")
Set Timer1 = Me.Controls.Add("VB.Timer", "Timer1")
Label1.Visible = True
Label1.AutoSize = True
Label1.BackStyle = 0
Label1.Caption = "I LOVE YOU"
Label1.Font.Size = 60
Label1.ForeColor = HFF00
Timer1.Enabled = True
Timer1.Interval = 10
Me.WindowState = 2
End SubPrivate Sub Timer1_Timer()
Me.Circle (X1, Y1), 250
Me.Circle (X2, Y2), 250
If Y1 = Me.Height - 1200 Then
X1 = X1 + K
Y1 = Y1 - I
X2 = X2 - K
Y2 = Y2 - I
I = I - 2
If Y1 = Me.Height / 3 Then
K = K - 1
ElseIf Y1 = Me.Height / 3 Then
K = K - 5
End If
Else
I = 100
K = 100
X1 = Me.Width / 2
Y1 = Me.Height / 3
X2 = X1
Y2 = Y1
Me.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) End If
Me.DrawWidth = 3
Me.PSet (Rnd * Me.Width, Rnd * Me.Height), RGB(Rnd * 225, Rnd * 225, Rnd * 225)
Me.DrawWidth = 2
End SubPrivate Sub Form_Click()
End
End SubPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
End
End Sub
窗體上添加一個(gè)按鈕,在該按鈕的單擊事件里編寫(xiě)代碼如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'聲明窗體的Me.CreateGraphics對(duì)象
Dim MyGraphics As Graphics = Me.CreateGraphics
Dim Cx As Integer = 150 '圓心的X坐標(biāo)
Dim Cy As Integer = 150 '圓心的Y坐標(biāo)
Dim R As Integer '圓的半徑
'繪制半徑為R的圓
For R = 5 To 100 Step 5
MyGraphics.DrawEllipse(Pens.Black, New Rectangle(Cx - R, Cy - R, 2 * R, 2 * R))
Next
End Sub
‘用黑色畫(huà)筆繪制一組同心圓,半徑從5開(kāi)始,增量為5。
說(shuō)明:
DrawEllipse是VB.Net的Graphics類(lèi)的繪制橢圓的方法;他有幾種格式,上面使用的是一種;
DrawEllipse(畫(huà)筆的顏色,繪制橢圓所需要的矩形區(qū)域)
其中:繪制橢圓所需要的矩形區(qū)域,如果被定義為正方形,就演變成繪制圓,定義該區(qū)域由死個(gè)數(shù)值確定,第1個(gè)數(shù)值,確定該區(qū)域左上角的X坐標(biāo),第2個(gè)數(shù)值,確定該區(qū)域左上角的Y坐標(biāo),第3個(gè)數(shù)值,確定該區(qū)域的寬度,第4個(gè)數(shù)值,確定該區(qū)域的高度。
例如1:
DrawEllipse(Pens.Black, New Rectangle(150, 150, 50, 50))
就是以圓心坐標(biāo)為(100,100),繪制半徑為50 的圓。其實(shí)在VB.NET中,是告訴系統(tǒng)在以左上角坐標(biāo)(150,150),邊長(zhǎng)為50的正方形里繪制內(nèi)切圓。理解了是在正方形里繪制內(nèi)切圓,就可以通過(guò)數(shù)學(xué)計(jì)算,知道如何繪制了。
同理例如2:
DrawEllipse(Pens.Black, New Rectangle(150, 150, 100, 50))
就是以圓心坐標(biāo)為(100,100),繪制半徑為50 的圓。其實(shí)在VB.NET中,是告訴系統(tǒng)在以左上角坐標(biāo)(150,150),長(zhǎng)軸為100,短軸為50的內(nèi)切橢圓。
你的描述我不是很明白,可以給你個(gè)思路!首先找個(gè)愛(ài)心形狀的圖片,加載進(jìn)窗體的picturebox中,調(diào)整到合適大小。然后用以下讓窗體透明。'設(shè)置Me.BorderStyle = 0
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const WS_EX_LAYERED = H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = H2
Private Const LWA_COLORKEY = H1
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = HA1
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Me.BackColor = HFF0000
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, HFF0000, 0, LWA_COLORKEY
End Sub