[HỎI] tạo được 1 control (cmdButton, Image ...) có hình tròn, lục lăng...& di chuyển (1 người xem)

  • Thread starter Thread starter campha
  • Ngày gửi Ngày gửi
Liên hệ QC

Người dùng đang xem chủ đề này

campha

Thành viên mới
Tham gia
4/5/13
Bài viết
29
Được thích
7
Mình có đoạn code VB6 lấy từ trên mạng. Mình muốn ứng dụng vào UserForm VBA nhưng ko chạy được file đính kèm nhờ các bạn xem giúp
PHP:
' Code trong Form
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
 
Private Sub ChangeShape(po_Control As Object)
    Dim ll_Width As Long
    Dim ll_Height As Long
    Dim ll_Left As Long
    Dim ll_Top As Long
    Dim ll_Region As Long
   
    With po_Control
        ll_Width = .Width / Screen.TwipsPerPixelX
        ll_Height = .Height / Screen.TwipsPerPixelY
    End With
       
    ll_Region = CreateEllipticRgn(0, 0, ll_Width, ll_Height)
    Call SetWindowRgn(po_Control.hWnd, ll_Region, True)
End Sub
 
Private Sub Form_Load()
    ChangeShape Command1
End Sub
(Những thắc mắc khác từ từ hỏi tiếp). Tks
 

File đính kèm

Lần chỉnh sửa cuối:
Xin phép Mod cho giữ 1 bài để post code bài trả lời cho dễ tham khao
 
Upvote 0
Mình có đoạn code VB6 lấy từ trên mạng. Mình muốn ứng dụng vào UserForm VBA nhưng ko chạy được file đính kèm nhờ các bạn xem giúp
Form hình Elip:
Mã:
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub UserForm_Initialize()
  Dim elp As Long, hWnd As Long
  hWnd = FindWindow("ThunderDFrame", Me.Caption)
  elp = CreateEllipticRgn(0, 0, 300, 250)
  SetWindowRgn hWnd, elp, True
End Sub
 
Upvote 0
Cảm ơn thầy đã cho 1 ví dụ minh họa, nhưng tôi muốn tạo hình cho các control khác không phải UserForm: Ví dụ: CommandButton, hay Image hình lục lăng, tròn, elip ...
Tôi muốn nhờ mọi người chỉ dẫn thêm về UserForm & các hàm API

Nói rõ hơn:
có thể tạo được 1 ứng dụng như game SUPER 7: http://www.youtube.com/watch?v=Ws6oAn2lAtc
[video]http://youtube.com/watch?v=Ws6oAn2lAtc[/video]
1) Tạo UserForm - size: 1200 * 900 sau đó CODE là các nội dung khác
2) Tạo ngẫu nhiên các control hình lục lăng (better) hoặc tròn xuất hiện tại các cạnh của UserForm. Nếu lấy điểm cạnh dưới bên trái của userform là gốc tọa độ thì các control có thể xuất hiện khoảng 1 giây tại các vị trí:
+ (0,300) (0,600) => trôi sang phải
+ (900, 300) (900,600) => trôi sang trái
+ (400, 0) (800, 0) => trôi lên trên
+ (400, 900) (800, 900) => trôi xuống dưới
3) Mỗi control có 1 giá trị mặc định (default value)
+ nằm trong khoảng từ (-6 , 6)
+ hoặc dấu âm "-" (đổi dấu giá trị control)
+ hoặc "super" ("va chạm" control khác là thỏa điều kiện = 7 => biến mất & tính điểm)
và có màu sắc riêng, kích thước riêng (giá trị bé <=> đường kính bé); giá trị dương thì không trong suốt, giá trị âm thì trong suốt (cùng kích thước với giá trị dương nếu trái dấu)
4) Số control ban đầu xuất hiện, sau đó tần suất xuất hiện có thể phụ thuộc vào thời gian, số điểm mà người chơi đạt được (=> phải có quy tắc tính điểm)
5) Khi 1 control đang di chuyển có thể vẽ đường (có giới hạn nào đó) cho control đó chạy theo để "va chạm" với control khác để đạt giá trị tới 7 mong muốn (TỔNG GIÁ TRỊ CÁC CONTROL PHẢI >= -6 & <= 7 thì mới không the end)
...

Nói chung có rất nhiều việc phải suy nghĩ! Mong thầy và các bạn cho ý kiến có thể triển khai được không?
 
Lần chỉnh sửa cuối:
Upvote 0

