Exemplo n.º 1
0
 public static DialogResult AskYesNoCancel(IWin32Window pOwner, String pstrMsg, String pstrCaption, ExMessageBox.CYIcon icon)
 {
     return ExMessageBox.Show(pOwner, pstrMsg, pstrCaption, ExMessageBox.CYButtons.YesNoCancel, icon);
 }
Exemplo n.º 2
0
        private static void BuildMessageBox(string title)
        {
            newMessageBox = new ExMessageBox();
            newMessageBox.Text = title;
            newMessageBox.Size = new System.Drawing.Size(WIDTH, HEIGHT);
            newMessageBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            newMessageBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            newMessageBox.Paint += new PaintEventHandler(newMessageBox_Paint);
            newMessageBox.BackColor = System.Drawing.SystemColors.Control;             //DarkGray;
            newMessageBox.FormBorderStyle = FormBorderStyle.FixedToolWindow;

            TableLayoutPanel tlp = new TableLayoutPanel();
            tlp.RowCount = 3;
            tlp.ColumnCount = 1;
            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));
            //// thay toàn bộ màu của box=====
            tlp.BackColor = System.Drawing.SystemColors.Control;                           //DarkGray;
            //==============================
            tlp.Padding = new Padding(2, 5, 2, 2);

            frmTitle = new Label();
            frmTitle.Dock = System.Windows.Forms.DockStyle.Fill;
            frmTitle.BackColor = System.Drawing.Color.Transparent;              //Transparent;
            frmTitle.ForeColor = System.Drawing.Color.Transparent;
            frmTitle.Font = new Font("Tahoma", 9, FontStyle.Bold);

            frmMessage = new Label();
            frmMessage.Dock = System.Windows.Forms.DockStyle.Fill;
            frmMessage.BackColor = System.Drawing.Color.Transparent;                //Transparent;
            frmMessage.Font = new Font("Tahoma", 9, FontStyle.Regular);

            pIcon = new PictureBox();
            pIcon.Size = new Size(128, 128);
            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.SystemColors.Control;

            TableLayoutPanel tlpMessagePanel = new TableLayoutPanel();
            tlpMessagePanel.BackColor = System.Drawing.Color.Transparent;           //White;
            tlpMessagePanel.BackColor = System.Drawing.SystemColors.Control;           //White;
            tlpMessagePanel.Dock = System.Windows.Forms.DockStyle.Fill;
            tlpMessagePanel.ColumnCount = 2;
            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));
            pIcon.Image = imgIcon;
            pIcon.Size = new Size(64, 64);
            tlpMessagePanel.Controls.Add(pIcon);
            tlpMessagePanel.Controls.Add(frmMessage);

            tlp.Controls.Add(frmTitle);
            tlp.Controls.Add(tlpMessagePanel);
            tlp.Controls.Add(flpButtons);
            newMessageBox.Controls.Add(tlp);
            newMessageBox.ShowInTaskbar = false;
        }