using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SixGroup_Knowledge.PopView
{
    public partial class MessageForm : Form
    {
        protected MessageForm()
        {
            InitializeComponent();
        }

        private static int winWidth = Screen.PrimaryScreen.Bounds.Width;
        private static int winHeight = Screen.PrimaryScreen.Bounds.Height;

        private static Color error = Color.FromArgb(235, 50, 50);
        private static Color defaultColor = Color.FromArgb(95,95,95);

        public static Color ERROR
        {
            get { return error; }
        }
        public static Color DEFAULT
        {
            get { return defaultColor; }
        }

        public static void show(String Msg)
        {
            MessageForm msgForm = new MessageForm();
            msgForm.textBox1.Text = Msg;
            msgForm.textBox1.ForeColor = DEFAULT;
            msgForm.Show();
        }

        public static void show(String Msg,Color color)
        {
            MessageForm msgForm = new MessageForm();
            msgForm.textBox1.Text = Msg;
            msgForm.textBox1.ForeColor = color;
            msgForm.Show();
        }

        private int tickNum = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            tickNum++;
            if (tickNum >= 30)
            {
                this.timer1.Enabled = false;
                this.Close();
            }
            this.Location = new Point(this.Location.X,this.Location.Y-4);
        }

        private void MessageForm_Load(object sender, EventArgs e)
        {
            this.timer1.Enabled = true;
            this.Location = new Point(winWidth - 300, winHeight - 100);
        }
    }
}
