我想自定义我的消息框。我创建了自己的消息框。 因为基本的消息框,我无法自定义字体(粗体、颜色等)
问题是如果用户单击"is"按钮,我如何获取该值?
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();
}
我这样调用它:
XtraForm_Message LeMessage = new XtraForm_Message(ClosListLib, ChauffeurLib);
LeMessage.Show();
如果用户单击"is",那么我将执行 { ...... }
请您参考如下方法:
您必须使用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)
{ ...... }