2

I want to customize my message box. I have created my own MessageBox. because basic message box, i can not customize the font (bold, color,..etc)

The problem is how can I get the value if a user clicks the yes botton ?

 public partial class XtraForm_Message : DevExpress.XtraEditors.XtraForm
    {
        public XtraForm_Message()
        {
            InitializeComponent();
        }

        public XtraForm_Message(string ClostList, string Chauffeur)
            : this()
        {
            labelControl_Trans.Text = ClostList;
            labelControl_Chauffeur.Text = Chauffeur;
        }

        private void simpleButton_oui_Click(object sender, EventArgs e)
        {
               ??????
        }

        private void simpleButton_non_Click(object sender, EventArgs e)
        {
            this.Close();
        }

and I call it like this:

  XtraForm_Message LeMessage = new XtraForm_Message(ClosListLib, ChauffeurLib);
                        LeMessage.Show();

If user click yes then I will do { ...... }

4

4 に答える 4

3

DialogResult を使用する必要があります。

 public partial class XtraForm_Message : DevExpress.XtraEditors.XtraForm
{
    public XtraForm_Message()
    {
        InitializeComponent();
    }

    public XtraForm_Message(string ClostList, string Chauffeur)
        : this()
    {
        labelControl_Trans.Text = ClostList;
        labelControl_Chauffeur.Text = Chauffeur;
    }

    private void simpleButton_oui_Click(object sender, EventArgs e)
    {
        DialogResult = DialogResult.Yes;
        this.Close();
    }

    private void simpleButton_non_Click(object sender, EventArgs e)
    {
        DialogResult = DialogResult.No;
        this.Close();
    }

次のように呼び出します。

   XtraForm_Message LeMessage = new XtraForm_Message(ClosListLib, ChauffeurLib);
   if(LeMessage.ShowDialog() == DialogResult.Yes)
         { ...... }
于 2013-07-23T08:58:05.303 に答える