Nói rõ hơn:
có thể tạo được 1 ứng dụng như game SUPER 7: http://www.youtube.com/watch?v=Ws6oAn2lAtc
[video]http://youtube.com/watch?v=Ws6oAn2lAtc[/video]

Nói chung có rất nhiều việc phải suy nghĩ! Mong thầy và các bạn cho ý kiến có thể triển khai được không?
Có 1 số thủ thuật trên VB6 sưu tầm (caulacbovb) bạn có thể thử:
PHP:
Thủ thuật : Thêm Control và Form trong lúc thực thi 
Thiết kế : 2 CommandButton
Code :
‘ > Trong Form
Option Explicit

Dim WithEvents My_button As CommandButton

Private Sub Command1_Click()
    Set My_button = Form1.Controls.Add("VB.CommandButton", "MyButton1")
    My_button.Visible = True
    My_button.Caption = My_button.Name
End Sub

Private Sub Command2_Click()
    Form1.Controls.Remove My_button
    Set My_button = Nothing
End Sub

Private Sub My_button_Click()
    MsgBox "Have I been born ?" & vbCrLf & "my name is " & My_button.Name
End Sub
PHP:
Thủ thuật : Shape di chuyển như quả banh
Ghi chú : 
Thiết kế : 1 Timer, 1 CommandButton, 2 Shape: Shape1 và Shape2.
Code :
‘ > Trong Form
Dim direct1, direct2, left1, top1, step1h, step1v
Dim direct3, direct4, left2, top2, step2h, step2v

Private Sub Command1_Click()
    If Command1.Caption = "Move" Then
        Command1.Caption = "Stop"
    Else
        Command1.Caption = "Move"
    End If
End Sub

Private Sub Form_Load()
    Shape1.Shape = 3
    Shape2.Shape = 3
    Command1.Caption = "Move"
    Timer1.Interval = 1
    Randomize
    direct1 = -1
    direct2 = 1
    left1 = Shape1.Left
    top1 = Shape1.Top
    step1h = Int(10 * Rnd) + 25
    step1v = Int(10 * Rnd) + 25
    direct3 = 1
    direct4 = -1
    left2 = Shape2.Left
    top2 = Shape2.Top
    step2h = Int(20 * Rnd) + 25
    step2v = Int(20 * Rnd) + 25
End Sub

Private Sub Timer1_Timer()
If Command1.Caption = "Stop" Then
    If (Shape1.Top < 0) Or (Shape1.Top > Form1.ScaleHeight - Shape1.Height) Then direct2 = -direct2
    If (Shape1.Left < 0) Or (Shape1.Left > Form1.ScaleWidth - Shape1.Width) Then direct1 = -direct1
    left1 = left1 + step1h * direct1
    top1 = top1 + step1v * direct2
    Shape1.Move left1, top1
    If (Shape2.Top < 0) Or (Shape2.Top > Form1.ScaleHeight - Shape2.Height) Then direct4 = -direct4
    If (Shape2.Left < 0) Or (Shape2.Left > Form1.ScaleWidth - Shape2.Width) Then direct3 = -direct3
    left2 = left2 + step2h * direct3
    top2 = top2 + step2v * direct4
    Shape2.Move left2, top2
End If
End Sub
PHP:
Thủ thuật : Di chuyển Control trong lúc thực thi 1
Ghi chú : Có thể áp dụng cho các Control khác
Thiết kế : 1 PictureBox
Code :
‘ > Trong Form
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
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2

Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Print "Click here to move me!"
Me.AutoRedraw = True
Me.Print "Click here to move me!"
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Picture1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End Sub



Thủ thuật : Di chuyển Control trong lúc thực thi2
Ghi chú : 
Thiết kế : 1 CommandButton, 1 Image, 1 Label, 1 ListBox, 1 TextBox để Test
Code :
‘ > Trong Form
Private Type POINTAPI 'Khai báo biến cho con trỏ
        X As Long
        Y As Long
End Type

'Khai hàm API nhân toa Ðô con tro
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

'Viêt môt hàm chung cho các controls
Private Function MV(Button As Integer, FRM As Form, CTL As Control)
If Button Then 'Nêu button còn nhấn thì
Dim ViTri As POINTAPI
GetCursorPos ViTri
CTL.Top = (ViTri.Y * Screen.TwipsPerPixelY - FRM.Top - 500)
CTL.Left = (ViTri.X * Screen.TwipsPerPixelX - FRM.Left - 900)
End If
End Function

