Michael Plank

Michael Plank

  • 2.2k
  • 2
  • 111

Graphics or Buttons fail in 2022 but OK in 2017.

Mar 18 2023 6:49 PM

I am trying to use Graphics in C# 2022. I have included the following lines;

using System;
using System.Collections.Generic;
using System.Drawing;
using System.ComponentModel;
using System.Resources;
using System.Drawing.Imaging;
using System.Drawing.Printing;
//using System.Drawing.Common;
using System.Text;
using System.Linq;
using System.Drawing.Drawing2D;
using System.Windows;
using CommonLibrary;
//using System.Imaging;
using System.Runtime.InteropServices;

namespace LazerPrintLibrary


but I get 

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS1069    The type name 'Brush' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.    LazerPrintLibrary    E:\Projects22\LazerPrintLibrary\LazerPrintLibrary\LazerPrintClass.cs    305    Active


On looking further I also can not use Grids or buttons etc.  

These all worked correctly in c# 2017. 

Answers (4)