Following example shows that how to add shadow to text or how to draw gdi text with shadow effect in vb.net. Example contains one picture box on which we will create text with shadow effect.
-->
Paths are formed by combining lines, rectangles, and simple curves. Recall from the Vector Graphics Overview that the following basic building blocks have proven to be the most useful for drawing pictures:
Lines
Rectangles
Ellipses
Arcs
Polygons
Cardinal splines
Bézier splines
In GDI+, the GraphicsPath object allows you to collect a sequence of these building blocks into a single unit. The entire sequence of lines, rectangles, polygons, and curves can then be drawn with one call to the DrawPath method of the Graphics class. The following illustration shows a path created by combining a line, an arc, a Bézier spline, and a cardinal spline.
Using a Path
The GraphicsPath class provides the following methods for creating a sequence of items to be drawn: AddLine, AddRectangle, AddEllipse, AddArc, AddPolygon, AddCurve (for cardinal splines), and AddBezier. Each of these methods is overloaded; that is, each method supports several different parameter lists. For example, one variation of the AddLine method receives four integers, and another variation of the AddLine method receives two Point objects.
The methods for adding lines, rectangles, and Bézier splines to a path have plural companion methods that add several items to the path in a single call: AddLines, AddRectangles, and AddBeziers. Also, the AddCurve and AddArc methods have companion methods, AddClosedCurve and AddPie, that add a closed curve or pie to the path.
To draw a path, you need a Graphics object, a Pen object, and a GraphicsPath object. The Graphics object provides the DrawPath method, and the Pen object stores attributes, such as width and color, of the line used to render the path. The GraphicsPath object stores the sequence of lines and curves that make up the path. The Pen object and the GraphicsPath object are passed as arguments to the DrawPath method. The following example draws a path that consists of a line, an ellipse, and a Bézier spline:
The following illustration shows the path.
In addition to adding lines, rectangles, and curves to a path, you can add paths to a path. This allows you to combine existing paths to form large, complex paths.
There are two other items you can add to a path: strings and pies. A pie is a portion of the interior of an ellipse. The following example creates a path from an arc, a cardinal spline, a string, and a pie:
The following illustration shows the path. Note that a path does not have to be connected; the arc, cardinal spline, string, and pie are separated.
See also
Active9 years, 10 months ago
I'm drawing lots of images (all of them dimensions=24x24 pixelformat=32BppPArgb) onto a Control using a Drawing.Graphics object and the DrawImage() function. It's possible to zoom out in my application which means that the Graphics object has a Transform Matrix attached to it which controls both zooming and panning.
There's no point in drawing these icons when the zoom drops below 50%, but I'd like to make the transition from drawing icons to not drawing icons smoother. I.e., starting at 70%, icons should be drawn with an additional transparency factor so that they will become completely transparent at 50%.
How can I draw a bitmap with an additional transparency without it taking significantly longer than DrawImage()?
You just create an appropriate ColorMatrix, initialize a ImageAttributes object with it and pass that ImageAttributes object to one of the overloaded version of Graphics.DrawImage. This sample will give you 50% transparancy: