Results 1 to 2 of 2

Thread: [Visual Basic 2010] - usercontrol problems

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    [Visual Basic 2010] - usercontrol problems

    i have code for make the usercontrol transparent:
    Code:
    Protected Overrides ReadOnly Property CreateParams() As CreateParams
            Get
    
                Dim cp As CreateParams = MyBase.CreateParams
    
                cp.ExStyle = cp.ExStyle Or &H20
                'WS_EX_TRANSPARENT
                Return cp
            End Get
        End Property
    
        Protected Sub InvalidateEx()
            Dim rc As Rectangle
            If (Parent Is Nothing) Then Exit Sub
            rc = New Rectangle(Me.Location, Me.Size)
            Parent.Invalidate(rc, True)
        End Sub
    
    Private Sub Sprite2D_OnPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
            Dim a As Bitmap
            If Me.BackgroundImage Is Nothing Then Exit Sub
            a = Me.BackgroundImage
            a.MakeTransparent()
            e.Graphics.DrawImage(a, New Point(0, 0))
        End Sub
    these code shows the usercontrol transparent. but when the control moves i see that these control needs time to be transparent or drawing an image
    why so many time(maybe 2 seconds)?
    and why i can't use directions keys on keydown event?(the arrow keys are ignored)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: [Visual Basic 2010] - usercontrol problems

    for resolve the arrow keys and others, i found these: http://bytes.com/topic/visual-basic-...s-user-control
    but i still with transparent problem
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width