Last active
August 19, 2021 09:23
-
-
Save aspose-com-kb/f43fee612312a4ece1606041ae724082 to your computer and use it in GitHub Desktop.
Draw Vector Shapes in C#. To understand this code find the detailed step in this article: https://kb.aspose.com/drawing/net/how-to-draw-shapes-in-c-shape/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| //Add reference to Aspose.Drawing for .NET API | |
| //Use following namespaces to draw vector shapes | |
| using Aspose.Drawing; | |
| using System.Drawing; | |
| namespace DrawVectorShapes | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| //Set Aspose license before drawing vector shapes | |
| //using Aspose.Drawing for .NET | |
| Aspose.Drawing.License AsposeDrawingLicense = new Aspose.Drawing.License(); | |
| AsposeDrawingLicense.SetLicense(@"c:\asposelicense\license.lic"); | |
| //create bitmap and load into graphics object | |
| Bitmap BitmapImage = new Bitmap(512, 512, | |
| System.Drawing.Imaging.PixelFormat.Format32bppPArgb); | |
| Graphics GraphicsFromImage = Graphics.FromImage(BitmapImage); | |
| //create a pen tool and draw ellipse | |
| Pen PenTool = new Pen(Color.Green, 3); | |
| GraphicsFromImage.DrawEllipse(PenTool, 20, 20, 400, 400); | |
| //save output png file | |
| BitmapImage.Save("DrawEllipse.png"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment