Results 1 to 2 of 2

Thread: Line BF using API

  1. #1

    Thread Starter
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Is there an API which replaces the Line function with the BF parameter? I want to draw a rectangle filled with one color but I can't use the Line command in this case...

    Thanks...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  2. #2

    Thread Starter
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Already found the solution (I love the API-Guide ):

    Code:
    Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
    Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
    
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    
    Private Type LOGBRUSH
        lbStyle As Long
        lbColor As Long
        lbHatch As Long
    End Type
    
    Private Const BS_SOLID = 0
    
    Private Sub Form_Resize()
        Dim LB As LOGBRUSH
        Dim hBrush As Long
        Dim rTest As RECT
    
        frmMain.ScaleMode = vbPixels
        frmMain.AutoRedraw = True
    
        LB.lbStyle = BS_SOLID
        LB.lbColor = RGB(0, 0, 192)
    
        With rTest
            .Top = 10
            .Left = 10
            .Bottom = frmMain.ScaleHeight - 10
            .Right = frmMain.ScaleWidth - 10
        End With
    
        hBrush = CreateBrushIndirect(LB)
    
        frmMain.Cls
        Call FillRect(frmMain.hDC, rTest, hBrush)
        frmMain.Refresh
    End Sub
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

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