動的画像作成(背景)  次の文書

Dim img As New System.Drawing.Bitmap(640, 650)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(img)
g.Clear(Color.Gray)

'単色ブラシ
Dim brush1 As New System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(&H90, &HD0, &HFF))

'グラデーションブラシ
Dim brush2 As New System.Drawing.Drawing2D.LinearGradientBrush(New System.Drawing.Point(0, 0), New System.Drawing.Point(img.Width - 1, img.Height - 1), Drawing.Color.Aqua, Drawing.Color.DarkBlue)

'Pen(一点鎖線)
Dim dashValues() As Single = {10, 2, 2, 2}
Dim dashPen As New System.Drawing.Pen(Drawing.Color.Red)
dashPen.DashPattern = dashValues
dashPen.Width = 1

'フォント(Arial, 11, Bold)
Dim font1 As New System.Drawing.Font("Arial", 12, Drawing.FontStyle.Bold)

With g
' 長方形塗りつぶし(単色ブラシ)
'.FillRectangle(brush1, 0, 0, img.Width, CInt(img.Height / 2))

' 長方形塗りつぶし(グラデーションブラシ)
.FillRectangle(brush2, 0, CInt(img.Height), img.Width, img.Height)

' 長方形(一点鎖線)
'.DrawRectangle(dashPen, 0, 0, img.Width - 1, img.Height - 1)

' 円弧(ラジアンではなく、度)
'.DrawArc(Drawing.Pens.Yellow, 1, 1, img.Width - 2 - 1, img.Height - 2 - 1, 0, 360)

' 文字列の描画
'.DrawString(W確認用値, font1, Drawing.Brushes.Black, 3, 2)
'.DrawString(W確認用値, font1, Drawing.Brushes.White, 0, 0)

Dim W増加値x As Integer = CInt(640 / 10) '高さ
Dim W値x As Integer = 0
Dim W増加値y As Integer = CInt(650 / 10) '幅
Dim W値y As Integer = 50
Dim Wi As Integer = 0
' 直線 (開始左から、開始上から、終了左から、終了上から)
For i = 1 To 10
Wi = Wi + 10
W値x = W値x + W増加値x
' 開始左,開始上,終了左,終了上)
.DrawLine(Drawing.Pens.White, 50, W値x - 50, 650, W値x - 50) 'X軸目盛線、-50は見出し用の空
.DrawString(max値x軸(i), font1, Drawing.Brushes.White, 10, W値x - 60) 'X軸目見出し盛

' 開始左,開始上,終了左,終了上)
.DrawLine(Drawing.Pens.White, W値y, 0, W値y, 640 - 50) 'Y軸目盛線、-50は見出し用の空白 
.DrawString(Wdd(Wi), font1, Drawing.Brushes.White, W値y, 600) 'Y軸目見出し盛
W値y = W値y + W増加値y
Next




End With

'
' イメージ転送(pngフォーマット)
'
Response.ContentType = "image/png"
Dim memStream As New System.IO.MemoryStream
img.Save(memStream, System.Drawing.Imaging.ImageFormat.Png)
memStream.WriteTo(Response.OutputStream)

参照サイトのページ
http://elfhbt.blog33.fc2.com/blog-entry-9.html

 




← 左の文字をここへ入力後 登録ボタンをクリックしてください

(サイト管理者承認後掲載されます)