掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
PictureBoxの画像明るさ変更 (ID:125457)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
詳しい説明はHelpを参照願いたいのだが、.NETにはαブレンドなる便利な 機能があるのです Dim Alpha As Integer = 100 'この値を変えてみる Dim MyRec As New Rectangle(0, 0, PictureBox1.Width, PictureBox1.Height) Dim Mybrush As Brush = New SolidBrush(Color.FromArgb(Alpha, 255, 255, 255)) Dim f As New Font("MS Pゴシック", 12) PictureBox1.Image = New Bitmap(Application.StartupPath & "\1.jpg") Dim g As Graphics = Graphics.FromImage(PictureBox1.Image) g.FillRectangle(Mybrush, MyRec) g.DrawString("秋の夜長", f, Brushes.Black, 0, 240) Mybrush.Dispose() g.Dispose() f.Dispose() この他にも、ColorMatrixを使用した方法もある。 Dim g As Graphics = PictureBox1.CreateGraphics() Dim img As Image = Image.FromFile(Application.StartupPath & "\1.jpg") Dim Cmatrix As New System.Drawing.Imaging.ColorMatrix Cmatrix.Matrix33 = 0.2F 'この値を変えてみる Dim ImageAtt As New System.Drawing.Imaging.ImageAttributes ImageAtt.SetColorMatrix(Cmatrix) g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, ImageAtt) Dim f As New Font("MS Pゴシック", 12) g.DrawString("秋の夜長", f, Brushes.Black, 0, 240) f.Dispose() img.Dispose() g.Dispose()
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.