Results 1 to 6 of 6

Thread: Deleting text from DrawText

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202
    Hi,

    Just want to know if there is a way to delete what one wrote with the API drawText without refreshing the screen or using the autoredraw. See, let's say I write Hello on a form and want it to write Bye in its place when user clicks a button, is there a way to delete Hello and then write again Bye.


    Thanx

    Phailak

  2. #2
    Guest
    Using refersh is the easy way, but if you want to erase it using API, I'm guessing you'd have to send the WM_PAINT and WM_ERASEBKGND messages.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202
    Ok, thanx,
    Now let's say I have 10 areas define by the Api CreatePolygons and there is some text in each. What if I want to erase the text in one of the areas only, let's say Polygon number 5 (I do have its Rgn coordonates and those of the Rect i created to write my text into)
    Can I still use those messages or will that erase the whole background?

    Phailak

  4. #4
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    you can do this ( i have the same problem, but this is my
    solution, it works with a Rgn or a Rect structure):
    Declares:
    Code:
    Public Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, _
    lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal _
    fuRedraw As Long) As Long
    
    Public Declare Function RedrawWindowM Lib "user32" Alias "RedrawWindow" (ByVal hwnd As Long, lprcUpdate As _
    Long, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As _
    Long
    
    Public Declare Function DeleteObject Lib "gdi32" (ByVal _
    hObject As Long) As Long
    
    
    Public Const RDW_INVALIDATE = &H1
    
    Public Const RDW_ERASE = &H4
    
    Public Const RDW_ERASENOW = &H200
    
    Public Const RDW_ALLCHILDREN = &H80
    For Regions:
    Code:
    Private Sub ClearMessage(rgnBounding)
    Dim retval As Long
    RedrawWindowM 0, ByVal 0&, rgnBounding, RDW_INVALIDATE Or _
    RDW_ERASE Or RDW_ERASENOW Or RDW_ALLCHILDREN 
    'refresh screen only on that point
    DeleteObject rgnBounding 'delete region
    End Sub
    For Rects:
    Code:
    Private Sub ClearBox(r As RECT)
    RedrawWindow 0, r, ByVal 0&, RDW_INVALIDATE Or RDW_ERASE Or _
    RDW_ERASENOW Or RDW_ALLCHILDREN 
    'refresh screen only on that point
    End Sub
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202
    Thanx gwdash

    I can work with those, it will probably erase my background right? But it doesn't matter, it will be easy to redraw

    Phailak

  6. #6
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    i probably will, but only right behind the text
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

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