Jalaj P. Jha

Technical & Miscellaneous Ramblings

Archive for February 2007

Creating Solid and Hatch Brushes

with 2 comments

The default brush associated with a device context is a hollow brush thus the Rectangle, Ellipse and similar function all tends to draw outlines only and doesn’t fill the shape. The current brush setting can be received in a LOGBRUSH structure (discussed in WinAPI: Using Brushes) using the GetCurrentObject and GetObject functions, already discussed in Modifying Existing Pen in DC
Read the rest of this entry »

Written by jalaj

February 28, 2007 at 4:15 am

Posted in Visual Basic, WinAPI

Tagged with

WinAPI: Using Brushes

with 4 comments

After Pen Objects we will discuss here Brushes that’s another type of object which is associated with a Device Context. While Pens are used by Windows to draw lines, Brushes are objects that are used to fill the area enclosed within bound regions as ellipse, rectangle, polygons or paths.
Read the rest of this entry »

Written by jalaj

February 27, 2007 at 8:14 am

Posted in Visual Basic, WinAPI

Tagged with

Modifying Existing Pen in DC

without comments

Want to modify the color or width or the style of the Pen that’s currently associated with the device context? You can’t do it directly as there’s no such function provided by the GDI. However, it’s said, where there’s a will there’s a way.
Read the rest of this entry »

Written by jalaj

February 26, 2007 at 11:27 am

Posted in Visual Basic, WinAPI

Tagged with

WinAPI : The CreatePen Function

with 3 comments

Getting ahead from where we ended in previous post Pen Object in Device Context, let’s see how to create a pen and associate it with the device context.
Read the rest of this entry »

Written by jalaj

February 25, 2007 at 9:19 am

Posted in Visual Basic, WinAPI

Tagged with

Pen Object in Device Context

with 3 comments

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?
Read the rest of this entry »

Written by jalaj

February 24, 2007 at 7:43 am

Posted in Visual Basic, WinAPI

Tagged with

WinAPI : InvertRect Function

with one comment

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.
Read the rest of this entry »

Written by jalaj

February 23, 2007 at 12:37 pm

Posted in Application, Visual Basic, WinAPI

Tagged with

WinAPI : RoundRect Function

without comments

The Windows API contains Reound Rect function using which we can draw rounded rectangle.
Read the rest of this entry »

Written by jalaj

February 22, 2007 at 11:37 am

Posted in Visual Basic, WinAPI

Tagged with