<!
StartFragment
>using System;
using SystemDrawing;
using SystemDrawingText;
using SystemDrawingDrawingD;
using SystemCollections;
using SystemComponentModel;
using SystemWindowsForms;
using SystemData;
namespace WindowsApplication
{
/// <summary>
/// Form的摘要说明
/// </summary>
public class Form : SystemWindowsFormsForm
{
/// <summary>
/// 必需的设计器变量
/// </summary>
private SystemComponentModelContainer components = null;
private string TextToDraw =
public Form()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
// 在 InitializeComponent 调用后添加任何构造函数代码
thisSetStyle(ControlStylesResizeRedrawtrue);
}
/// <summary>
/// 清理所有正在使用的资源
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
componentsDispose();
}
}
baseDispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 不要使用代码编辑器修改
/// 此方法的内容
/// </summary>
private void InitializeComponent()
{
//
// Form
//
thisAutoScaleBaseSize = new SystemDrawingSize( );
thisBackColor = SystemDrawingColorWhite;
thisClientSize = new SystemDrawingSize( );
thisFont = new SystemDrawingFont(Tahoma F
SystemDrawingFontStyleBold SystemDrawingGraphicsUnitPoint ((SystemByte)()));
thisName = Form;
thisText = Form;
thisPaint += new SystemWindowsFormsPaintEventHandler(thisForm_Paint);
}
#endregion
/// <summary>
/// 应用程序入口点
/// </summary>
[STAThread]
static void Main()
{
ApplicationRun(new Form());
}
protected override void OnPaintBackground(PaintEventArgs e)
{
LinearGradientBrush b = new LinearGradientBrush(thisClientRectangle
ColorBlueColorAliceBluef);
eGraphicsFillRectangle(bthisClientRectangle);
bDispose();
}
private void Form_Paint(object sender SystemWindowsFormsPaintEventArgs e)
{
// 创建一个小的Bitmap
Bitmap bm = new Bitmap(thisClientSizeWidth/thisClientSizeHeight/);
//得到 Graphics 对象
Graphics g = GraphicsFromImage(bm);
// 必须使用 antialiased rendering hint
gTextRenderingHint = TextRenderingHintAntiAlias;
//this matrix zooms the text out to / size and offsets it by a little right and down
Matrix mx = new Matrix(ff);
gTransform = mx;
// 画阴影
gDrawString(TextToDrawFontnew SolidBrush( ColorFromArgb( ColorBlack))
StringFormatGenericTypographic );
gDispose();
eGraphicsInterpolationMode=InterpolationModeHighQualityBicubic;
eGraphicsTextRenderingHint=TextRenderingHintAntiAlias;
eGraphicsDrawImage(bmthisClientRectanglebmWidthbmHeightGraphicsUnitPixel);
eGraphicsDrawString(TextToDrawFontBrushesWhiteStringFormatGenericTypographic);
bmDispose();
}
}
}