改变形式的背景 [英] change background of form
本文介绍了改变形式的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过imagelist在表单加载时随机更改背景图片
但是如何..............
i want to change background image randomly on form load through imagelist
but how..............
推荐答案
还不够: http:// msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx [ ^ ]?
如果你需要什么更复杂,只需渲染表单表面的任何内容,覆盖虚拟方法System.Windows.Forms.Control.OnPaint
或处理表单的事件油漆
。如果图像应不时更改,请更改渲染中使用的数据(例如,图像列表中的图像索引)并调用System.Windows.Forms.Control.Invalidate
。
-SA
Isn't that enough: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx[^]?
If you need something more sophisticated, simply render whatever your want of the surface of the form overriding the virtual methodSystem.Windows.Forms.Control.OnPaint
or handling the form's eventPaint
. If the image should change from time to time, change the data used in rendering (index of the image in the image list, for example) and callSystem.Windows.Forms.Control.Invalidate
.
—SA
这篇关于改变形式的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文