📄 dashstyle.aspx
字号:
<%@ Page ContentType="image/gif" Language="C#" %>
<%@ Import namespace="System.Drawing" %>
<%@ Import namespace="System.Drawing.Imaging" %>
<%@ Import namespace="System.Drawing.Drawing2D" %>
<script language="C#" Debug="true" runat=server>
void Page_Load(Object sender , EventArgs e)
{
Bitmap objBitmap;
Graphics objGraphics;
Pen objPen;
// Create Bitmap
objBitmap = new Bitmap( 400, 200 );
//Create Graphics
objGraphics = Graphics.FromImage( objBitmap );
//Create Custom Pen
objPen = new Pen( Color.White );
objPen.Width = 4;
//Draw Dash Line
objPen.DashStyle = DashStyle.Dash;
objGraphics.DrawLine( objPen, 10, 20, 350, 20 );
//Draw DashDot Line
objPen.DashStyle = DashStyle.DashDot;
objGraphics.DrawLine( objPen, 10, 40, 350, 40 );
//Draw DashDotDot Line
objPen.DashStyle = DashStyle.DashDotDot;
objGraphics.DrawLine( objPen, 10, 60, 350, 60 );
//Draw Dot Line
objPen.DashStyle = DashStyle.Dot;
objGraphics.DrawLine( objPen, 10, 80, 350, 80 );
//Draw DashDotDot Linen
objPen.DashStyle = DashStyle.Solid;
objGraphics.DrawLine( objPen, 10, 100, 350, 100 );
//Display Bitmap
objBitmap.Save( Response.OutputStream, ImageFormat.Gif );
}
</Script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -