예제 #1
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex > 0 && e.RowIndex > -1)
     {
         LPTLCD lcd = dataGridView1.Rows[e.RowIndex].Tag as LPTLCD;
         if (lcd != null)
         {
             if (e.ColumnIndex == on.Index)
             {
                 lcd.On();
             }
             else if (e.ColumnIndex == off.Index)
             {
                 lcd.Off();
             }
             else if (e.ColumnIndex == clear.Index)
             {
                 lcd.Clear();
             }
         }
     }
 }
예제 #2
0
        private bool CheckLCDCharacter2(LPTLCD lcd, byte rows, byte columns)
        {
            bool jest = false;

            rows--;
            columns--;
            // sprawdzenie czy są zmienne, jeśli tak to ostrzeżenie o usunięciu zmiennych
            foreach (LPTLCDArea a in Configuration.Areas)
            {
                foreach (LCDCharacter c in a.Characters)
                {
                    if (c.Row > rows || c.Column > columns)
                    {
                        jest = true;
                        break;
                    }
                }
                if (jest)
                {
                    break;
                }
            }
            if (jest)
            {
                if (MessageBox.Show(this, "Zmiana konfiguracji tego wyświetlacza spowoduje usunięcie znaków tego wyświetlacza z obszarów, jeśli obszar składa się ze znaków tylko z tego wyświetlacza z ustalonej pozycji, to zostanie usunięty. Kontynuować ?", "Uwaga", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    // usunięcie znaków tego wyświetlacza
                    int index = 0;
                    foreach (LPTLCDArea a in Configuration.Areas)
                    {
                        List <LCDCharacter> cs = new List <LCDCharacter>(a.Characters);
                        index = cs.Count;
                        while (index-- > 0)
                        {
                            if (cs[index].Row > rows || cs[index].Column > columns)
                            {
                                cs.RemoveAt(index);
                            }
                        }
                        a.Set(cs.ToArray());
                    }
                    List <LPTLCDArea> aa = new List <LPTLCDArea>(Configuration.Areas);
                    index = aa.Count;
                    while (index-- > 0)
                    {
                        if (aa[index].Characters.Length == 0)
                        {
                            aa.RemoveAt(index);
                        }
                    }
                    Configuration.Areas = aa.ToArray();
                    ShowAreas();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
예제 #3
0
 public LPTLCDCharacter(LPTLCD lcd, byte row, byte column, int order)
     : base(lcd, row, column, order)
 {
 }