成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

用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è)夢(mèng)想脫穎而出為使命,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。

說(shuō)明:

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),邊長(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)切橢圓。

在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愛心特效教程
文章出自:http://jinyejixie.com/article6/dosgdig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、關(guān)鍵詞優(yōu)化、全網(wǎng)營(yíng)銷推廣、網(wǎng)站設(shè)計(jì)公司網(wǎng)站策劃、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
大英县| 会同县| 勃利县| 乐亭县| 邹平县| 特克斯县| 云安县| 白河县| 天水市| 海城市| 酒泉市| 济南市| 石景山区| 中江县| 通榆县| 陆川县| 葵青区| 汶上县| 喜德县| 彩票| 泉州市| 镇远县| 赞皇县| 邹城市| 改则县| 玛多县| 迁安市| 黔东| 乌拉特后旗| 阳原县| 灵石县| 苏州市| 九江县| 广水市| 宁安市| 大城县| 晋宁县| 龙川县| 岳阳县| 阿拉善盟| 义马市|