类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
小弟对.net不是很熟悉,想实现在一个Picturebox或其他控件中文字的旋转一个角度显示,
在VB6里面要用API,创建一个字体,好像比较繁琐,请问在VB.net里面怎么实现,最好给一个简单
点的办法。
网友回答:
用gdi+可能吧。up一下。
具体没做过
思路应该是绘图到g,然后旋转。
关注ing!没搞过,帮你UP!
如果是比较小的图片可以计算象素来处理。
Private Sub btnDrawText_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnDrawText.Click
Static angle As Long Angle in degrees.
Make a GraphicsPath that draws the text
at (150, 150).
Dim graphics_path As New _
GraphicsPath(Drawing.Drawing2D.FillMode.Winding)
graphics_path.AddString("Hello", _
New FontFamily("Times New Roman"), _
FontStyle.Bold, 40, _
New Point(150, 150), _
StringFormat.GenericDefault)
Make a rotation matrix representing
rotation around the point (150, 150).
Dim rotation_matrix As New Matrix()
angle += 20
rotation_matrix.RotateAt(angle, New PointF(150, 150))
Transform the GraphicsPath.
graphics_path.Transform(rotation_matrix)
Draw the text.
With Me.CreateGraphics
.Clear(Me.BackColor)
.FillPath(Brushes.Black, graphics_path)
End With
End Sub
http://www.vb-helper.com/HowTo/howto_net_rotated_text.zip
这个复杂了
还是用图片方便