MainForm.cs
author sl
Mon, 16 Jun 2014 12:18:46 +0200
changeset 2 f516c3f656bf
parent 0 f6eca6facd07
child 3 71b55cfd8c05
permissions -rw-r--r--
Adding OwnTimer property to marquee. This enables us to use an external timer
and thus use a single timer for multiple marquee.
     1 ´╗┐using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Threading.Tasks;
     9 using System.Windows.Forms;
    10 using CodeProject.Dialog;
    11 
    12 namespace SharpDisplayManager
    13 {
    14     public partial class MainForm : Form
    15     {
    16         DateTime LastTickTime;
    17 
    18         public MainForm()
    19         {
    20             LastTickTime = DateTime.Now;
    21 
    22             InitializeComponent();
    23         }
    24 
    25         private void buttonFont_Click(object sender, EventArgs e)
    26         {
    27             //fontDialog.ShowColor = true;
    28             //fontDialog.ShowApply = true;
    29             fontDialog.ShowEffects = true;
    30             //fontDialog.ShowHelp = true;
    31 
    32             //fontDlg.MaxSize = 40;
    33             //fontDlg.MinSize = 22;
    34 
    35             //fontDialog.Parent = this;
    36             //fontDialog.StartPosition = FormStartPosition.CenterParent;
    37 
    38             //DlgBox.ShowDialog(fontDialog);
    39 
    40             //if (fontDialog.ShowDialog(this) != DialogResult.Cancel)
    41             if (DlgBox.ShowDialog(fontDialog) != DialogResult.Cancel)
    42             {
    43 
    44                 MsgBox.Show("MessageBox MsgBox", "MsgBox caption");
    45 
    46                 //MessageBox.Show("Ok");
    47                 //textBox1.Font = fontDlg.Font;
    48                 //label1.Font = fontDlg.Font;
    49                 //textBox1.BackColor = fontDlg.Color;
    50                 //label1.ForeColor = fontDlg.Color;
    51             }
    52         }
    53 
    54         private void buttonCapture_Click(object sender, EventArgs e)
    55         {
    56             System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height);
    57             tableLayoutPanel.DrawToBitmap(bmp, tableLayoutPanel.ClientRectangle);
    58             bmp.Save("c:\\capture.png");
    59         }
    60 
    61         private void timer_Tick(object sender, EventArgs e)
    62         {
    63             //Update our animations
    64             DateTime NewTickTime = DateTime.Now;
    65 
    66             marqueeLabelTop.UpdateAnimation(LastTickTime, NewTickTime);
    67             marqueeLabelBottom.UpdateAnimation(LastTickTime, NewTickTime);
    68 
    69             LastTickTime = NewTickTime;
    70         }
    71     }
    72 }