Marks a specified rectangle of a Form for redraw.
Form.Invalidate [x!, y!, w!, h!]
Form.InvalidateAll
x! ,y! ,w! ,h!:single expression
The Invalidate method is used when a rectangular area of form is to be redrawn. The upper left corner of the rectangle is specified in x! and y!, the width in w!, and the height in h!. The coordinates are in reference to form's scale mode.
The system sends a WM_PAINT message to a window whenever its update region is not empty and there are no other messages in the application queue for that window. The message is processed in the next Sleep command, which then invokes the Paint event sub.
InvalidateAll invalidates the entire client area and is equal to Invalidate without parameters, but a bit faster, though.
OpenW 1 , , , 400, 400
// Without AutoRedraw, the window does not store the printed rectangle
' Win_1.AutoRedraw = 1
Ocx Command cmd1 = "Invalidate Top && Left", 20, 10, 120, 22
Ocx Command cmd2 = "Invalidate Everything", 20, 50, 120, 22
Ocx Command cmd3 = "Redraw Rectangle", 20, 80, 120, 22
Box 10, 40, 200, 200
Do : Sleep : Until Win_1 Is Nothing
Sub cmd1_Click
// Repaints an area covering the top and left of the rectangle...
// ...from an image which doesn't contain the rectangle
Win_1.Invalidate 10, 40, 189, 159
EndSub
Sub cmd2_Click
// Repaints the whole window from an image...
// ...which doesn't contain the rectangle
Win_1.InvalidateAll
EndSub
Sub cmd3_Click
Box 10, 40, 200, 200
EndSub
OpenW 1, 10, 10, 200, 200
OpenW 2, 220, 10, 200, 200
Print "Text to be copied"
Ocx Command cmd = "Copy Text", 10, 40, 100, 22
Do : Sleep : Until Win_1 Is Nothing Or Win_2 Is Nothing
CloseW 1
CloseW 2
Sub cmd_Click
// AutoRedraw for Window 1 can be switched on here or when the window is opened
Win_1.AutoRedraw = 1
// Coies the contents of Window 2 to the hDC2 of Window 1
BitBlt Win_2.hDC, 0, 0, 200, 200, Win_1.hDC2, 0, 0, SRCCOPY
// Forces Window 1 to repaint from the bitmap image copied to hDC2
Win_1.Invalidate
EndSub
Invalidate[All] sends a redraw message for a rectangular area. Invalidate corresponds to Windows function InvalidateRect().
{Created by Sjouke Hamstra; Last updated: 10/10/2014 by James Gaite}