form上画了一些矩形和圆形,请教如何打印? form上画了一些矩形和圆形。请教如何打印?可以给我个例子吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.Bounds;Image img = new Bitmap(R.Width, R.Height);Graphics G = Graphics.FromImage(img);G.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(R.Width, R.Height));。 IntPtr dc = G.GetHdc(); G.ReleaseHdc(dc);G.Dispose();img .Save("c:\\a.jpg");或private void DrawLabel(Label l, Graphics g) { Rectangle r = GetControlRect(l); if (l.AutoSize) { r.Width = (int)g.MeasureString(l.Text, l.Font).Width; } if (l.BorderStyle != BorderStyle.None) { g.DrawRectangle(_pen, r); } r.Width = (int)(r.Width * 1.1); r.Height = (int)(r.Height * 1.1); if (l.TextAlign == ContentAlignment.BottomRight || l.TextAlign == ContentAlignment.MiddleRight || l.TextAlign == ContentAlignment.TopRight) g.DrawString(GetControlText(l), l.Font, l.Enabled ? new SolidBrush(l.ForeColor) : Brushes.Gray, (RectangleF)r, new StringFormat(StringFormatFlags.DirectionRightToLeft)); else g.DrawString(GetControlText(l), l.Font, l.Enabled ? new SolidBrush(l.ForeColor) : Brushes.Gray, (RectangleF)r); } 会c#安装和布署的进。急啊。。。 如何获取某控件所在的GroupBox的Name? 如何保存已打开的WORD文件? Process.Start函数启动带参数的控制台程序,参数内部带空格怎么办? 文本链接问题 一个关于DATAGIRD的问题,急,谢谢大家! 请问大家谁知道Calendar控件怎么让他只显示一周的时间 c# attribute问题 谢谢你的帮助~~~~~~~~~~~~~~急 求助 送分 对VS.Net中企业级模板的疑问 c#winform显示进度条问题 .NET怎么把数据存在XML里
Image img = new Bitmap(R.Width, R.Height);
Graphics G = Graphics.FromImage(img);
G.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(R.Width, R.Height));。
IntPtr dc = G.GetHdc();
G.ReleaseHdc(dc);
G.Dispose();
img .Save("c:\\a.jpg");
或
private void DrawLabel(Label l, Graphics g)
{
Rectangle r = GetControlRect(l);
if (l.AutoSize)
{
r.Width = (int)g.MeasureString(l.Text, l.Font).Width;
} if (l.BorderStyle != BorderStyle.None)
{
g.DrawRectangle(_pen, r);
}
r.Width = (int)(r.Width * 1.1);
r.Height = (int)(r.Height * 1.1);
if (l.TextAlign == ContentAlignment.BottomRight || l.TextAlign == ContentAlignment.MiddleRight || l.TextAlign == ContentAlignment.TopRight)
g.DrawString(GetControlText(l), l.Font, l.Enabled ? new SolidBrush(l.ForeColor) : Brushes.Gray, (RectangleF)r, new StringFormat(StringFormatFlags.DirectionRightToLeft));
else
g.DrawString(GetControlText(l), l.Font, l.Enabled ? new SolidBrush(l.ForeColor) : Brushes.Gray, (RectangleF)r);
}