PictureBoxをPaintイベントを利用して描画したいのですが、難しいです。
Refresh();メゾットを呼び出しているのにも関わらず、Paintイベントが実行しません。
どこら辺が間違っているかご指摘お願いします。
public
1 2 private Image[] img=new Image[3]; 3 4 private Bitmap fore, back; 5 6 private int x, y; 7 8 public ObjectDraw() 9 10 { 11 12 img[0] = Image.FromFile(@"あ.png"); 13 14 Refresh(); 15 16 } 17 18 public override void PictureBox1_Paint(PaintEventArgs e) 19 20 { 21 22 base.PictureBox1_Paint(e); 23 e.Graphics.DrawImage(back, x, y); 24 e.Graphics.DrawImage( 25 fore, back.Width / 2 - fore.Width / 2, 26 back.Height / 2 - fore.Height / 2 27 ); 28 29 30 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/16 13:59
2019/04/17 02:56