过渡标签:如Microsoft Office 2010初始屏幕 [英] Transitional Labels : Like Microsoft office 2010 Splash Screens

查看:141
本文介绍了过渡标签:如Microsoft Office 2010初始屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用C#.net 3.5,正在为我的应用程序设计启动画面.
我想要一些带有过渡的标签(如Microsoft OFfice 2010初始屏幕),以在启动应用程序时显示当前状态..

您可以在 ^ []

标签在启动屏幕上的行为是标签从屏幕的底部一直到屏幕的中半部分.我尝试通过设置其位置来设计它,但无法获得平滑过渡...

你能提出任何想法吗?


Prathamesh

Hi,
I am using C#.net 3.5, I am Desiging A Splash Screen for my Applications.
I Want to have some label with Transitions (Like Microsoft OFfice 2010 Splash Screen) to Display Current status while Starting the application..

You can find a sample image here ^[]

The behaviour of label on the splash screen is the labels come from bottom till middle half of screen. I tried to design it, by setting its location but cant get SMOOTH Transitions...

Can you suggest any Idea?


Prathamesh

推荐答案

您没有显示代码.解决方案可能很简单:您需要为渲染图形的表单启用DoubleBuffering.如果这是除窗体以外的控件,则需要使用Control.SetStyle并添加以下System.Windows.Forms.ControlStylesBits:由于此方法受保护,因此只能在从Control派生的类中进行此操作.
现在,对于过渡,您最好在循环中使用单独的线程(BackgroundWorker会做得很好)并在循环中使用System.Threading.Thread.Sleep进行调用,以获取一些延迟.随着过渡的进行,每当您需要重新渲染图片时,都可以调用Control.Invalidate,还可以选择使用参数(RectangleRegion)来调用它,以仅重新渲染场景的一部分来优化图片. >
您无法从非UI线程调用与UI相关的任何操作.相反,您需要使用System.Windows.Threading.DispatcherInvokeBeginInvoke方法(对于Forms或WPF)或System.Windows.Forms.Control(仅对于Forms).

在我过去的答案中,您将找到有关其工作原理的详细说明和代码示例:
Control.Invoke()与Control.BeginInvoke() [ ^ ],
Treeview Scanner和MD5的问题 [如何获取keydown事件在vb.net中的不同线程上操作 [启用禁用+多线程后控件事件不会触发 [ ^ ].

—SA
You did not show your code. Probably the solution is simple: you need to enable DoubleBuffering for the form where you render your graphics. If this is a control other than form, you will need to use Control.SetStyle and add the following System.Windows.Forms.ControlStylesBits: System.Windows.Forms.ControlStylesBits.OptimizedDoubleBuffer | System.Windows.Forms.ControlStylesBits.AllPaintingInWmPaint; as this method is protected, you can do this only in a class derived from Control.

Now, for transition you should better use a separate thread (BackgroundWorker will do well) with System.Threading.Thread.Sleep call in the cycle, to get some delay. As transitions go, every time you need to re-render the picture, call Control.Invalidate, optionally with a parameter (Rectangle or Region) to optimize it by re-rendering only the part of the scene.

You cannot call anything related to UI from non-UI thread. Instead, you need to use the method Invoke or BeginInvoke of System.Windows.Threading.Dispatcher (for both Forms or WPF) or System.Windows.Forms.Control (Forms only).

You will find detailed explanation of how it works and code samples in my past answers:
Control.Invoke() vs. Control.BeginInvoke()[^],
Problem with Treeview Scanner And MD5[^].

See also more references on threading:
How to get a keydown event to operate on a different thread in vb.net[^],
Control events not firing after enable disable + multithreading[^].

—SA


在发生新情况时,可以使用秒表开始计时,然后在每次打勾时将单词向上移动到某个位置.这样,您可以使它随心所欲地移动.
Possibly use a stopwatch to start when something new happens, then with every tick it moves the words up until a certain spot. That way you can make it move however much as you want.


这篇关于过渡标签:如Microsoft Office 2010初始屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