Results 1 to 2 of 2

Thread: Form_Paint Want To Use Like THis how ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    well i want to fade the background the spalsh screen and draw a circle and paint a red to black spash in the circle how do i do this ??

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this. Create 2 forms (frmSplash and frmMain). Add a picture box to frmSplash. Add a module to your project and set your Project Properties to have Startup Object to be Sub Main.

    Change BorderStyle property for frmSplash to None. Copy this code to a module:
    Code:
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    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 Boolean) As Long
    
    Public Sub Main()
        Dim lRoundRgn As Long
        Dim rc As RECT
        Dim x As Long
        Dim y As Long
        Dim lTimer As Long
        
        Load frmSplash
        frmSplash.ScaleMode = vbPixels
        Call GetClientRect(frmSplash.hwnd, rc)
        x = frmSplash.Picture1.Width
        y = frmSplash.Picture1.Height
        lRoundRgn = CreateEllipticRgn(x, y, 5, 5)
        SetWindowRgn frmSplash.Picture1.hwnd, lRoundRgn, True
        frmSplash.Show
        
        lTimer = Timer
        Do While Timer < lTimer + 3
            DoEvents
        Loop
        
        Unload frmSplash
        frmMain.Show
    End Sub
    Copy this code to frmSplash:
    Code:
    Private Sub Form_Load()
        PaintPictureRed Picture1
        Me.Left = (Screen.Width - Me.Width) / 2
        Me.Top = (Screen.Height - Me.Height) / 2
    End Sub
    
    Private Function PaintPictureRed(ByVal pOject As Object)
        Dim i As Integer
        Dim y As Integer
    
    
        With pOject
            .AutoRedraw = True
            .DrawStyle = 6
            .DrawMode = 13
            .DrawWidth = 2
            .ScaleMode = 3
            .ScaleHeight = (256 * 2)
        End With
    
        'Paint it red to black
        For i = 0 To 255
            pOject.Line (0, y)-(pOject.Width, y + 2), RGB(i, 0, 0), BF
            y = y + 2
        Next i
    End Function
    Run your project.

    Regards,

    Edited by Serge on 03-09-2000 at 11:06 AM

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