コード例 #1
0
ファイル: Program.cs プロジェクト: roydejong/MultiClip
 public static void ShowThreadSafeClipNotify(string text)
 {
     var th = new Thread(() =>
     {
         var form = new ClipNotifier(text);
         form.FormClosed += form_FormClosed;
         form.Show();
         Application.Run();
     });
     th.SetApartmentState(ApartmentState.STA);
     th.Start();
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: roydejong/MultiClip
        public static void ShowThreadSafeClipNotify(string text)
        {
            var th = new Thread(() =>
            {
                var form         = new ClipNotifier(text);
                form.FormClosed += form_FormClosed;
                form.Show();
                Application.Run();
            });

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
        }
コード例 #3
0
ファイル: ClipNotifier.cs プロジェクト: roydejong/MultiClip
        public ClipNotifier(string text)
        {
            InitializeComponent();

            try
            {
                if (notifier != null)
                {
                    notifier.Invoke(new Action(() => { notifier.Close(); }));
                }
            }
            catch (InvalidOperationException) { }

            notifier = this;

            Application.DoEvents();

            this.Text        = string.Empty;
            this.ControlBox  = false;
            this.label1.Text = text;

            pictureBox1.Left = 20;
            label1.Left     += pictureBox1.Width + 15;

            int sidePadding = 15;
            int iconPadding = 10;
            int totalWidth  = pictureBox1.Width + iconPadding + label1.Width + (sidePadding * 2);

            pictureBox1.Left = sidePadding;
            label1.Left      = pictureBox1.Right + iconPadding;

            this.Width       = totalWidth;
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.Opacity     = 0.95;

            this.Top  = Screen.PrimaryScreen.WorkingArea.Height - 150;
            this.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2);
            Region    = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));

            tt          = new Timer();
            tt.Tick    += tt_Tick;
            tt.Interval = 3000;
            tt.Enabled  = true;

            this.Load += ClipNotifier_Load;
        }
コード例 #4
0
ファイル: ClipNotifier.cs プロジェクト: roydejong/MultiClip
        public ClipNotifier(string text)
        {
            InitializeComponent();

            try
            {
                if (notifier != null)
                    notifier.Invoke(new Action(() => { notifier.Close(); }));
            }
            catch (InvalidOperationException) { }

            notifier = this;

            Application.DoEvents();

            this.Text = string.Empty;
            this.ControlBox = false;
            this.label1.Text = text;

            pictureBox1.Left = 20;
            label1.Left += pictureBox1.Width + 15;

            int sidePadding = 15;
            int iconPadding = 10;
            int totalWidth = pictureBox1.Width + iconPadding + label1.Width + (sidePadding * 2);

            pictureBox1.Left = sidePadding;
            label1.Left = pictureBox1.Right + iconPadding;

            this.Width = totalWidth;
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.Opacity = 0.95;

            this.Top = Screen.PrimaryScreen.WorkingArea.Height - 150;
            this.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2);
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));

            tt = new Timer();
            tt.Tick += tt_Tick;
            tt.Interval = 3000;
            tt.Enabled = true;

            this.Load += ClipNotifier_Load;
        }