【发布时间】:2012-01-30 00:05:38
【问题描述】:
为什么?
我在 C# 中构建了一个简单的自定义 MessageBox 作为对话框。当我通过 Show() 显示消息框时,消息文本未突出显示。当我显示这个消息框 vi ShowDialog() 时,文本 突出显示。
我不希望我的文字被突出显示。有什么想法或想法吗?
public partial class MyMessageBox : Form
{
private String mCaption;
private String mMessage;
public MyMessageBox( Form anOwner, String aCaption, String aMessage )
{
InitializeComponent();
mCaption = aCaption;
Owner = anOwner;
mMessage = aMessage;
}
private void btnCancelRequest_Click( object sender, EventArgs e )
{
( (AddressForm)Owner ).RequestCancelled();
}
private void btnOk_Click( object sender, EventArgs e )
{
CloseDialog();
}
public void CloseDialog()
{
Close();
}
// Called from the Address Form
public void HideCancelRequestButton()
{
btnCancelRequest.Visible = false;
}
private void MyMessageBox_Activated( object sender, EventArgs e )
{
Text = mCaption;
txtMessage.Text = mMessage;
}
}
【问题讨论】:
-
我猜你的消息显示在一个名为 txtMessage 的 TextBox 控件中。为什么不用标签替换它?
标签: c# .net winforms dialog messagebox