示例#1
0
        private void PicClose_MouseClick(object sender, MouseEventArgs e)
        {
            //DialogResult dr = MessageBox.Show("Are you sure to exit system?", "Warning!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            DialogResult dr = ZKMessgeBox.Show("Exit the program?", "Warning!", ZKMessgeBox.I8Buttons.OKCancel);

            if (dr == DialogResult.OK)
            {
                SDK.sta_DisConnect();
                Application.Exit();
            }
        }
示例#2
0
        static private void BuildMessageBox(string title)
        {
            newMessageBox                 = new ZKMessgeBox();
            newMessageBox.Text            = title;
            newMessageBox.Size            = new System.Drawing.Size(400, 200);
            newMessageBox.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
            newMessageBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            newMessageBox.Paint          += new PaintEventHandler(newMessageBox_Paint);
            newMessageBox.BackColor       = System.Drawing.Color.White;

            TableLayoutPanel tlp = new TableLayoutPanel();

            tlp.RowCount    = 3;
            tlp.ColumnCount = 0;
            tlp.Dock        = System.Windows.Forms.DockStyle.Fill;
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50));
            tlp.BackColor = System.Drawing.Color.Transparent;
            tlp.Padding   = new Padding(2, 5, 2, 2);

            frmTitle           = new Label();
            frmTitle.Dock      = System.Windows.Forms.DockStyle.Fill;
            frmTitle.BackColor = System.Drawing.Color.Transparent;
            frmTitle.ForeColor = System.Drawing.Color.White;
            frmTitle.Font      = new Font("Tahoma", 9, FontStyle.Bold);
            //frmTitle.Click += new EventHandler(frmTitle_Click);
            frmTitle.MouseDown += new MouseEventHandler(frmTitle_MouseDown);
            frmTitle.MouseMove += new MouseEventHandler(frmTitle_MouseMove);
            frmTitle.MouseUp   += new MouseEventHandler(frmTitle_MouseUp);

            frmMessage           = new Label();
            frmMessage.AutoSize  = true;
            frmMessage.Size      = new Size(300, 100);
            frmMessage.Dock      = System.Windows.Forms.DockStyle.Fill;
            frmMessage.BackColor = System.Drawing.Color.White;
            frmMessage.Font      = new Font("Tahoma", 12, FontStyle.Regular);
            frmMessage.Text      = "hiii";
            frmMessage.Anchor    = System.Windows.Forms.AnchorStyles.None;
            //largeIcon = new IntPtr[250];
            //smallIcon = new IntPtr[250];
            //pIcon = new PictureBox();
            //ExtractIconEx("shell32.dll", 0, largeIcon, smallIcon, 250);
            flpButtons = new FlowLayoutPanel();
            flpButtons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
            flpButtons.Padding       = new Padding(0, 5, 5, 0);
            flpButtons.Dock          = System.Windows.Forms.DockStyle.Fill;
            //flpButtons.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
            flpButtons.BackColor = System.Drawing.Color.White;
            TableLayoutPanel tlpMessagePanel = new TableLayoutPanel();

            tlpMessagePanel.BackColor   = System.Drawing.Color.White;
            tlpMessagePanel.Dock        = System.Windows.Forms.DockStyle.Fill;
            tlpMessagePanel.ColumnCount = 0;
            tlpMessagePanel.RowCount    = 0;
            tlpMessagePanel.Padding     = new Padding(4, 5, 4, 4);
            //tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50));
            tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            //tlpMessagePanel.Controls.Add(pIcon);
            tlpMessagePanel.Controls.Add(frmMessage);
            tlp.Controls.Add(frmTitle);
            tlp.Controls.Add(tlpMessagePanel);
            tlp.Controls.Add(flpButtons);
            newMessageBox.Controls.Add(tlp);
        }