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