📄 smooth.aspx
字号:
<%@ ContentType="image/jpeg" Language="C#" %>
<%@ Import namespace="System.Drawing" %>
<%@ Import namespace="System.Drawing.Imaging" %>
<%@ Import namespace="System.Drawing.Drawing2D" %>
<%@ Import namespace="System.Drawing.Text" %>
<script language="C#" runat=server>
void Page_Load(Object sender , EventArgs e)
{
Bitmap objBitmap;
Graphics objGraphics;
Pen objPen;
Brush objBrush;
Font objFont;
// Create Bitmap
objBitmap = new Bitmap( 400, 400 );
// Initialize Graphics class
objGraphics = Graphics.FromImage( objBitmap );
// Create Pen, Brush and Font
objPen = new Pen( Color.Yellow );
objBrush = new SolidBrush( Color.Yellow );
objFont = new Font( "Lucida Sans Unicode", 18 );
// Default SmoothingMode
objGraphics.SmoothingMode = SmoothingMode.Default;
objGraphics.DrawString( "Default", objFont, objBrush, 50, 20 );
objGraphics.DrawEllipse( objPen, 10, 10, 200, 50 ) ;
// AntiAlias SmoothingMode
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
objGraphics.DrawString( "AntiAlias", objFont, objBrush, 50, 80 );
objGraphics.DrawEllipse( objPen, 10, 70, 200, 50 ) ;
// HighQuality SmoothingMode
objGraphics.SmoothingMode = SmoothingMode.HighQuality;
objGraphics.DrawString( "HighQuality", objFont, objBrush, 50, 140 );
objGraphics.DrawEllipse( objPen, 10, 130, 200, 50 ) ;
// HighSpeed SmoothingMode
objGraphics.SmoothingMode = SmoothingMode.HighSpeed;
objGraphics.DrawString( "HighSpeed", objFont, objBrush, 50, 200 );
objGraphics.DrawEllipse( objPen, 10, 190, 200, 50 ) ;
// None SmoothingMode
objGraphics.SmoothingMode = SmoothingMode.None;
objGraphics.DrawString( "None", objFont, objBrush, 50, 260 );
objGraphics.DrawEllipse( objPen, 10, 250, 200, 50 ) ;
// Display Bitmap
objBitmap.Save( Response.OutputStream, ImageFormat.Jpeg );
}
</Script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -