将Windows标签移动为选框文本 [英] Moving a Windows Label as Marquee text
本文介绍了将Windows标签移动为选框文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Windows应用程序中的标签中移动一个窗口标签。
是否可能,如果是,那么如何?
我在VB中看过它
解决方案
这样的东西:
AC#滚动文本控制 [ ^ ]
干杯
设置label.Left和label.Top属性
问候
Espen Harlinn
< blockquote>
class MarqueeLabel:Label
{
private int CurrentPosition {get;组; }
私人定时器计时器{get;组; }
public MarqueeLabel()
{
UseCompatibleTextRendering = true;
Timer = new Timer();
Timer.Interval = 25;
Timer.Tick + = new EventHandler(Timer_Tick);
Timer.Start();
}
void Timer_Tick(对象发送者,EventArgs e)
{
if(CurrentPosition> Width)
CurrentPosition = -Width;
else
CurrentPosition + = 2;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.TranslateTransform((float)CurrentPosition,0);
base.OnPaint(e);
}
protected override void Dispose(bool disposing)
{
if(disposing)
{
if(Timer!= null)
Timer.Dispose();
}
Timer = null;
}
}
希望它有所帮助......
作者:Yatheesh Achar Kumble
>
I want to move a window label in label in windows application.
Is it possible, if yes then how?
I have seen it in VB
解决方案
Something like this :
A C# Scrolling Text Control[^]
Cheers
Set the label.Left and label.Top properties
Regards
Espen Harlinn
class MarqueeLabel: Label { private int CurrentPosition { get; set; } private Timer Timer { get; set; } public MarqueeLabel() { UseCompatibleTextRendering = true; Timer = new Timer(); Timer.Interval = 25; Timer.Tick += new EventHandler(Timer_Tick); Timer.Start(); } void Timer_Tick(object sender, EventArgs e) { if (CurrentPosition > Width) CurrentPosition = -Width; else CurrentPosition += 2; Invalidate(); } protected override void OnPaint(PaintEventArgs e) { e.Graphics.TranslateTransform((float)CurrentPosition, 0); base.OnPaint(e); } protected override void Dispose(bool disposing) { if (disposing) { if (Timer != null) Timer.Dispose(); } Timer = null; } } Hope it helps... By Yatheesh Achar Kumble
这篇关于将Windows标签移动为选框文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文