以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]切换页面跳动的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=50193)

--  作者:花开的声音
--  发布时间:2014/5/1 0:07:00
--  [求助]切换页面跳动的问题
在TabControl 控件的两个页面分别放置panel1和panel2两个控件,用下面的代码为两个控件的背景图片,在TabControl的两个页面之间切换时,图片抖动比较严重,有没有什么好的办法解决。
 
e.Form.Controls("panel1").BaseControl.BackGroundImage = getImage(projectPath & "Images\\第一面.bmp")
e.form.controls("panel1").basecontrol.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch
e.Form.Controls("panel2").BaseControl.BackGroundImage = getImage(projectPath & "Images\\第三面.bmp")
e.form.controls("panel2").basecontrol.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch

--  作者:ybil
--  发布时间:2014/5/1 8:18:00
--  
试试加入停止绘制  及  恢复绘制代码
--  作者:lsy
--  发布时间:2014/5/1 8:47:00
--  
外甥打灯笼──照旧(舅)。
--  作者:花开的声音
--  发布时间:2014/5/1 9:11:00
--  
谢谢那么早回复,就是原来那个已经处理好的窗口中,右上放底图的页面控件里面,再套加了一个页面,这次放的底图比原来的大,在切换页面时底图跳动很明显,可能以前那个也跳,但底图小可能没有那么明显。我先弄下看,不行再请教了。
--  作者:逛逛
--  发布时间:2014/5/1 11:04:00
--  

加载窗口(AfterLoad)时加上

 

 

Dim p1 As WinForm.Panel = e.Form.Controls("Panel1")
Dim p2 As WinForm.Panel = e.Form.Controls("Panel2")
p1.baseControl.Gettype().GetProperty("DoubleBuffered",  Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic).SetValue(p1.baseControl,True,Nothing)
p2.baseControl.Gettype().GetProperty("DoubleBuffered",  Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic).SetValue(p2.baseControl,True,Nothing)

 

\'**使用双缓存

试试


--  作者:lsy
--  发布时间:2014/5/1 11:52:00
--  
以下是引用逛逛在2014-5-1 11:04:00的发言:

加载窗口(AfterLoad)时加上

 

 

Dim p1 As WinForm.Panel = e.Form.Controls("Panel1")
Dim p2 As WinForm.Panel = e.Form.Controls("Panel2")
p1.baseControl.Gettype().GetProperty("DoubleBuffered",  Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic).SetValue(p1.baseControl,True,Nothing)
p2.baseControl.Gettype().GetProperty("DoubleBuffered",  Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic).SetValue(p2.baseControl,True,Nothing)

 

\'**使用双缓存

试试

可行性报告,结论如下:

 

效益可观。


--  作者:花开的声音
--  发布时间:2014/5/1 22:33:00
--  
按5楼的试了,效果没得说的呵,非常不错。