' Draw the rectangle with the wide green pen.Į.Graphics.DrawRectangle(greenPen, 10, 100, 50, 50) Draw the rectangle with the thin black pen.Į.Graphics.DrawRectangle(blackPen, 10, 100, 50, 50) Draw the rectangle with the wide green pen.Į.Graphics.DrawRectangle(greenPen, 10, 100, 50, 50) Pen blackPen = new Pen(Color.FromArgb(255, 0, 0, 0), 1) The following illustration shows the resulting rectangle:
![terramodel pen width terramodel pen width](https://img.yumpu.com/44274628/1/184x260/terramodel-1061h-release-notes-geocomp-systems.jpg)
Set the value of the Alignment property to Center to specify that the pixels drawn with the green pen will be centered on the boundary of the rectangle. Draw the line with the wide green pen.Į.Graphics.DrawLine(greenPen, 10, 100, 100, 50) GreenPen.Alignment = PenAlignment.Center
#TERRAMODEL PEN WIDTH CODE#
The following code example draws a rectangle twice: once with a black pen of width 1 and once with a green pen of width 10. The following illustration shows the resulting line. Set the value of the Alignment property to Center (the default) to specify that pixels drawn with the green pen will be centered on the theoretical line. The following code example draws a line twice: once with a black pen of width 1 and once with a green pen of width 10.
![terramodel pen width terramodel pen width](https://s3.manualzz.com/store/data/023271118_1-58970a51994d0f33dae55cbace011644-360x466.png)
The values Center, Outset, and Inset that appear in the following code examples are members of the PenAlignment enumeration. You can set the pen alignment property of a Pen to determine how the pixels drawn with that pen will be positioned relative to theoretical lines. If you draw a line that is more than one pixel wide, the pixels are either centered on the theoretical line or appear to one side of the theoretical line. When you draw a line that is 1 pixel wide, the pixels are centered on the theoretical line. You can also change the pen width with the Width property of the Pen class.Ī theoretical line has a width of 0.
![terramodel pen width terramodel pen width](https://confluence.qps.nl/qinsy/files/latest/en/57234084/57234062/1/1478723006000/PM_Line_ImportKML_P2.jpg)
When you create a Pen, you can supply the pen width as one of the arguments to the constructor.