'Di chuuyển CommandButton, Image, Label, ListBox, TextBox
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MV Button, Form1, Command1
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MV Button, Form1, Image1
End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MV Button, Form1, Label1
End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MV Button, Form1, List1
End Sub

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MV Button, Form1, Text1
End Sub
PHP:
Thủ thuật : Resize Control trong lúc thực thi
Ghi chú : Thủ thuật này trình bày cách sử dụng các hàm API GetWindowLong, SetWindowLong, SetWindowPos để tạo một TextBox sao cho user có thể thay đổi kích thước của nó lúc thực thi. Kỹ thuật này cũng có thể được áp dụng cho hầu hết VB Control khác nhau như ListBox, ListView, TreeView, PictureBox...
Thiết kế : 1 TextBox, 2 CommandButton và 2 Label
Code :
‘ > Trong Module
Option Explicit

Public Const SWP_DRAWFRAME As Long = &H20
Public Const SWP_NOMOVE As Long = &H2
Public Const SWP_NOSIZE As Long = &H1
Public Const SWP_NOZORDER As Long = &H4
Public Const SWP_FLAGS As Long = SWP_NOZORDER Or SWP_NOSIZE Or _
                                 SWP_NOMOVE Or SWP_DRAWFRAME
Public Const GWL_STYLE As Long = (-16)
Public Const WS_THICKFRAME As Long = &H40000

Public Declare Function GetWindowLong Lib "user32" _
     Alias "GetWindowLongA" _
    (ByVal hwnd As Long, _
     ByVal nIndex As Long) As Long

Public Declare Function SetWindowLong Lib "user32" _
     Alias "SetWindowLongA" _
    (ByVal hwnd As Long, _
     ByVal nIndex As Long, _
     ByVal dwNewLong As Long) As Long

Public 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
 
‘ > Trong Form
Option Explicit

Dim initBoxStyle As Long
Dim initLeft As Integer
Dim initTop As Integer
Dim initWidth As Integer
Dim initHeight As Integer

Private Sub Command2_Click()
   SetControlStyle initBoxStyle, Text1
End Sub

Private Sub Form_Load()
   initBoxStyle = GetWindowLong(Text1.hwnd, GWL_STYLE)
   initLeft = Text1.Left
   initTop = Text1.Top
   initWidth = Text1.Width
   initHeight = Text1.Height

   SetControlStyle initBoxStyle, Text1

   Label1.Caption = "Text Width : " & Text1.Width
   Label2.Caption = "Text Height: " & Text1.Height
   Command1.Caption = "Resize"
   Command2.Caption = "Restore"
End Sub

Private Sub Form_Unload(Cancel As Integer)
   SetControlStyle initBoxStyle, Text1
End Sub

Private Sub Form_Click()
   SetControlStyle initBoxStyle, Text1

   Label1.Caption = "Text Width : " & Text1.Width
   Label2.Caption = "Text Height: " & Text1.Height
End Sub

Private Sub Command1_Click()

   Dim style As Long

   style = GetWindowLong(Text1.hwnd, GWL_STYLE)

   style = style Or WS_THICKFRAME

   SetControlStyle style, Text1

End Sub

Private Sub SetControlStyle(style, X As Control)
   If style Then
       Call SetWindowLong(X.hwnd, GWL_STYLE, style)
       Call SetWindowPos(X.hwnd, Form1.hwnd, 0, 0, 0, 0,  SWP_FLAGS)
  End If
End Sub
 
Upvote 0
Cảm ơn thầy đã cho 1 ví dụ minh họa, nhưng tôi muốn tạo hình cho các control khác không phải UserForm: Ví dụ: CommandButton, hay Image hình lục lăng, tròn, elip ...
Tôi muốn nhờ mọi người chỉ dẫn thêm về UserForm & các hàm API


Tôi không đọc.

1) Tạo UserForm - size: 1200 * 900 sau đó CODE là các nội dung khác
2) Tạo ngẫu nhiên các control hình lục lăng (better) hoặc tròn xuất hiện tại các cạnh của UserForm. Nếu lấy điểm cạnh dưới bên trái của userform là gốc tọa độ thì các control có thể xuất hiện khoảng 1 giây tại các vị trí:

