C#设置页面单位和缩放的方法
本文实例讲述了C#设置页面单位和缩放的方法。分享给大家供大家参考。具体如下:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceadvanced_drawing
{
publicpartialclassForm2:Form
{
publicForm2()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
Graphicsg=this.CreateGraphics();
g.PageUnit=GraphicsUnit.Inch;
g.PageScale=1;
FontrulerFont=newFont("MSSamsSerif",8.25f);
PenblackPen=newPen(Color.Black,0.05f);
floatrulerFontHeight=rulerFont.GetHeight(g);
RectangleFrulerRect=newRectangleF(0,0,6.5f,rulerFontHeight*1.5f);
g.DrawRectangle(blackPen,rulerRect.X,rulerRect.Y,rulerRect.Width,rulerRect.Height);
}
}
}
希望本文所述对大家的C#程序设计有所帮助。
热门推荐
10 英语寄语生日祝福语简短
11 祝福语通用句子大全简短
12 边防女兵祝福语大全简短
13 新年给父亲简短祝福语
14 经典新婚祝福语英文简短
15 看望长辈礼物祝福语简短
16 干老师祝福语朋友简短
17 搞笑祝福语生日老师简短
18 高兴的结婚祝福语简短