2014-02-21 65 views
-1
有關比較兩把刷子

的Visual Studio 2012抱怨:的Visual Studio 2012抱怨比較兩個刷

private void SetLabel(string stText, Brushes colorBackground) 
{ 
    if (colorBackGround == Brushes.Yellow) 
... 
} 

錯誤消息:"The name 'colorBackGround' does not exist in the current context"

+0

您沒有聲明colorBackGround或沒有正確包含文件/單位 –

+0

'Visual Studio 2012抱怨' - 您的代碼錯誤。這不是IDE S的錯: –

+0

對不起colorBackground的打字錯誤 - >我修好了,但沒有正確複製 - >太多的muxing。正確的錯誤信息是「運算符'=='不能應用於類型'System.Windows.Media.Brushes'和'System.Windows.Media.SolidColorBrush'的操作數」「我嘗試將Brushes colorBackground更改爲SolidColorBrush colorBackground - >它是滿意「if」語句,但不喜歡gLBl.Background = colorBackGround - >假定將其更改爲SolidColorBrush是一個錯誤。 – bhs67

回答

0

colorBackGround是不一樣的colorBackground! C#區分大小寫