MainForm.cs
changeset 9 7c363a7a975e
parent 8 5129c03ab7ba
child 10 54671755add3
     1.1 --- a/MainForm.cs	Tue Jul 08 18:59:07 2014 +0200
     1.2 +++ b/MainForm.cs	Tue Jul 08 20:02:12 2014 +0200
     1.3 @@ -26,6 +26,7 @@
     1.4              //Load settings
     1.5              marqueeLabelTop.Font = Properties.Settings.Default.DisplayFont;
     1.6              marqueeLabelBottom.Font = Properties.Settings.Default.DisplayFont;
     1.7 +            checkBoxShowBorders.Checked = Properties.Settings.Default.DisplayShowBorders;
     1.8          }
     1.9  
    1.10          private void buttonFont_Click(object sender, EventArgs e)
    1.11 @@ -89,7 +90,7 @@
    1.12                          unchecked
    1.13                          {
    1.14                          uint color=(uint)bmp.GetPixel(i, j).ToArgb();
    1.15 -                        iDisplay.SetPixel(i, j, Convert.ToInt32(color!=0xFFFFFFFF));
    1.16 +                        iDisplay.SetPixel(i, j, Convert.ToInt32((checkBoxShowBorders.Checked?color!=0xFFFFFFFF:color == 0xFF000000)));
    1.17                          }
    1.18                      }
    1.19                  }
    1.20 @@ -122,6 +123,7 @@
    1.21          private void buttonClose_Click(object sender, EventArgs e)
    1.22          {
    1.23              iDisplay.Close();
    1.24 +            UpdateStatus();
    1.25          }
    1.26  
    1.27          private void buttonClear_Click(object sender, EventArgs e)
    1.28 @@ -138,7 +140,10 @@
    1.29  
    1.30          private void trackBarBrightness_Scroll(object sender, EventArgs e)
    1.31          {
    1.32 +            Properties.Settings.Default.DisplayBrightness = trackBarBrightness.Value;
    1.33 +            Properties.Settings.Default.Save();
    1.34              iDisplay.SetBrightness(trackBarBrightness.Value);
    1.35 +
    1.36          }
    1.37  
    1.38          private void UpdateStatus()
    1.39 @@ -151,7 +156,12 @@
    1.40                  buttonClose.Enabled = true;
    1.41                  trackBarBrightness.Enabled = true;
    1.42                  trackBarBrightness.Minimum = iDisplay.MinBrightness();
    1.43 -                trackBarBrightness.Maximum = iDisplay.MaxBrightness();
    1.44 +                trackBarBrightness.Maximum = iDisplay.MaxBrightness();                
    1.45 +                trackBarBrightness.Value = Properties.Settings.Default.DisplayBrightness;
    1.46 +                trackBarBrightness.LargeChange = Math.Max(1,(iDisplay.MaxBrightness() - iDisplay.MinBrightness())/5);
    1.47 +                trackBarBrightness.SmallChange = 1;
    1.48 +                iDisplay.SetBrightness(Properties.Settings.Default.DisplayBrightness);
    1.49 +
    1.50                  toolStripStatusLabelConnect.Text = "Connected";
    1.51              }
    1.52              else
    1.53 @@ -161,8 +171,14 @@
    1.54                  buttonOpen.Enabled = true;
    1.55                  buttonClose.Enabled = false;
    1.56                  trackBarBrightness.Enabled = false;
    1.57 -                toolStripStatusLabelConnect.Text = "Not connected";
    1.58 +                toolStripStatusLabelConnect.Text = "Disconnected";
    1.59              }
    1.60          }
    1.61 +
    1.62 +        private void checkBoxShowBorders_CheckedChanged(object sender, EventArgs e)
    1.63 +        {
    1.64 +            Properties.Settings.Default.DisplayShowBorders = checkBoxShowBorders.Checked;
    1.65 +            Properties.Settings.Default.Save();
    1.66 +        }
    1.67      }
    1.68  }