title: Im trying to use SolidColorBrush but getting many Cannot convert type errors how can i fix it and use the SolidColorBrush?
body: <p>In the tope of form1 i did:</p>
  
  <pre><code>using System.Windows.Media;
  </code></pre>
  
  <p>But then everywhere in my code where i used Pen Brush Color i had to add before it System.Drawing for example:</p>
  
  <pre><code>System.Drawing.Pen(System.Drawing.Color.Green, 2f))
  </code></pre>
  
  <p>If i will not do it i will get an error for example:</p>
  
  <pre><code>System.Drawing.Pen(Color.Green, 2f))
  </code></pre>
  
  <p>Error   2   'Color' is an ambiguous reference between 'System.Drawing.Color' and 'System.Windows.Media.Color'</p>
  
  <p>So i add System.Drawing before it and no errors on this lines.</p>
  
  <p>The problem is when im trying to use SolidColorBrush in my method thats why i needed to add the Media class:</p>
  
  <pre><code>private void DrawText(string text, System.Drawing.Color pen_color, System.Windows.Media.Color brushes_color, Graphics graphics, int point1, int point2, Point point3)
          {
              SolidColorBrush brush = new SolidColorBrush(brushes_color);
              System.Drawing.Color color = ((System.Windows.Media.Brushes)brush).Color;
              using (System.Drawing.Pen pen = new System.Drawing.Pen(pen_color, 6f))
              {
                  Point pt1 = new Point(point1); // 369, 90
                  Point pt2 = new Point(point2); // 469, 90
                  graphics.DrawLine(pen, pt1, pt2);
              }
  
              graphics.DrawString(text,
                      this.Font, (System.Drawing.Brushes)brush, point3); // 480, 83
          }
  </code></pre>
  
  <p>Im getting some errors:</p>
  
  <p>On this line: System.Drawing.Brushes</p>
  
  <p>Error   5   Argument 3: cannot convert from 'System.Drawing.Brushes' to 'System.Drawing.Brush'</p>
  
  <p>On: point3</p>
  
  <p>Error   6   Argument 4: cannot convert from 'System.Drawing.Point' to 'System.Drawing.RectangleF'</p>
  
  <p>On this line: (System.Drawing.Brushes)brush</p>
  
  <p>Error   3   Cannot convert type 'System.Windows.Media.SolidColorBrush' to 'System.Drawing.Brushes'</p>
  
  <p>On this line: System.Drawing.Color color = ((System.Windows.Media.Brushes)brush).Color;</p>
  
  <p>Error   2   Cannot convert type 'System.Windows.Media.SolidColorBrush' to 'System.Windows.Media.Brushes'</p>
  
  <p>On this part: graphics.DrawString</p>
  
  <p>Error   4   The best overloaded method match for 'System.Drawing.Graphics.DrawString(string, System.Drawing.Font, System.Drawing.Brush, System.Drawing.RectangleF)' has some invalid arguments</p>
  
  <p>And the property Color is not exist: System.Windows.Media.Color brushes_color</p>
  
  <p>Error   1   The type name 'Color' does not exist in the type 'System.Drawing.Brush' </p>
  
  <p>All i wanted to do is to make that the user will be able to select the Brushes Color on this line:</p>
  
  <pre><code>graphics.DrawString(text,
                      this.Font, (System.Drawing.Brushes)brush, point3);
  </code></pre>
  
  <p>In the original the line was:</p>
  
  <pre><code>graphics.DrawString(text,
                      this.Font, Brushes.Green , point3);
  </code></pre>
  
  <p>But i want that the use will select the Color of the Brushes.</p>