午後わてんのブログ

ベランダ菜園とWindows用アプリ作成(WPFとC#)

お問い合わせ先のお問い合わせがあるといいなあ

昨日の続きで2色グラデーションの色の問題で
ここに載っているのも試してみたけど、やっぱり期待通りにならない

Imports System.Drawing.Drawing2D
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim linGrBrush As New LinearGradientBrush( _
           New Point(0, 10), _
           New Point(200, 10), _
           Color.FromArgb(255, 255, 0, 0), _
           Color.FromArgb(255, 0, 0, 255))
        Dim pen As New Pen(linGrBrush)
        Dim bmp As New Bitmap(Me.PictureBox1.Width, Me.PictureBox1.Height)
        Dim g As Graphics = Graphics.FromImage(bmp)
        g.DrawLine(pen, 0, 10, 200, 10)
        g.FillEllipse(linGrBrush, 0, 30, 200, 100)
        g.FillRectangle(linGrBrush, 0, 155, 500, 30)
        Me.PictureBox1.Image = bmp
        bmp.Save("c:\png\ms.png", System.Drawing.Imaging.ImageFormat.Png)
    End Sub
End Class
ほとんどコピペして出来上がった画像を保存してPixtackで開いてみたとろこ

f:id:gogowaten:20191014115400p:plain

 一番右のピクセルの色を取得してみたけど期待通りの正しい色ではない
指定した色はRGBだと0,0,255なのに1,0,254になっている
反対側の赤は指定したとおり255,0,0になっている
 
質問してみようかとさっきのページからお問い合わせ先をクリックして進んでいったんだけど詰んだ

f:id:gogowaten:20191014115447p:plain

 どれに当てはまるのかわからない
その時はその他を選択してとあるけどその他がない