如何用asp.net类中的Graphics在界面上写字

raingod 2004-07-25 04:54:58
如何用asp.net类中的Graphics在界面上写字
...全文
205 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanfe 2004-07-25
  • 打赏
  • 举报
回复
net_lover(孟子E章)
我是前些 时间发现 老大这里好东西满多地 呵呵 去那里学习不错!~

http://dotnet.aspx.cc/
huangsuipeng 2004-07-25
  • 打赏
  • 举报
回复
uP吧,楼上们的方法
goody9807 2004-07-25
  • 打赏
  • 举报
回复
用 GDI+ 呈现字符串
获取对将用于绘图的图形对象的引用。有关更多信息,请参见用 GDI+ 创建图形图像。
' Visual Basic
' Obtains a reference to the graphics object for Button1
Dim g as Graphics = Button1.CreateGraphics

// C#
// Obtains a reference to the Graphics object for Button1
Graphics g = Button1.CreateGraphics();

// C++
// Obtains a reference to the Graphics object for button1
Graphics* g = button1->CreateGraphics();
创建绘制文本要使用的“画笔”的实例。例如:
' Visual Basic
Dim mybrush As New Drawing2D.LinearGradientBrush(ClientRectangle, _
Color.Red, Color.Yellow, Drawing2D.LinearGradientMode.Horizontal)

// C#
System.Drawing.Drawing2D.LinearGradientBrush myBrush = new
System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle,
Color.Red, Color.Yellow, System.Drawing.Drawing2D.
LinearGradientMode.Horizontal);

// C++
System::Drawing::Drawing2D::LinearGradientBrush* myBrush = new
System::Drawing::Drawing2D::LinearGradientBrush(ClientRectangle,
Color::Red, Color::Yellow, System::Drawing::Drawing2D::
LinearGradientMode::Horizontal);
创建显示文本要使用的字体。例如:
' Visual Basic
Dim myFont as New Font("Times New Roman", 24)

// C#
Font myFont = new Font("Times New Roman", 24);

// C++
System::Drawing::Font* myFont =
new System::Drawing::Font(S"Times New Roman", 24);
调用 Graphics 对象的 Graphics.DrawString 方法来呈现文本。
如果提供 RectangleF 对象,则文本将在矩形中换行。
否则,文本将从您提供的起始坐标处开始。
' Visual Basic
g.DrawString("Look at this text!", myFont, myBrush, New _
RectangleF(10, 10, 100, 200))
g.DrawString("Look at this text!", myFont, myBrush, 10, 10)

// C#
g.DrawString("Look at this text!", myFont, myBrush, new
RectangleF(10, 10, 100, 200));
g.DrawString("Look at this text!", myFont, myBrush, 10, 10);

// C++
g->DrawString(S"Look at this text!", myFont, myBrush,
RectangleF(10, 10, 100, 200));
g->DrawString(S"Look at this text!", myFont, myBrush, 10, 10);
孟子E章 2004-07-25
  • 打赏
  • 举报
回复
http://dotnet.aspx.cc/ShowDetail.aspx?id=221BC601-1A1B-4E1F-883D-04B043659703

??
张海霖 2004-07-25
  • 打赏
  • 举报
回复
没用过,关注。

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