示例#1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                MobaLedLib.Update();

                for (byte i = 0; i < 64; i++)
                {
                    //int col = MobaLedLib.GetLedColor(i);
                    //labels[i].BackColor = Color.FromArgb(col&0xff, (col >> 8)&0xff, (col >> 16) & 0xff);
                    byte r, g, b;
                    r = Marshal.ReadByte(ledsPtr, i * 3);
                    g = Marshal.ReadByte(ledsPtr, i * 3 + 1);
                    b = Marshal.ReadByte(ledsPtr, i * 3 + 2);

                    r = ShiftColor(r);
                    g = ShiftColor(g);
                    b = ShiftColor(b);
                    //labels[i].BackColor = Color.FromArgb();
                    labels[i].BackColor = Color.FromArgb(r, g, b);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception " + ex.ToString(), "Timer execution failed");
                Application.Exit();
            }
        }
示例#2
0
 private void LedForm_Load(object sender, EventArgs e)
 {
     try
     {
         var config    = File.ReadAllBytes(@".\LEDConfigWithFire.bin");
         var l2vConfig = new byte[] { 1, 0, 3, 40 };
         ledsPtr         = MobaLedLib.CreateEx(config, config.Length, l2vConfig, l2vConfig.Length);
         timer1.Interval = 20;
         timer1.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.ToString(), "Program failed to start");
         Application.Exit();
     }
 }
示例#3
0
 private void button3_Click(object sender, EventArgs e)
 {
     MobaLedLib.SetInput(0, 0);
 }
示例#4
0
 private void button4_Click(object sender, EventArgs e)
 {
     MobaLedLib.CloseLEDWindow();
 }
示例#5
0
 private void button1_Click(object sender, EventArgs e)
 {
     MobaLedLib.ShowLEDWindow(16, 16, 48, 1, 100, 100, true);
 }