以下是引用nothing在2015/5/29 17:09:00的发言:
逛逛老师能帮忙做个示例不
Table如何设置背景图,如何动态生成图片(如何加字,内容是当天的日期)
选择也是很麻烦的事
Dim w As Integer = 200
Dim h As Integer = 100
Dim angle As Double = 45
Dim a As Double = angle Mod 360
Dim radian As Double = a * Math.PI / 180.0
Dim cos As Double = Math.Cos(radian)
Dim sin As Double = Math.Sin(radian)
Dim newW As Integer = Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin))
Dim newH As Integer = Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos))
Dim bmpSrc As new Bitmap(newW, newH)
Dim g = Graphics.FromImage(bmpSrc)
'g.FillRectangle(Brushes.Red,0,0,newW,newH)
g.TranslateTransform(newW/2, newH/2)
g.RotateTransform(angle)
g.TranslateTransform(-newW/2, -newH/2)
Dim x As Integer = (newW-w)/2
Dim y As Integer = (newH-h)/2
Dim fnt As New Font("宋体",16)
Dim msg As String = "I Like Foxtable"
g.DrawString(msg,fnt,Brushes.Red,x,y)
bmpSrc.Save("d:\test2.jpg")
g.Dispose()
bmpSrc.Dispose