System.Drawing.Common
10.0.7
50 download(s)
public
Provides access to GDI+ graphics functionality. Commonly Used Types: System.Drawing.Bitmap System.Drawing.BitmapData System.Drawing.Brush System.Drawing.Font System.Drawing.Graphics System.Drawing.Icon Since .NET 7, non-Windows platforms are not supported, even with the runtime configuration switch. See https://aka.ms/systemdrawingnonwindows for more information.
PackageReference
<PackageReference Include="System.Drawing.Common" Version="10.0.7" />
.NET CLI
dotnet add package System.Drawing.Common --version 10.0.7
Dependencies
net10.0
| Package | Version range |
|---|---|
| Microsoft.Win32.SystemEvents | [10.0.7, ) |
net8.0
| Package | Version range |
|---|---|
| Microsoft.Win32.SystemEvents | [10.0.7, ) |
net9.0
| Package | Version range |
|---|---|
| Microsoft.Win32.SystemEvents | [10.0.7, ) |
Readme
# System.Drawing.Common
The `System.Drawing.Common` package allows .NET Core and .NET 6+ applications to access GDI+ graphics functionality.
This package is especially useful for porting .NET Framework applications that rely on the `System.Drawing` namespace.
## Getting Started
To get started with `System.Drawing.Common`, install it using the NuGet Package Manager, the .NET CLI, or by editing your project file directly.
**NOTE:** If you are developing a **WinForms** application, you **do not** need to install the `System.Drawing.Common` package separately (to this end, you use the `Sdk` attribute for the `Project` element like `<Project Sdk="Microsoft.NET.Sdk">` in the .csproj or the .vbproj file and then specify `<UseWindowsForms>true</UseWindowsForms>`). This package is then automatically included as part of the .NET SDK for WinForms Apps, which means you can start using the `System.Drawing` namespace right away in your WinForms projects.
## Usage
The following examples demonstrate some basic tasks you can accomplish with `System.Drawing.Common`.
### Create a Simple Bitmap and Save it
#### C#
```csharp
using System.Drawing;
class Program
{
static void Main()
{
using (Bitmap bitmap = new Bitmap(100, 100))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Red);
}
bitmap.Save("output.bmp");
}
}
}
```
#### VB
```vb
Imports System.Drawing
Module Program
Sub Main()
Using bitmap As New Bitmap(100, 100)
Using g As Graphics = Graphics.FromImage(bitmap)
g.Clear(Color.Red)
End Using
bitmap.Save("output.bmp")
End Using
End Sub
End Module
```
## Additional Documentation
For more in-depth tutorials and API references, you can check the following resources:
- [NuGet Gallery | System.Drawing.Common](https://nuget.org/packages/System.Drawing.Common/)
- [System.Drawing.Common Namespace | Microsoft Docs](https://docs.microsoft.com/dotnet/api/system.drawing)
- [Drawing with System.Drawing.Common | Microsoft Learn](https://learn.microsoft.com/dotnet/core/drawing/)
## Feedback
- Open an issue on the [GitHub repository](https://github.com/dotnet/winforms/issues)
- Reach out on Twitter with the [hashtag #winforms](https://twitter.com/search?q=%23winforms)
- Join our Discord channel: [dotnet/Discord](https://discord.com/invite/dotnet)
Versions
Target frameworks
net10.0
net8.0
net9.0
Metadata
- Published
- Size
- 3.57 MB
- Authors
- Microsoft
- License
- MIT
- Repository
- https://github.com/dotnet/dotnet commit b16286c2284fecf303dbc12a0bb152476d662e44
- Flags
- SemVer 1
- SHA512
- BVsXJ4OrpUC6UrEGCA3cYurM5iJG2mZu8RJg5Q7Csqhn6AjhYLsbUoxi2P91j1StRuNA70ohv9I2PpIipW/PWg==