Trong Windows trên Desktop thì gốc tọa độ là góc trái bên trên. Trong Form thì cũng là góc trái bên trên của client area. Và trục y luôn hướng xuống dưới.
Ngay cả trong Excel Left (tới trục y) cũng tính từ gờ trái của cửa sổ, và Top (tới trục x) tính từ gờ trên, tức trục y hướng xuống dưới. Đơn giản vì trong Windows nó là vậy.

+ (0,300) (0,600) => trôi sang phải
+ (900, 300) (900,600) => trôi sang trái
+ (400, 0) (800, 0) => trôi lên trên
+ (400, 900) (800, 900) => trôi xuống dưới
3) Mỗi control có 1 giá trị mặc định (default value)
+ nằm trong khoảng từ (-6 , 6)
+ hoặc dấu âm "-" (đổi dấu giá trị control)
+ hoặc "super" ("va chạm" control khác là thỏa điều kiện = 7 => biến mất & tính điểm)
và có màu sắc riêng, kích thước riêng (giá trị bé <=> đường kính bé); giá trị dương thì không trong suốt, giá trị âm thì trong suốt (cùng kích thước với giá trị dương nếu trái dấu)
4) Số control ban đầu xuất hiện, sau đó tần suất xuất hiện có thể phụ thuộc vào thời gian, số điểm mà người chơi đạt được (=> phải có quy tắc tính điểm)
5) Khi 1 control đang di chuyển có thể vẽ đường (có giới hạn nào đó) cho control đó chạy theo để "va chạm" với control khác để đạt giá trị tới 7 mong muốn (TỔNG GIÁ TRỊ CÁC CONTROL PHẢI >= -6 & <= 7 thì mới không the end)

Những cái gì thuộc tư duy thì bạn tự cố gắng nhé. Không ai có nhiều thời gian để làm hoàn chỉnh cho bạn một trò chơi đâu.

Tôi sẽ chỉ hướng dẫn bạn cách tạo region, thiết lập region đó cho cửa sổ (các controls của Windows đều là window). Và cách xác định "đụng chạm.

Nếu bạn muốn dùng VB thì:

1. Muốn tạo các region có hình thù khác nhau thì tìm đọc về
Mã:
CombineRgn
CreateEllipticRgn
CreateEllipticRgnIndirect
CreatePolygonRgn
CreatePolyPolygonRgn
CreateRectRgn
CreateRectRgnIndirect
CreateRoundRectRgn
EqualRgn
ExtCreateRegion
FillRgn
FrameRgn
GetPolyFillMode
GetRegionData
GetRgnBox
InvertRgn
OffsetRgn
PaintRgn
PtInRegion
RectInRegion
SetPolyFillMode 
...

2. Hàm SetWindowRgn
Thông số thứ hai là region, thông số thứ nhất là handle của window mà ta muốn thiết lập region.
vd.
Mã:
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Command1_Click()
Dim rgn As Long
    rgn = CreateEllipticRgn(0, 0, Me.ScaleWidth, Me.ScaleHeight)
    SetWindowRgn Me.hWnd, rgn, True
    
    rgn = CreateEllipticRgn(0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight)
    SetWindowRgn Picture1.hWnd, rgn, True
    
    rgn = CreateEllipticRgn(0, 0, Command2.Width, Command2.Height)
    SetWindowRgn Command2.hWnd, rgn, True
End Sub

3. Di chuyển controls, Form. Chẳng qua là thay đổi Left, Top của controls, Form

4. Phát hiện đụng chạm. Ta xét xem 2 region có chạm vào nhau không bằng cách xem chúng có phần chung hay không. Để làm việc này tôi chọn hàm CombineRgn với tham số cuối là RGN_AND.

Module1
Mã:
Public Const RGN_AND As Long = 1
Public Const RGN_COPY As Long = 5
Public Const RGN_DIFF As Long = 4
Public Const RGN_OR As Long = 2
Public Const RGN_XOR As Long = 3
Public Const NULLREGION As Long = 1

Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Public Declare Function OffsetRgn Lib "gdi32.dll" (ByVal hRgn As Long, ByVal x As Long, ByVal y As Long) As Long
Public Declare Function GetWindowRgn Lib "user32.dll" (ByVal hWnd As Long, ByVal hRgn As Long) As Long

