Drawing Graphics Disappear in VB.net

后端 未结 4 1416
后悔当初
后悔当初 2021-01-21 03:39

I have a simple program that you can draw on the screen with FillEllipse and FillRectangle. My problem is that when you drag another window over even a small portion of the scre

4条回答
  •  醉话见心
    2021-01-21 04:08

    You can put a PictureBox control on your form and draw to that instead and it won't be erased when other windows paint over it:

    do this once, on form_load or something:

    pictureBox1.Image = new Bitmap(Width, Height);
    

    to draw:

    Graphics.FromImage(pictureBox1.Image).FillRectangle(Brushes.Black, 0, 0, 100, 100);
    pictureBox1.Refresh();
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题