我的表格具有MenuStrip
和PictureBox
。我使用以下代码订阅PictureBox
的Paint
事件:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
// other code but the above line demonstrates the problem
}
由于某些原因,这会导致MenuStrip
变为白色 - 直到我徘徊在盘旋上之前,我才能看到文本,即使PictureBox
完全没有重叠MenuStrip
。我可以在上面的函数末尾放置一个menuStrip1.Update()
,但这会导致其他问题。
,而不是在事件中直接分配给PictureBox
,请使用提供的PaintEventArgs
进行任何图纸。
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(Color.Gray);
}