Adding basic display functions: open, close, clear, fill, brightness control.
2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10 using CodeProject.Dialog;
12 namespace SharpDisplayManager
14 public partial class MainForm : Form
16 DateTime LastTickTime;
21 LastTickTime = DateTime.Now;
22 iDisplay = new Display();
24 InitializeComponent();
27 private void buttonFont_Click(object sender, EventArgs e)
29 //fontDialog.ShowColor = true;
30 //fontDialog.ShowApply = true;
31 fontDialog.ShowEffects = true;
32 //fontDialog.ShowHelp = true;
34 //fontDlg.MaxSize = 40;
35 //fontDlg.MinSize = 22;
37 //fontDialog.Parent = this;
38 //fontDialog.StartPosition = FormStartPosition.CenterParent;
40 //DlgBox.ShowDialog(fontDialog);
42 //if (fontDialog.ShowDialog(this) != DialogResult.Cancel)
43 if (DlgBox.ShowDialog(fontDialog) != DialogResult.Cancel)
46 MsgBox.Show("MessageBox MsgBox", "MsgBox caption");
48 //MessageBox.Show("Ok");
49 //textBox1.Font = fontDlg.Font;
50 //label1.Font = fontDlg.Font;
51 //textBox1.BackColor = fontDlg.Color;
52 //label1.ForeColor = fontDlg.Color;
56 private void buttonCapture_Click(object sender, EventArgs e)
58 System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height);
59 tableLayoutPanel.DrawToBitmap(bmp, tableLayoutPanel.ClientRectangle);
60 bmp.Save("c:\\capture.png");
63 private void timer_Tick(object sender, EventArgs e)
65 //Update our animations
66 DateTime NewTickTime = DateTime.Now;
68 marqueeLabelTop.UpdateAnimation(LastTickTime, NewTickTime);
69 marqueeLabelBottom.UpdateAnimation(LastTickTime, NewTickTime);
71 LastTickTime = NewTickTime;
74 private void buttonOpen_Click(object sender, EventArgs e)
78 trackBarBrightness.Minimum = iDisplay.MinBrightness();
79 trackBarBrightness.Maximum = iDisplay.MaxBrightness();
84 private void buttonClose_Click(object sender, EventArgs e)
89 private void buttonClear_Click(object sender, EventArgs e)
92 iDisplay.SwapBuffers();
95 private void buttonFill_Click(object sender, EventArgs e)
98 iDisplay.SwapBuffers();
101 private void trackBarBrightness_Scroll(object sender, EventArgs e)
103 iDisplay.SetBrightness(trackBarBrightness.Value);