vb画爱心程序代码(vbs爱心程序代码)
用VB程序怎么做一个心型图?
Dim X1, Y1, X2, Y2 As Integer\x0d\x0aDim I As Integer\x0d\x0aDim J As Boolean\x0d\x0aDim K As IntegerDim WithEvents Label1 As Label\x0d\x0aDim WithEvents Timer1 As TimerPrivate Sub Form_Activate()\x0d\x0a I = 100\x0d\x0a K = 100\x0d\x0a X1 = Me.Width / 2\x0d\x0a Y1 = Me.Height / 3\x0d\x0a X2 = X1\x0d\x0a Y2 = Y1\x0d\x0aLabel1.Top = Me.Height / 2 - Label1.Height / 2\x0d\x0a Label1.Left = Me.Width / 2 - Label1.Width / 2\x0d\x0aEnd SubPrivate Sub Form_Load() Me.BackColor = H0\x0d\x0a Me.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)\x0d\x0a Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)\x0d\x0a Me.DrawMode = 13\x0d\x0a Me.DrawWidth = 2\x0d\x0a Me.FillStyle = 7\x0d\x0aSet Label1 = Me.Controls.Add("VB.Label", "Label1")\x0d\x0a Set Timer1 = Me.Controls.Add("VB.Timer", "Timer1")\x0d\x0aLabel1.Visible = True\x0d\x0a Label1.AutoSize = True\x0d\x0a Label1.BackStyle = 0\x0d\x0a Label1.Caption = "I LOVE YOU"\x0d\x0a Label1.Font.Size = 60\x0d\x0a Label1.ForeColor = HFF00\x0d\x0a Timer1.Enabled = True\x0d\x0a Timer1.Interval = 10\x0d\x0a Me.WindowState = 2\x0d\x0aEnd SubPrivate Sub Timer1_Timer()\x0d\x0a Me.Circle (X1, Y1), 250\x0d\x0a Me.Circle (X2, Y2), 250\x0d\x0a \x0d\x0a If Y1 = Me.Height / 3 Then\x0d\x0a K = K - 5\x0d\x0a End If\x0d\x0a Else\x0d\x0a I = 100\x0d\x0a K = 100\x0d\x0a X1 = Me.Width / 2\x0d\x0a Y1 = Me.Height / 3\x0d\x0a X2 = X1\x0d\x0a Y2 = Y1\x0d\x0a \x0d\x0a Me.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)\x0d\x0a Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) End If\x0d\x0a \x0d\x0a Me.DrawWidth = 3\x0d\x0a \x0d\x0a Me.PSet (Rnd * Me.Width, Rnd * Me.Height), RGB(Rnd * 225, Rnd * 225, Rnd * 225)\x0d\x0a Me.DrawWidth = 2\x0d\x0aEnd SubPrivate Sub Form_Click()\x0d\x0a End\x0d\x0aEnd SubPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)\x0d\x0a End\x0d\x0aEnd Sub
VB 怎么弄成心形
'你们的太难看了,看我的画图法
'把下面的代码放在窗体里,运行,单击窗体看看
Private Sub Form_Click()
ScaleMode = vbPixels
Circle (20, 20), 10, , 0, 3.2
Circle (40, 20), 10, , 0, 3.2
Line (10, 20)-(30, 50)
Line (50, 20)-(30, 50)
PSet (30, 50)
End Sub
VB绘心形图源代码
放入一个按钮复制下面代码即可
Private Sub Command1_Click()
Print "/\/\"
Print "\ /"
Print " \/"
End Sub
VB编写爱心形状的窗体
你的描述我不是很明白,可以给你个思路!首先找个爱心形状的图片,加载进窗体的picturebox中,调整到合适大小。然后用以下让窗体透明。'设置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