Results 1 to 2 of 2

Thread: DC mem clearing

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    USA all the way!
    Posts
    82

    DC mem clearing

    I need to know how to clear a dc that i made with a function:

    Public Function CreateDC(iH As Long, iW As Long) As Long
    Dim temp As Long
    CreateDC = CreateCompatibleDC(frmMain.hdc)
    temp = CreateCompatibleBitmap(frmMain.hdc, iW, iH)
    SelectObject CreateDC, temp
    DeleteObject temp
    End Function

    i made a dc, then bitblt to it, now i want to clear it (like me.cls for forms) Can anyone here help me out?
    Often talked of, never seen,
    Ever coming, never been,
    Daily looked for, never here,
    Still approaching, coming near,
    Thousands for its visit wait,
    But alas for their fate,
    Tho' they expect me to appear,
    They will never find me here.

    What's this about?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Since this is my function you're using there Sure:

    VB Code:
    1. Public Type tRect
    2.    x as Long
    3.    y as Long
    4.  
    5.    x2 as Long
    6.    y2 as Long
    7. End Type
    8.  
    9. Declare Function FillRect Lib "user32" Alias "FillRect" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
    10.  
    11.  
    12. Public Function CreateDC(iH As Long, iW As Long) As Long
    13.    Dim Temp As Long
    14.  
    15.    CreateDC = CreateCompatibleDC(frmMain.hdc)
    16.    Temp = CreateCompatibleBitmap(frmMain.hdc, iW, iH)
    17.  
    18.    SelectObject CreateDC, Temp
    19.    DeleteObject Temp
    20.  
    21.    'Clear the DC
    22.    Dim Rect as tRect
    23.  
    24.    Rect.x2 = iw
    25.    Rect.y2 = ih
    26.  
    27.    FillRect CreateDC, Rect, 0
    28. End Function
    Last edited by Fox; May 2nd, 2002 at 04:37 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