Can anyone tell me what an 'invalid rectangle' is, probably a simple concept but the way its described in a tutorial im reading confuses the hell out of me.
Thanks,
Simon.
Thanks,
Simon.
Hi SNDHearn,
I'm just guessing but maybe you mean "Invaildate Rectangle"? If you invaildate a rectangle, it will be redrawn at the next WM_PAINT message.
James:alright:
I'm just guessing but maybe you mean "Invaildate Rectangle"? If you invaildate a rectangle, it will be redrawn at the next WM_PAINT message.
James:alright:
Invaildate Rectangle is what area their "Canvas" is nolonger vailid.
Invaildate Rectangle some times were smaller than the Rectangle of a control,
for example if you drag a window to screen's side,the place outside the screen will be
out of Invaildate Rectangle.
So if one want redraw all windows(eg.skin) in repaint,
it's better to
invoke GetClientRect,hWnd,addr ps.rcPaint
before you draw item.
Invaildate Rectangle some times were smaller than the Rectangle of a control,
for example if you drag a window to screen's side,the place outside the screen will be
out of Invaildate Rectangle.
So if one want redraw all windows(eg.skin) in repaint,
it's better to
invoke GetClientRect,hWnd,addr ps.rcPaint
before you draw item.
Cheers guys, im still a little confused though,
according to this tutorial:
"Windows defines an invalid rectangle as the smallest rectangular area in the client area that needs to be repainted."
Can someone explain that to me in simpler (dumber) terms please?
Thanks,
Simon.
according to this tutorial:
"Windows defines an invalid rectangle as the smallest rectangular area in the client area that needs to be repainted."
Can someone explain that to me in simpler (dumber) terms please?
Thanks,
Simon.
SNDHearn,
It usually means that something has been moved over the part of the window so it will need to be redrawn next time it is displayed. Think of a monitor and it can only display and given pixel at a time, it cannot store multiple information. The operating system has to do that so if one window overlaps another, the one that is overlapped has to be redrawn one it is exposed again.
The mechanics of the display in the operating system store the overlapped window's data while it is covered and it uses messages to effect the redraw once it is uncovered. This is how a window can be moved across a screen and look like the stuff under it is still there, it is being redrawn fast enough so it looks like that.
Now if you want to force a window to be redrawn, you define the rectangle you want redrawn and then make a call to InvalidateRect and the OS will draw it again.
Regards,
hutch@movsd.com
It usually means that something has been moved over the part of the window so it will need to be redrawn next time it is displayed. Think of a monitor and it can only display and given pixel at a time, it cannot store multiple information. The operating system has to do that so if one window overlaps another, the one that is overlapped has to be redrawn one it is exposed again.
The mechanics of the display in the operating system store the overlapped window's data while it is covered and it uses messages to effect the redraw once it is uncovered. This is how a window can be moved across a screen and look like the stuff under it is still there, it is being redrawn fast enough so it looks like that.
Now if you want to force a window to be redrawn, you define the rectangle you want redrawn and then make a call to InvalidateRect and the OS will draw it again.
Regards,
hutch@movsd.com
SNDHearn,
It usually means that something has been moved over the part of the window so it will need to be redrawn next time it is displayed. Think of a monitor and it can only display and given pixel at a time, it cannot store multiple information. The operating system has to do that so if one window overlaps another, the one that is overlapped has to be redrawn one it is exposed again.
The mechanics of the display in the operating system store the overlapped window's data while it is covered and it uses messages to effect the redraw once it is uncovered. This is how a window can be moved across a screen and look like the stuff under it is still there, it is being redrawn fast enough so it looks like that.
Now if you want to force a window to be redrawn, you define the rectangle you want redrawn and then make a call to InvalidateRect and the OS will draw it again.
Regards,
hutch@movsd.com
Well said.
It was M$s perfect way of saying you need to have everything in the visual field always...so we will controal and the hardware companies shall follow us.
What an artery clogger windows is.
"It was M$s perfect way of saying you need to have everything in the visual field always...so we will controal and the hardware companies shall follow us. " <----what's the point:confused:
It's as Hucth said the invalid rectangle is the portion of an applications window which needs re-painting. However,you can ignore the invalid rectangle, and just repaint the entire window on receiveng WM_PAINT.
It's as Hucth said the invalid rectangle is the portion of an applications window which needs re-painting. However,you can ignore the invalid rectangle, and just repaint the entire window on receiveng WM_PAINT.
thats better, i think i was just complicating it in my head, now i can move on.
Cheers,
Simon.
Cheers,
Simon.
Also remember that InvalidateRect does not
always send a WM_PAINT message right away.
Windows buts the message into a queue.
If you want the message to be sent right away
then just after sending the InvalidateRect message
you should send UpdateWindow, this will send the
message righ away.
It is also good to note that the DC that is returned
from the Beginpaint message is only good for the
area that PAINTSTRUCT.rcPaint <-- (a RECT Struct)
points to, so other drawing out side of his area
will be cliped and not drawn, you should make your
program draw only in this area.
You can try to draw outside the area, but this clipping
detection that windows does will slow the Paint
prosses down.
Also, I found that if I want My window to be fully
painted, I don't need to get a RECT of my window
just issue a InvalidateRect call without a RECT
like this: InvalidateRect,hWin,0,TRUE
Also note that the PAINT flag TRUE or FALSE will
cause windows to ERASE the area or not.
depending on your program you should use
FALSE, if you want no flicker, as TRUE will couse
windows to use the background brush to erase
the rect area then send you a paint message
and you paint in that area, not good to paint
2 times in some cases so FALSE will stop this
erasing effect.
There is alot of tricks I found out about how windows
acts and how windows behaves with messages ect.
and I have played around enough to trick windows
just so I get the Desired effect I want. if you don't
want to use the DC and rect returned from BeginPaint
then you can get your own DC for the window Client
area or NC Area, it's up to you.
Zcoder....
always send a WM_PAINT message right away.
Windows buts the message into a queue.
If you want the message to be sent right away
then just after sending the InvalidateRect message
you should send UpdateWindow, this will send the
message righ away.
It is also good to note that the DC that is returned
from the Beginpaint message is only good for the
area that PAINTSTRUCT.rcPaint <-- (a RECT Struct)
points to, so other drawing out side of his area
will be cliped and not drawn, you should make your
program draw only in this area.
You can try to draw outside the area, but this clipping
detection that windows does will slow the Paint
prosses down.
Also, I found that if I want My window to be fully
painted, I don't need to get a RECT of my window
just issue a InvalidateRect call without a RECT
like this: InvalidateRect,hWin,0,TRUE
Also note that the PAINT flag TRUE or FALSE will
cause windows to ERASE the area or not.
depending on your program you should use
FALSE, if you want no flicker, as TRUE will couse
windows to use the background brush to erase
the rect area then send you a paint message
and you paint in that area, not good to paint
2 times in some cases so FALSE will stop this
erasing effect.
There is alot of tricks I found out about how windows
acts and how windows behaves with messages ect.
and I have played around enough to trick windows
just so I get the Desired effect I want. if you don't
want to use the DC and rect returned from BeginPaint
then you can get your own DC for the window Client
area or NC Area, it's up to you.
Zcoder....
Yes,It's right
Draw In a valied rect takes no more effects on the hDC....
for example,If you want to delete and redraw some small area in you app,
if you send a full rect invalied message,Windows will be a flash(if you make lots work in WM_PAINT),
So can
mov rect.left,x
mov ......
call invaildedrect and push the rect pointer you want to redraw,
now only the rect will be redraw.
It's such usefull...
In the past some program's I usally place a static control in the rect and draw in WM_CTRCOLORSTATIC,
until I fround the InvaliedRect has a paramater :lpRect....
:stupid:
Draw In a valied rect takes no more effects on the hDC....
for example,If you want to delete and redraw some small area in you app,
if you send a full rect invalied message,Windows will be a flash(if you make lots work in WM_PAINT),
So can
mov rect.left,x
mov ......
call invaildedrect and push the rect pointer you want to redraw,
now only the rect will be redraw.
It's such usefull...
In the past some program's I usally place a static control in the rect and draw in WM_CTRCOLORSTATIC,
until I fround the InvaliedRect has a paramater :lpRect....
:stupid:
If you need to do a little bit of processing in the paint proc itself (i.e. when doing a spreadsheet prog perhaps, so you need to determine how to output the contents of each cell whether as text or as number) it is recommended that the paint proc itself check the invalided rectangle to reduce processing as well as GDI calls. You can thus know the range of cells that need to be redrawn and process only those cells for output. Although GDI will not do slow screen accesses if it's outside the invalided area, it still has to check whether it should or shouldn't, and if you know it's definitely outside the invalided area, you can skip calling GDI. This will help make the display snappier.
The system was created in the mid-80's when computers were much slower, so that anything that could reduce the amount of processing, even a little, meant a noticeable improvement.
The system was created in the mid-80's when computers were much slower, so that anything that could reduce the amount of processing, even a little, meant a noticeable improvement.