c# - How to use Pen Alignment property Inset

Pen Alignment Property Inset
PenAlignmentProperty.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.Drawing.Imaging" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Bitmap bmp = new Bitmap(600,250);
        Graphics g = Graphics.FromImage(bmp);
        g.Clear(Color.GhostWhite);

        Pen drawingPen = new Pen(Color.LawnGreen,20);
        g.DrawRectangle(drawingPen,50,50,200,150);

        Pen drawingPen2 = new Pen(Color.Black, 2);
        g.DrawRectangle(drawingPen2,50,50,200,150);

        drawingPen.Alignment = PenAlignment.Inset;
        g.DrawRectangle(drawingPen,300,50,200,150);

        g.DrawRectangle(drawingPen2,300,50,200,150);

        String path = Server.MapPath("~/Image/PenAlignmentProperty.jpg");
        bmp.Save(path,ImageFormat.Jpeg);

        Image1.ImageUrl = "~/Image/PenAlignmentProperty.jpg";
        g.Dispose();
        bmp.Dispose();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>how to use Pen Alignment Property Inset in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">
            How to use Pen Alignment Property Inset in asp.net drawing
            <br />Pen.Alignment Property
        </h2>
        <hr width="600" align="left" color="DarkBlue" />
        <asp:Image
             ID="Image1"
             runat="server"
             />
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Pen Alignment Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DarkBlue"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples