Jalaj P. Jha Technical & Miscellaneous Ramblings

24Feb/070




Pen Object in Device Context

We saw a lot of functions that draw geometrical shapes. But the problem is that you can't change the color or width or the style of the pen. The exception to my previous statement is the SetDCPenColor function that can change the pen color associated with the device context, and which we already discussed it in one of previous post WinAPI : GetPixel Function. However, the function is supported only on Windows 200 and later so you cannot use the function if your intent is to develop supporting previous versions too. Is there any way out?

23Feb/070




WinAPI : InvertRect Function

The InvertRect function can be utilized to invert the colors within a given rectangular area of the device context, similar to bitmap operation that you will find with most of the photo editing tools.

22Feb/070




WinAPI : RoundRect Function

The Windows API contains Reound Rect function using which we can draw rounded rectangle.

21Feb/071




Ellipse and Rectangle Functions

While the Ellipse can be drawn by passing the last four parameters of the Arc function as zeroes, a function Ellipse do exists with the Windows API and which can be utilized for drawing the ellipse.