SIGN UP MEMBER LOGIN:    
ARTICLE

Rectangle and Regions in GDI+

Posted by Mahesh Chand Articles | GDI+ & Graphics January 08, 2010
In this article I will explain about Rectangle and Regions in GDI+.
Reader Level:

This article has been excerpted from book "Graphics Programming with GDI+".

In this article we will discuss addition functionality of rectangles and regions.

We will cover the following key topics:

  • . NET Framework objects that work with rectangles and regions and their members.
  • Graphics class members that work with rectangle and regions
  • Writing application using objects
  • The Rectangle structure and its members
  • The Region class and its members
  • Invalidating and clipping regions
  • Examples of real-world application using regions and rectangles

A rectangle has three properties: starting point, height, and width. Figure 6.1 shows these properties where the starting point is the top left.

Suppose you wanted to draw a rectangle from point (1,2) with height 7 and width 6. The final rectangle would look like Figure 6.2.

The filled rectangle occupies the entire within the range of its height and width.

Figure 6.1.gif

FIGURE 6.1: A rectangle

figure6.2.gif

FIGURE 6.2: A rectangle with starting point (1,2), height 7, and width 6

The Rectangle Structure

A rectangle object stores the top left corner and height and width of a rectangle region. In this section we will see how to create and use the rectangle structure.


Conclusion

Hope the article would have helped you in understanding
Rectangle and Regions in GDI+. Read other articles on GDI+ on the website.

bookGDI.jpg This book teaches .NET developers how to work with GDI+ as they develop applications that include graphics, or that interact with monitors or printers. It begins by explaining the difference between GDI and GDI+, and covering the basic concepts of graphics programming in Windows.

Login to add your contents and source code to this article
share this article :
post comment
 

Puran,
This article is not enough to publish as an article. So we need to make sure every article has long enough and has enough code with it to explain the theory. So in book there should be code how to create and work with rectangles and regions. We need to add that code as well.

An article must be 2 - 3 pages long.

Thanks,
Mahesh

Posted by Mahesh Chand Jan 08, 2010
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Nevron Gauge for SharePoint
Become a Sponsor