Abhinaba Basu's blog post Animation and Text in System tray using C# açıklar.
Bu gelir: bir animasyon çerçeve temsil her biri simgeler bir dizi yapım
- . Zamanlayıcı olayları tepsiye simgeler anahtarlama
- bir bitmap şeridi oluşturmak. Her bir çerçeve olup 16x16 piksel
- kullanımı SysTray.cs
ör
private void button1_Click(object sender, System.EventArgs e)
{
m_sysTray.StopAnimation();
Bitmap bmp = new Bitmap("tick.bmp");
// the color from the left bottom pixel will be made transparent
bmp.MakeTransparent();
m_sysTray.SetAnimationClip(bmp);
m_sysTray.StartAnimation(150, 5);
}
SetAnimationClip
çerçeve StartAnimation
bir zamanlayıcıyı başlatır ve zamanlayıcı simgeler bütün sekansı animasyon değiştirilir canlandırmak için animasyon çerçeve
public void SetAnimationClip (Bitmap bitmapStrip)
{
m_animationIcons = new Icon[bitmapStrip.Width/16];
for (int i = 0; i < m_animationIcons.Length; i++)
{
Rectangle rect = new Rectangle(i*16, 0, 16, 16);
Bitmap bmp = bitmapStrip.Clone(rect, bitmapStrip.PixelFormat);
m_animationIcons[i] = Icon.FromHandle(bmp.GetHicon());
}
}
oluşturmak için aşağıdaki kodu kullanır . Tepside statik göstermek istiyorum bir simge alın oluşturun ve tel yukarı menünüzü
ContextMenu m_menu = new ContextMenu();
m_menu.MenuItems.Add(0, new MenuItem("Show",new
System.EventHandler(Show_Click)));
Systray kullanma
public void StartAnimation(int interval, int loopCount)
{
if(m_animationIcons == null)
throw new ApplicationException("Animation clip not set with
SetAnimationClip");
m_loopCount = loopCount;
m_timer.Interval = interval;
m_timer.Start();
}
private void m_timer_Tick(object sender, EventArgs e)
{
if(m_currIndex < m_animationIcons.Length)
{
m_notifyIcon.Icon = m_animationIcons[m_currIndex];
m_currIndex++;
}
....
}
.
m_sysTray = new SysTray("Right click for context menu",
new Icon(GetType(),"TrayIcon.ico"), m_menu);
animasyon kare görüntü bantları oluşturmak gerekli tüm bilgiler ile bir SysTray nesne. 6 çerçeve şerit için görüntü döngü animasyon ve çerçeve gecikmesi
m_sysTray.StartAnimation(150, 5);
için ihtiyaç kaç kez gösteren 16 piksel
Bitmap bmp = new Bitmap("tick.bmp");
// the color from the left bottom pixel will be made transparent
bmp.MakeTransparent();
m_sysTray.SetAnimationClip(bmp);
Başlangıç animasyon olarak 6 x 16 genişlik ve yüksekliğe sahip olacak
m_sysTray.StopAnimation();
o yazı hakkında yorum kontrol ettiğinizden emin olun animasyon çağrıyı durdurmak: "Benim :(kodunda birçok sızıntı var yazıklar" (http://blogs.msdn.com/b/abhinaba/archive/2005/09/12/animasyon ve metin-in-sistem tepsisi-c kullanarak. aspx # 504147) –