有关将表格更改为全屏模式的问题,但我的表格闪烁 [英] Question about change form to full screen mode but my form flashing
问题描述
现在.我已将Visual Studio 2008中的表单设置为全屏,方法是将WindowState最大化,并将FormBorderStyle更改为None,然后将我的图像设置为背景图像
和backgroundcolor我设置为白色
当我将BackgroundimageLayout更改为可拉伸时会发生问题,因为当我编译我的程序时速度会变慢,但是当我将BackgroundimageLayout更改为拉伸时我的程序会更快,但问题出在这里我的程序显示在我的backgroundimage和backgroundcolor之间闪烁
谁能帮我解决这个问题
附言对不起,我的英语我对英语不好.
非常感谢您.
Now.I''ve set my form in visual studio 2008 to full screen by fix WindowState to maximized and change FormBorderStyle to None and i''ve my image to set background image
and backgroundcolor i''m set to white color
the problem was happen when i''ve change BackgroundimageLayout to stretch that i''ve change because when i''ve complie my program is to slow but when i''ve change BackgroundimageLayout to stretch my program is faster but the problem was here my programdisplay was flashing between my backgroundimage and backgroundcolor
Can anyone help me to fix this problem
Ps. Sorry for my english i''m not good for english
thank you very much
推荐答案
要闪烁飞行,您需要使用双缓冲.对于表单,请使用System.Windows.Forms.From.DoubleBuffered
属性, http://msdn .microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx [ http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. windows.forms.controlstyles.aspx [ ^ ].
您可以将Form
以及Control
一起使用此方法.
如果您的代码很慢,那么您肯定做错了什么(双重缓冲只会使它变慢一点),但是如果没有一些代码示例就很难说明这个问题.
—SA
To flight flashing, you need to use double buffering. For a form, please useSystem.Windows.Forms.From.DoubleBuffered
property, http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx[^].
It can practically eliminate flashing.
If you have flashing with some other control, you need to sub-class such control in order to get access to a protected methodSystem.Windows.Forms.Control.SetStyle
. You would need to add the stylesControlStyles.OptimizedDoubleBuffer
|ControlStyles.AllPaintingInWmPaint
.
Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.controlstyles.aspx[^].
You can use this method with theForm
as well as it isControl
.
If you code is slow, you must be doing something wrong (double buffering can only made it a little bit slower), but it''s hard to say anything without some code sample to manifest this problem.
—SA
这篇关于有关将表格更改为全屏模式的问题,但我的表格闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!