Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using Timer = System.Timers.Timer;
- namespace R716IconoAnimadoBandejaSistema
- {
- public partial class Principal : Form
- {
- private Icon[] imagenes;
- private Timer temporizador;
- private int contadorImagenes;
- public Principal()
- {
- InitializeComponent();
- imagenes = new Icon[8];
- temporizador = new Timer();
- temporizador.Enabled = true;
- temporizador.Interval = 1000D;
- temporizador.SynchronizingObject = this;
- temporizador.Elapsed += new System.Timers.ElapsedEventHandler(temporizador_Elapsed);
- inicializarIconNotificacion();
- }
- private void inicializarIconNotificacion()
- {
- // Creación menú contextual:
- ContextMenuStrip cmsMenuContextual = new ContextMenuStrip();
- cmsMenuContextual.Items.AddRange(new ToolStripItem[]
- {
- new ToolStripMenuItem("Más info"),
- new ToolStripSeparator(),
- new ToolStripMenuItem("Salir")
- });
- nicBandejaSistema.ContextMenuStrip = cmsMenuContextual;
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- imagenes[0] = new Icon("Resources/MOON01.ICO");
- imagenes[1] = new Icon("Resources/MOON02.ICO");
- imagenes[2] = new Icon("Resources/MOON03.ICO");
- imagenes[3] = new Icon("Resources/MOON04.ICO");
- imagenes[4] = new Icon("Resources/MOON05.ICO");
- imagenes[5] = new Icon("Resources/MOON06.ICO");
- imagenes[6] = new Icon("Resources/MOON07.ICO");
- imagenes[7] = new Icon("Resources/MOON08.ICO");
- }
- private void temporizador_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
- {
- nicBandejaSistema.Icon = imagenes[contadorImagenes];
- ++contadorImagenes;
- if (contadorImagenes > 7)
- {
- contadorImagenes = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement