且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在运行时绘制图片框?

更新时间:2023-12-06 15:31:40

在方法运行时未显示更改的原因是主线程正在忙于运行该方法,因此它没有监听消息.更新以放置在消息队列中的消息的形式发生,因此,当主线程无法处理消息时,就不会有更新.

The reason that the changes doesn't show up whlie the method is running, is that the main thread is busy running the method so it's not listening to messages. The updates happens in the form of messages that are placed on the message queue, so when the main thread can't handle the messages, there are no updates.

您可以使用Refresh方法在该方法的中间强制重绘控件:

You can use the Refresh method to force a redraw of the control while in the middle of the method:

pictureBox2.Size = smal1.Size;
pictureBox2.Image = smal1;
pictureBox2.Refresh();