这是我的代码,我正在尝试点击按钮后更改文本的颜色,但没有任何事情发生在C#中单击按钮后更改文本的颜色..?
我的色彩功能不明确,因为我使用itextsharp
和system.drawing
库...
我试着使用下面的代码..虽然它不给错误,但文本的颜色不会改变..我尝试使用clickedbutton
。 Forecolor
功能很好,但它仍然..这两个功能不工作
btn.ForeColor = System.Drawing.Color.Red;
clickedbutton.Forecolor= System.Drawing.Color.Red;
同样我想改变下
ClickedButton.Text="Input Processing"
任何投入将高度赞赏本文本的颜色。我知道它的一个非常愚蠢的问题,但我很困惑:(
我的代码是
private void btn_Preprocess_Click(object sender, EventArgs e)
{
Button clickedButton = (Button)sender;
clickedButton.Text = "Input Processing...";
btn_Preprocess.ForeColor = System.Drawing.Color.Red;
clickedButton.Enabled = false;
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
SourcePath = folderBrowserDialog1.SelectedPath;
string searchPattern = "*.*";
DirectoryInfo di = new DirectoryInfo(SourcePath);
GetFiles1(di, searchPattern);
MessageBox.Show("Process Complete");
}
我不明白。你想改变按钮文字“输入处理”,这是clickedButton,但你的代码改变颜色btn_Preprocess ... – LPs 2014-12-19 07:27:19
你确定它是asp.net,而不是WinForms? – t3chb0t 2014-12-19 07:30:52
它的WinForm,因为在WPF中是前景属性,而不是ForeColor – LPs 2014-12-19 07:38:26