Pen MiterLimit Property
PenMiterLimitProperty.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.AntiqueWhite);
Pen drawingPen = new Pen(Color.Teal, 15);
GraphicsPath gPath = new GraphicsPath();
gPath.StartFigure();
gPath.AddLine(100, 25, 400, 25);
gPath.AddLine(100, 100, 400, 100);
drawingPen.LineJoin = LineJoin.Miter;
g.DrawPath(drawingPen, gPath);
Pen drawingPen2 = new Pen(Color.IndianRed, 15);
GraphicsPath gPath2 = new GraphicsPath();
gPath2.StartFigure();
gPath2.AddLine(100, 150, 400, 150);
gPath2.AddLine(100, 225, 400, 225);
drawingPen2.LineJoin = LineJoin.Miter;
drawingPen2.MiterLimit = 5;
g.DrawPath(drawingPen2, gPath2);
String path = Server.MapPath("~/Image/PenMiterLimitProperty.jpg");
bmp.Save(path,ImageFormat.Jpeg);
Image1.ImageUrl = "~/Image/PenMiterLimitProperty.jpg";
g.Dispose();
bmp.Dispose();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Pen MiterLimit - how to set the limit of the thickness of the join on a mitered corner</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:MidnightBlue; font-style:italic;">
How to get or set the limit of the thickness of
<br />the join on a mitered corner in asp.net drawing
<br />Pen.MiterLimit 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 MiterLimit Property"
Height="45"
Font-Bold="true"
ForeColor="DarkBlue"
/>
</div>
</form>
</body>
</html>

- How to draw a series of rectangles
- How to draw an ellipse
- How to draw a line connecting two Point structures
- How to draw a pie shape
- How to draw a polygon
- How to draw text string
- How to use Graphics.ExcludeClip method
- How to use Pen Alignment property Inset
- How to use Pen LineJoin Miter
- Pen LineJoin MiterClipped