-
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
-
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.
-
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
-
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
-
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
-
i probably will, but only right behind the text