You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,21 +20,113 @@ Demonstrates image manipulation using the [!INCLUDE[winsdklong](../dotnet/includ
16
20
17
21
The following topics demonstrate the use of the <xref:System.Drawing.Image?displayProperty=fullName> class to perform image manipulation.
18
22
19
-
## In This Section
20
-
[How to: Convert Image File Formats with the .NET Framework](../dotnet/how-to-convert-image-file-formats-with-the-dotnet-framework.md)
23
+
## <aname="display"></a> Display Images with the .NET Framework
24
+
The following code example modifies the OnPaint event handler to retrieve a pointer to the <xref:System.Drawing.Graphics> object for the main form. The <xref:System.Windows.Forms.Form.OnPaint%2A> function is intended for a Windows Forms application, most likely created with a Visual Studio application wizard.
21
25
22
-
[How to: Display Images with the .NET Framework](../dotnet/how-to-display-images-with-the-dotnet-framework.md)
26
+
The image is represented by the <xref:System.Drawing.Image> class. The image data is loaded from a .jpg file using the <xref:System.Drawing.Image.FromFile%2A?displayProperty=fullName> method. Before the image is drawn to the form, the form is resized to accommodate the image. The drawing of the image is performed withthe<xref:System.Drawing.Graphics.DrawImage%2A?displayProperty=fullName> method.
23
27
24
-
[How to: Draw Shapes with the .NET Framework](../dotnet/how-to-draw-shapes-with-the-dotnet-framework.md)
28
+
The <xref:System.Drawing.Graphics> and <xref:System.Drawing.Image> classes are both in the <xref:System.Drawing?displayProperty=fullName> namespace.
25
29
26
-
[How to: Rotate Images with the .NET Framework](../dotnet/how-to-rotate-images-with-the-dotnet-framework.md)
## <aname="draw"></a> Draw Shapes with the .NET Framework
49
+
The following code example uses the <xref:System.Drawing.Graphics> class to modify the <xref:System.Windows.Forms.Form.OnPaint%2A> event handler to retrieve a pointer to the <xref:System.Drawing.Graphics> object for the main form. This pointer is then used to set the background color of the form and draw a line and an arc using the <xref:System.Drawing.Graphics.DrawLine%2A?displayProperty=fullName> and <xref:System.Drawing.Graphics.DrawArc%2A> methods.
50
+
51
+
### Example
52
+
53
+
```cpp
54
+
#using <system.drawing.dll>
55
+
usingnamespaceSystem;
56
+
usingnamespaceSystem::Drawing;
57
+
// ...
58
+
protected:
59
+
virtual Void Form1::OnPaint(PaintEventArgs^ pe ) override
## <aname="rotate"></a> Rotate Images with the .NET Framework
82
+
The following code example demonstrates the use of the <xref:System.Drawing.Image?displayProperty=fullName> class to load an image from disk, rotate it 90 degrees, and save it as a new .jpg file.
## <aname="convert"></a> Convert Image File Formats with the .NET Framework
102
+
The following code example demonstrates the <xref:System.Drawing.Image?displayProperty=fullName> class and the <xref:System.Drawing.Imaging.ImageFormat?displayProperty=fullName> enumeration used to convert and save image files. The following code loads an image from a .jpg file and then saves it in both .gif and .bmp file formats.
0 commit comments