Public Declare Function CombineRgn Lib "gdi32.dll" (ByVal hDestRgn As Long, _
    ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
'    ham CombineRgn "tao" region tu 2 region cho truoc va ket qua tra ve trong hDestRgn.
'    Cach tao hDestRgn tu hSrcRgn1 va hSrcRgn2 duoc xac dinh boi nCombineMode.
'    nCombineMode lay cac gia tri RGN_*** nhu duoi day va xac dinh cach tao hDestRgn nhu
'    giai thich bang tieng Anh:
'    RGN_AND    Creates the intersection of the two combined regions.
'    RGN_COPY   Creates a copy of the region identified by hrgnSrc1.
'    RGN_DIFF   Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
'    RGN_OR     Creates the union of two combined regions.
'    RGN_XOR    Creates the union of two combined regions except for any overlapping areas.

Form1
Mã:
Dim deltapx As Long, deltapy As Long, deltacx As Long, deltacy As Long

Private Sub Form_Load()
Dim h1 As Long, h2 As Long
    h1 = CreateEllipticRgn(0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight)
    h2 = CreateEllipticRgn(0, 0, Command2.Width, Command2.Height)
    
    SetWindowRgn Picture1.hWnd, h1, True
    SetWindowRgn Command2.hWnd, h2, True
'    sau khi dung SetWindowRgn thi khong the truy cap vao h1 va h2, tuc region "cua" Picture1 va
'    Command2, nen ta tao region mot lan nua va nho vao Picture1.Tag va Command2.Tag de dung ve sau
'    cho viec kiem tra chung co "cham nhau" khong
    Picture1.Tag = CreateEllipticRgn(0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight)
    Command2.Tag = CreateEllipticRgn(0, 0, Command2.Width, Command2.Height)
    
'    moi region o tren duoc xac dinh trong he toa do cua chinh minh. De co the xac dinh xem 2 region
'    co "trung" nhau khong thi phai dua chung ve cung trong 1 he toa do, vd. he toa do cua Form1.
'    Vi toi dat Picture1.Left = Picture1.Top = 0 nen region "cua" Picture1 duoc tinh trong he
'    toa do Form1. Nhung toi dat Command1.Left = 800 va Command1.Top = 600 nen phai dua no ve
'    trong he toa do cua Form1 bang ham OffsetRgn.
    OffsetRgn Command2.Tag, Command2.Left, Command2.Top
    
    deltapx = 5
    deltapy = 5
    deltacx = -5
    deltacy = -5
End Sub

Private Sub Timer1_Timer()
Dim h As Long, x As Long, y As Long
'    dich Picture
    If Picture1.Left + deltapx > Me.ScaleWidth - Picture1.ScaleWidth Or _
        Picture1.Left + deltapx < 0 Then
        deltapx = -deltapx
    End If
    
    If Picture1.Top + deltapy > Me.ScaleHeight - Picture1.ScaleHeight Or _
        Picture1.Top + deltapy < 0 Then
        deltapy = -deltapy
    End If
    
    Picture1.Left = Picture1.Left + deltapx
    Picture1.Top = Picture1.Top + deltapy
    OffsetRgn Picture1.Tag, deltapx, deltapy
        
'    dich Command
    If Command2.Left + deltacx > Me.ScaleWidth - Command2.Width Or _
        Command2.Left + deltacx < 0 Then
        deltacx = -deltacx
    End If
    
    If Command2.Top + deltacy > Me.ScaleHeight - Command2.Height Or _
        Command2.Top + deltacy < 0 Then
        deltacy = -deltacy
    End If
    
    Command2.Left = Command2.Left + deltacx
    Command2.Top = Command2.Top + deltacy
    OffsetRgn Command2.Tag, deltacx, deltacy
    
'    kiem tra xem co "cham nhau" khong
    h = CreateRectRgn(0, 0, 0, 0)
    If CombineRgn(h, Picture1.Tag, Command2.Tag, RGN_AND) > 1 Then
        [B][COLOR=#ff0000]DeleteObject h[/COLOR][/B]
        Timer1.Enabled = False
        MsgBox "Hai cong chua dung dau nhau"
    End If
End Sub

Chú ý: Với Form1 và Picture1 thiết lập thuộc tính ScaleMode = 3 (Pixel). Tức ta thao tác bằng Pixels

Toàn bộ 2 project và cả EXE trong tập tin đính kèm.

À quên: trong code của Timer1_Timer thì đưa dòng

Mã:
[B][COLOR=#ff0000]DeleteObject h[/COLOR][/B]

ra ngoài block IF ... End IF. Tức đưa ra sau "IF ... END IF"
 

File đính kèm

Lần chỉnh sửa cuối:
Upvote 0

Bài viết mới nhất

Back
Top Bottom