This topic is now archived and is closed to further replies.


GDI Clipping

Recommended Posts

giant    205
Greeting. Hi, I was wondering if anyone could help me with this problem that I am having. I am writing a program and it uses GDI for all the Graphics. I am having a problem with the GDI shapes being rendered outside the area where they should be. I''ll try and explain. I have multiple classes which display data to the screen, (using GDI). These class Objects are positionable and can move. All this data, (position, size etc...) is stored within the class and is invisable to main. When the class render''s the data, it draws out everything that it has. I dont want this. I only want it to render the information if it apprears within the area that the class has specified in the combination of its size and position variables eg. PositionX = 10 and PositionY = 50 Width = 100 and Height = 80 Data is only rendered to screen if 10 > PixelX < 110 and 50 > PixelY < 130 I have tried using InvalidateRect and passing a RECT to it specifying where it can update, but this isnt working for me, its just acting really weird. Is there any way of setting up a clipper which I can specify on the fly inside the Render Function of the Object, ( The Objects Render Function is called within the WM_PAINT message, ie. after a call to InvalidateRect ) to use with GDI Functions such as Rectangle, LineTo, Polygon etc.... Any help is greatly apprecitated. Thanks Ciaran

Share this post

Link to post
Share on other sites