1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace appHeure1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label etHeure;
private System.ComponentModel.IContainer components;
private Boolean begMove=false;
private Rectangle rec;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.etHeure = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
this.etHeure.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.etHeure.AutoSize = true;
this.etHeure.BackColor = System.Drawing.Color.White;
this.etHeure.Dock = System.Windows.Forms.DockStyle.Fill;
this.etHeure.Font = new System.Drawing.Font("Microsoft Sans Serif", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.etHeure.ForeColor = System.Drawing.Color.Green;
this.etHeure.Name = "etHeure";
this.etHeure.Size = new System.Drawing.Size(194, 49);
this.etHeure.TabIndex = 0;
this.etHeure.Text = "00:00:00";
this.etHeure.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.etHeure.MouseUp += new System.Windows.Forms.MouseEventHandler(this.goEndMove);
this.etHeure.DoubleClick += new System.EventHandler(this.goDblClick);
this.etHeure.MouseDown += new System.Windows.Forms.MouseEventHandler(this.goBeginMove);
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.goTimerTick);
this.AutoScaleBaseSize = new System.Drawing.Size(16, 38);
this.ClientSize = new System.Drawing.Size(186, 50);
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.etHeure});
this.Cursor = System.Windows.Forms.Cursors.NoMove2D;
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 19.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.White;
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void goTimerTick(object sender, System.EventArgs e)
{
DateTime tz = DateTime.Now;
etHeure.Text="["+tz.Hour+":"+tz.Minute+":"+tz.Second+"]";
}
private void goDblClick(object sender, System.EventArgs e)
{
Application.Exit();
}
private void goBeginMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
begMove=true;
rec=RectangleToScreen(Form1.ActiveForm.Bounds);
}
private void goEndMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if( begMove==true)
{
Rectangle rec1,rec2;
rec1=new Rectangle( e.X-10, e.Y-10, rec.Right-rec.Left, rec.Bottom - rec.Top);
rec2=RectangleToScreen(rec1);
Form1.ActiveForm.Bounds=rec2;
begMove=false;
}
}
}
} |
Partager