真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

用vbnet畫愛心 vbs愛心特效教程

用VB程序怎么做一個(gè)心型圖?

Dim X1, Y1, X2, Y2 As Integer

創(chuàng)新互聯(lián)自2013年起,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢想脫穎而出為使命,1280元奉節(jié)做網(wǎng)站,已為上家服務(wù),為奉節(jié)各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:13518219792

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

如何用VB.NET畫同心圓

窗體上添加一個(gè)按鈕,在該按鈕的單擊事件里編寫代碼如下:

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

‘用黑色畫筆繪制一組同心圓,半徑從5開始,增量為5。

說明:

DrawEllipse是VB.Net的Graphics類的繪制橢圓的方法;他有幾種格式,上面使用的是一種;

DrawEllipse(畫筆的顏色,繪制橢圓所需要的矩形區(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),邊長為50的正方形里繪制內(nèi)切圓。理解了是在正方形里繪制內(nèi)切圓,就可以通過數(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),長軸為100,短軸為50的內(nèi)切橢圓。

在VB.Net中如何畫實(shí)心的圓

在PictureBox1上畫紅色的實(shí)心圓:

Private Sub DrawCircle(ByVal cp As Point, ByVal radius As Integer, ByVal color As Brush)

Dim gr As Graphics

gr = PictureBox1.CreateGraphics

Dim rect As Rectangle = New Rectangle(cp.X - radius, cp.Y - radius, 2 * radius, 2 * radius)

gr.DrawEllipse(Pens.Black, rect)

gr.FillEllipse(color, rect)

End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

DrawCircle(New Point(120, 100), 80, Brushes.Red)

End Sub

VB編寫愛心形狀的窗體

你的描述我不是很明白,可以給你個(gè)思路!首先找個(gè)愛心形狀的圖片,加載進(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


分享文章:用vbnet畫愛心 vbs愛心特效教程
網(wǎng)站地址:http://weahome.cn/article/dosgdig.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部