agentleFS
aspose-diagramaspose-diagram/agentic-net-examples/drawing/agents.md

agentic-net-examples / drawing

AGENTS.md1 starsChanged 4 months agoMITView on GitHub

AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API — Drawing category. You are a C# developer specializing in Visio diagram processing using Aspose.Diagram for .NET. You are working in the Drawing category. Your task is to write clean, compilable C# console examples that demonstrate Aspose.Diagram API usage for drawing operations. You always use explicit types (never var), include all required using directives, and follow the patterns established in this category. The dominant workflow in this category is: Load…

The file

We split this agents.md into the rules it gives an agent

11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use explicit types — Diagram diagram = new Diagram(...) not var diagram = ...

    line 38
  2. Very specific:

    Use SaveFileFormat enum in PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf

    line 40
  3. Very specific:

    Use BOOL.True / BOOL.False for Aspose BOOL properties — never plain true/false

    line 41
  4. Very specific:

    Use var for any variable declaration

    line 53
  5. Very specific:

    Use using (Diagram diagram = ...) — Diagram does not implement IDisposable

    line 54
  6. Very specific:

    Use SaveFileFormat.VSDX or other ALL_CAPS enum values

    line 55
  7. Very specific:

    Use System.Windows.Forms — not available in net8.0 console project

    line 56
  8. Very specific:

    Use NUnit Assert — not available, use Console.WriteLine and manual checks

    line 57
  9. Distinctive:

    Use PowerShell syntax inside C# files

    line 58
  10. Very specific:

    Only examples that pass both dotnet build and dotnet run are committed.

    line 305
  11. Very specific:

    Always check rules/rules.json for the latest API correction rules

    line 310

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

Drawing

AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API — Drawing category.

Statistics

MetricValue
Examples125
Pass Rate100.0%
Aspose.Diagram Version26.9.0
Target Frameworknet8.0
Last Updated2026-09-24

Persona

You are a C# developer specializing in Visio diagram processing using Aspose.Diagram for .NET. You are working in the Drawing category. Your task is to write clean, compilable C# console examples that demonstrate Aspose.Diagram API usage for drawing operations. You always use explicit types (never var), include all required using directives, and follow the patterns established in this category.

Boundaries

Always

  • Use explicit types — Diagram diagram = new Diagram(...) not var diagram = ...
  • Include using Aspose.Diagram; and using Aspose.Diagram.Saving; in every file
  • Use SaveFileFormat enum in PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf
  • Use BOOL.True / BOOL.False for Aspose BOOL properties — never plain true/false
  • Wrap entry point in static void Main() inside class Program
  • Handle FileNotFoundException with try/catch when loading files

Ask First

  • Multi-file projects or solutions
  • External dependencies beyond Aspose.Diagram and Aspose.Drawing
  • Platform-specific code (Windows Forms, WPF, ASP.NET)

Never

  • Use var for any variable declaration
  • Use using (Diagram diagram = ...) — Diagram does not implement IDisposable
  • Use SaveFileFormat.VSDX or other ALL_CAPS enum values
  • Use System.Windows.Forms — not available in net8.0 console project
  • Use NUnit Assert — not available, use Console.WriteLine and manual checks
  • Use PowerShell syntax inside C# files

Required Namespaces

NamespaceFilesPurpose
System125Console, Math, DateTime, Exception
Aspose.Diagram124Core diagram API
System.IO102File, Stream, Path, Directory operations
Aspose.Diagram.Saving64Save options (PDF, PNG, HTML, SVG, XPS)
Aspose.Diagram.Manipulation4Supporting utilities
Aspose.Drawing3Supporting utilities
System.Linq3LINQ queries on collections
System.Collections.Generic2List, Dictionary, HashSet
System.Text.RegularExpressions1Supporting utilities
Aspose.Drawing.Text1Font enumeration via InstalledFontCollection
System.Text1StringBuilder
System.Xml.Linq1Supporting utilities

Common Code Pattern

The dominant workflow in this category is: Load → Modify → Save

using System;
using Aspose.Diagram;
using Aspose.Diagram.Saving;

class Program
{
    static void Main()
    {
        // 1. Load or create diagram
        Diagram diagram = new Diagram("input.vsdx");

        // 2. Perform category-specific operations
        // ...

        // 3. Save result
        diagram.Save("output.vsdx", SaveFileFormat.Vsdx);
    }
}

Examples

FileKey APIsTask
add-a-centered-text-label-inside-a-diamond-shape-using-a-custom-font.csDiagram, Page, PagesAdd a centered text label inside a diamond shape using a custom font
add-a-centered-text-label-inside-the-pentagon-for-annotation-purposes.csDiagram, Pages, SaveAdd a centered text label inside the pentagon for annotation purposes
add-a-connector-line-between-two-rectangles-using-an-elbow-routing-style.csAddShape, ConnectShapesViaConnector, DiagramAdd a connector line between two rectangles using an elbow routing style
add-a-diamond-shape-to-the-diagram-and-set-its-size-to-2-inches-by-2-inches.csDiagram, Pages, SaveAdd a diamond shape to the diagram and set its size to 2 inches by 2 inches
add-a-drop-shadow-effect-to-the-rectangle-with-five-pixel-offset-and-thirty-percent-opacity.csDiagram, Pages, SaveAdd a drop shadow effect to the rectangle with five pixel offset and thirty percent opacity
add-a-page-header-containing-the-document-title-using-a-twelve-point-arial-font.csDiagram, Save, diagramAdd a page header containing the document title using a twelve point arial font
add-a-shadow-effect-to-the-triangle-with-default-parameters.csDiagram, Pages, SaveAdd a shadow effect to the triangle with default parameters
add-a-tiled-background-image-to-the-page-covering-the-full-page-dimensions.csAddShape, Diagram, PagesAdd a tiled background image to the page covering the full page dimensions
adjust-line-thickness-of-a-circle-based-on-a-user-provided-numeric-input.csDiagram, Page, PagesAdjust line thickness of a circle based on a user provided numeric input
adjust-the-triangle-s-opacity-to-75-percent-for-semi-transparent-effect.csDiagram, Pages, SaveAdjust the triangle s opacity to 75 percent for semi transparent effect
adjust-z-order-to-bring-the-circle-shape-to-the-front-of-overlapping-shapes.csDiagram, Pages, SaveAdjust z order to bring the circle shape to the front of overlapping shapes
align-the-pentagon-shape-to-the-exact-center-of-the-diagram-page-for-symmetry.csDiagram, Pages, SaveAlign the pentagon shape to the exact center of the diagram page for symmetry
align-the-rectangle-to-the-top-left-corner-of-the-page-with-a-ten-pixel-margin.csAddShape, Diagram, PagesAlign the rectangle to the top left corner of the page with a ten pixel margin
apply-a-45-degree-rotation-transform-to-the-entire-diagram-page-for-artistic-effect.csDiagram, Pages, SaveApply a 45 degree rotation transform to the entire diagram page for artistic effect
apply-a-curved-connector-between-two-shapes-with-a-smooth-spline-curve.csAddShape, ConnectShapesViaConnector, DiagramApply a curved connector between two shapes with a smooth spline curve
apply-a-linear-gradient-fill-from-red-to-yellow-on-the-triangle.csDiagram, Pages, SaveApply a linear gradient fill from red to yellow on the triangle
apply-a-linear-gradient-fill-to-the-rectangle-transitioning-from-blue-to-green-colors.csDiagram, Pages, SaveApply a linear gradient fill to the rectangle transitioning from blue to green colors
apply-a-rotation-of-30-degrees-to-the-triangle-before-exporting-to-png.csDiagram, ImageSaveOptions, PagesApply a rotation of 30 degrees to the triangle before exporting to png
apply-a-solid-red-fill-color-to-the-triangle-shape-for-visual-emphasis.csDiagram, Pages, SaveApply a solid red fill color to the triangle shape for visual emphasis
apply-a-text-outline-effect-with-a-one-pixel-black-border-around-white-text.csDiagram, ImageSaveOptions, PagesApply a text outline effect with a one pixel black border around white text
arrange-shapes-in-a-grid-layout-and-export-the-diagram-as-pdf.csDiagram, Pages, PdfSaveOptionsArrange shapes in a grid layout and export the diagram as pdf
batch-process-a-folder-of-diagrams-adding-a-pentagon-to-each-file-automatically.csDiagram, Pages, SaveBatch process a folder of diagrams adding a pentagon to each file automatically
calculate-the-bounding-box-dimensions-of-the-pentagon-using-the-api-geometry-methods.csDiagram, Pages, ShapesCalculate the bounding box dimensions of the pentagon using the api geometry methods
center-the-triangle-on-the-page-using-page-dimensions-for-alignment.csDiagram, Pages, SaveCenter the triangle on the page using page dimensions for alignment
change-the-connector-s-arrowhead-style-to-a-filled-triangle-at-the-target-end.csDiagram, Pages, SaveChange the connector s arrowhead style to a filled triangle at the target end
change-the-triangle-s-fill-color-to-blue-for-visual-distinction.csDiagram, Pages, SaveChange the triangle s fill color to blue for visual distinction
clone-the-triangle-shape-and-place-the-copy-on-the-second-page-at-offset-coordinates.csDiagram, Page, PagesClone the triangle shape and place the copy on the second page at offset coordinates
connect-the-pentagon-and-square-using-a-dynamic-connector-line-with-arrowheads.csAddShape, ConnectShapesViaConnector, DiagramConnect the pentagon and square using a dynamic connector line with arrowheads
convert-the-diagram-to-an-svg-file-while-maintaining-shape-hierarchy-and-styles.csDiagram, Save, diagramConvert the diagram to an svg file while maintaining shape hierarchy and styles
create-a-batch-script-that-draws-diamonds-on-ten-pages-and-saves-each-as-png.csDiagram, ImageSaveOptions, PageCreate a batch script that draws diamonds on ten pages and saves each as png
create-a-diagram-with-two-pages-each-containing-a-triangle-of-different-colors.csDiagram, Page, PagesCreate a diagram with two pages each containing a triangle of different colors
create-a-new-diagram-object-and-add-a-triangle-shape-to-the-first-page.csDiagram, Pages, SaveCreate a new diagram object and add a triangle shape to the first page
create-a-new-visio-diagram-add-a-page-and-draw-a-centered-circle-shape.csDiagram, Page, PagesCreate a new visio diagram add a page and draw a centered circle shape
create-a-thumbnail-png-of-the-diagram-page-sized-to-one-hundred-pixels-wide.csDiagram, ImageSaveOptions, SaveCreate a thumbnail png of the diagram page sized to one hundred pixels wide
create-guide-lines-on-the-page-and-align-shapes-precisely-to-those-guides.csDiagram, Page, PagesCreate guide lines on the page and align shapes precisely to those guides
define-the-triangle-s-three-geometry-points-using-absolute-coordinates-on-the-page.csDiagram, Pages, SaveDefine the triangle s three geometry points using absolute coordinates on the page
distribute-three-identical-rectangles-evenly-across-the-page-horizontally-with-equal-spacing-between-each-shape.csDiagram, Pages, SaveDistribute three identical rectangles evenly across the page horizontally with equal spacing between each shape
draw-a-diamond-shape-with-a-thick-border-and-export-it-as-svg.csDiagram, Pages, SVGSaveOptionsDraw a diamond shape with a thick border and export it as svg
draw-a-pentagon-shape-on-the-page-with-custom-size-and-position.csDiagram, Pages, SaveDraw a pentagon shape on the page with custom size and position
draw-an-oval-with-a-transparent-fill-and-export-the-image-as-png.csDiagram, ImageSaveOptions, PagesDraw an oval with a transparent fill and export the image as png
draw-multiple-circles-with-varying-colors-based-on-their-index-position-and-export-as-png.csDiagram, ImageSaveOptions, PagesDraw multiple circles with varying colors based on their index position and export as png
duplicate-a-circle-shape-across-five-pages-each-with-unique-position-offsets.csDiagram, Page, PagesDuplicate a circle shape across five pages each with unique position offsets
duplicate-a-diamond-shape-and-offset-its-position-by-0-5-inches-to-the-right.csAddShape, Diagram, PagesDuplicate a diamond shape and offset its position by 0 5 inches to the right
duplicate-the-pentagon-multiple-times-in-a-grid-layout-across-the-diagram-canvas.csDiagram, Pages, SaveDuplicate the pentagon multiple times in a grid layout across the diagram canvas
duplicate-the-triangle-shape-three-times-and-arrange-them-vertically-on-the-page.csDiagram, Pages, SaveDuplicate the triangle shape three times and arrange them vertically on the page
embed-a-hyperlink-in-the-rectangle-s-text-that-opens-a-specified-website-url.csAddShape, Diagram, PagesEmbed a hyperlink in the rectangle s text that opens a specified website url
enable-text-wrapping-inside-the-rectangle-to-automatically-break-long-sentences-for-readability.csDiagram, Pages, SaveEnable text wrapping inside the rectangle to automatically break long sentences for readability
export-each-page-of-the-diagram-as-separate-png-files-with-transparent-background.csDiagram, ImageSaveOptions, PagesExport each page of the diagram as separate png files with transparent background
export-only-the-second-page-of-a-multi-page-diagram-to-a-pdf-document.csDiagram, PdfSaveOptions, SaveExport only the second page of a multi page diagram to a pdf document
export-only-the-triangle-shape-as-a-standalone-svg-file.csDiagram, Pages, SVGSaveOptionsExport only the triangle shape as a standalone svg file
export-the-diagram-containing-the-triangle-to-an-svg-file.csDiagram, Pages, SVGSaveOptionsExport the diagram containing the triangle to an svg file
export-the-diagram-to-html-format-including-interactive-zoom-controls.csDiagram, HTMLSaveOptions, SaveExport the diagram to html format including interactive zoom controls
export-the-diagram-to-html-with-embedded-svg-resources-for-all-shapes.csDiagram, HTMLSaveOptions, SVGSaveOptionsExport the diagram to html with embedded svg resources for all shapes
export-the-diagram-to-html-with-inline-svg-markup-for-all-drawn-shapes.csDiagram, HTMLSaveOptions, SaveExport the diagram to html with inline svg markup for all drawn shapes
export-the-diagram-to-pdf-and-include-the-triangle-on-a-separate-page.csDiagram, Page, PagesExport the diagram to pdf and include the triangle on a separate page
export-the-diagram-to-pdf-format-using-high-resolution-settings-for-print-quality.csDiagram, PdfSaveOptions, SaveExport the diagram to pdf format using high resolution settings for print quality
export-the-diagram-to-pdf-with-high-resolution-suitable-for-print-quality.csDiagram, PdfSaveOptions, SaveExport the diagram to pdf with high resolution suitable for print quality
export-the-diagram-to-png-format-with-a-transparent-background-layer.csDiagram, ImageSaveOptions, SaveExport the diagram to png format with a transparent background layer
export-the-diagram-to-png-with-a-specified-solid-background-color.csDiagram, ImageSaveOptions, PageExport the diagram to png with a specified solid background color
export-the-diagram-to-svg-format-embedding-required-font-resources.csDiagram, Fonts, SVGSaveOptionsExport the diagram to svg format embedding required font resources
export-the-diagram-to-svg-while-assigning-css-classes-to-each-shape-for-styling.csDiagram, Pages, PropExport the diagram to svg while assigning css classes to each shape for styling
export-the-modified-diagram-to-a-high-resolution-png-image-with-three-hundred-dpi.csDiagram, ImageSaveOptions, SaveExport the modified diagram to a high resolution png image with three hundred dpi
export-the-pdf-using-compression-settings-to-reduce-file-size-while-maintaining-quality.csDiagram, PdfSaveOptions, SaveExport the pdf using compression settings to reduce file size while maintaining quality
export-the-png-and-override-the-default-background-color-with-white.csDiagram, ImageSaveOptions, PageExport the png and override the default background color with white
export-the-triangle-diagram-to-a-png-image-with-default-resolution.csDiagram, Save, diagramExport the triangle diagram to a png image with default resolution
generate-a-diagram-containing-fifty-circles-with-incremental-radii-and-export-as-pdf.csDiagram, Pages, PdfSaveOptionsGenerate a diagram containing fifty circles with incremental radii and export as pdf
generate-an-html-file-that-embeds-javascript-event-handlers-for-shape-interaction.csAddShape, Diagram, HTMLSaveOptionsGenerate an html file that embeds javascript event handlers for shape interaction
generate-an-html-page-that-displays-the-triangle-diagram-using-inline-svg-markup.csGenerate an html page that displays the triangle diagram using inline svg markup
generate-ten-identical-triangles-arranged-in-a-grid-pattern-across-the-page.csDiagram, Pages, SaveGenerate ten identical triangles arranged in a grid pattern across the page
group-a-circle-and-an-oval-together-and-export-the-group-as-a-single-svg-file.csDiagram, Pages, SVGSaveOptionsGroup a circle and an oval together and export the group as a single svg file
group-multiple-diamonds-and-export-the-group-as-a-single-svg-document.csDiagram, Pages, SVGSaveOptionsGroup multiple diamonds and export the group as a single svg document
group-the-pentagon-and-square-together-to-form-a-composite-shape-collection.csDiagram, Pages, SaveGroup the pentagon and square together to form a composite shape collection
group-the-rectangle-with-a-newly-drawn-ellipse-and-assign-a-common-group-name.csDiagram, Pages, SaveGroup the rectangle with a newly drawn ellipse and assign a common group name
group-the-triangle-with-the-inserted-image-to-move-them-together.csDiagram, Pages, SaveGroup the triangle with the inserted image to move them together
include-clickable-hyperlinks-in-the-pdf-export-that-navigate-to-external-resources.csAddShape, Diagram, PageInclude clickable hyperlinks in the pdf export that navigate to external resources
insert-a-page-footer-with-automatic-page-numbering-aligned-to-the-right-margin.csDiagram, Save, diagramInsert a page footer with automatic page numbering aligned to the right margin
insert-a-square-shape-on-the-same-page-and-apply-a-solid-fill-color.csDiagram, Pages, SaveInsert a square shape on the same page and apply a solid fill color
insert-a-text-box-above-the-rectangle-with-centered-alignment-and-bold-formatting.csDiagram, Pages, SaveInsert a text box above the rectangle with centered alignment and bold formatting
insert-an-external-image-behind-the-triangle-on-the-page.csAddShape, Diagram, PagesInsert an external image behind the triangle on the page
insert-an-image-onto-the-page-and-position-the-triangle-above-it.csAddShape, Diagram, PagesInsert an image onto the page and position the triangle above it
insert-an-oval-shape-onto-a-newly-added-page-and-position-it-at-specific-coordinates.csDiagram, Page, PagesInsert an oval shape onto a newly added page and position it at specific coordinates
insert-multiline-text-inside-the-rectangle-using-a-custom-truetype-font-at-fourteen-point-size.csDiagram, Pages, SaveInsert multiline text inside the rectangle using a custom truetype font at fourteen point size
instantiate-a-diagram-object-and-add-a-new-page-to-the-diagram.csDiagram, Page, PagesInstantiate a diagram object and add a new page to the diagram
load-a-vsdx-diagram-file-and-add-a-rectangle-with-a-solid-red-border.csDiagram, Pages, SaveLoad a vsdx diagram file and add a rectangle with a solid red border
load-an-existing-visio-file-insert-a-pentagon-shape-and-re-save-the-document.csDiagram, Pages, SaveLoad an existing visio file insert a pentagon shape and re save the document
lock-aspect-ratio-of-a-diamond-shape-while-resizing-to-preserve-proportions.csDiagram, Pages, SaveLock aspect ratio of a diamond shape while resizing to preserve proportions
lock-the-position-of-an-oval-shape-after-drawing-to-prevent-further-movement.csDiagram, Pages, SaveLock the position of an oval shape after drawing to prevent further movement
lock-the-rectangle-to-prevent-modifications-during-batch-processing-until-all-drawing-steps-are-completed.csAddShape, Diagram, PagesLock the rectangle to prevent modifications during batch processing until all drawing steps are completed
mirror-the-rectangle-horizontally-keeping-its-original-fill-and-border-styles-unchanged.csDiagram, Pages, SaveMirror the rectangle horizontally keeping its original fill and border styles unchanged
move-the-triangle-to-coordinates-200-150-on-the-page-for-precise-placement.csDiagram, Pages, SaveMove the triangle to coordinates 200 150 on the page for precise placement
position-a-circle-shape-at-coordinates-measured-in-centimeters-on-the-page.csDiagram, Pages, SavePosition a circle shape at coordinates measured in centimeters on the page
rotate-the-pentagon-thirty-degrees-around-its-geometric-center-on-the-page.csDiagram, Pages, SaveRotate the pentagon thirty degrees around its geometric center on the page
rotate-the-rectangle-forty-five-degrees-around-its-center-point-while-preserving-its-position.csDiagram, Pages, SaveRotate the rectangle forty five degrees around its center point while preserving its position
rotate-the-triangle-shape-45-degrees-clockwise-around-its-center-point-for-alignment.csDiagram, Pages, SaveRotate the triangle shape 45 degrees clockwise around its center point for alignment
save-only-the-first-page-containing-the-triangle-as-a-separate-svg-file.csDiagram, Pages, SVGSaveOptionsSave only the first page containing the triangle as a separate svg file
save-the-complete-diagram-as-a-visio-vsdx-file-for-later-editing.csDiagram, Save, diagramSave the complete diagram as a visio vsdx file for later editing
save-the-diagram-as-a-pdf-document-using-default-export-settings.csDiagram, Save, diagramSave the diagram as a pdf document using default export settings
save-the-diagram-as-a-pdf-file-preserving-vector-shapes-and-text-quality.csDiagram, PdfSaveOptions, SaveSave the diagram as a pdf file preserving vector shapes and text quality
save-the-diagram-as-an-html-file-embedding-the-svg-inline.csDiagram, HTMLSaveOptions, SaveSave the diagram as an html file embedding the svg inline
scale-the-pentagon-uniformly-to-double-its-original-dimensions-while-preserving-proportions.csDiagram, Pages, SaveScale the pentagon uniformly to double its original dimensions while preserving proportions
scale-the-rectangle-proportionally-to-double-its-original-width-and-height-maintaining-aspect-ratio.csDiagram, Pages, SaveScale the rectangle proportionally to double its original width and height maintaining aspect ratio
scale-the-triangle-by-0-5-factor-to-create-a-smaller-version-on-the-same-page.csDiagram, Pages, SaveScale the triangle by 0 5 factor to create a smaller version on the same page
scale-the-triangle-uniformly-by-a-factor-of-1-5-to-increase-its-size.csDiagram, Pages, SaveScale the triangle uniformly by a factor of 1 5 to increase its size
set-custom-page-margins-of-twenty-points-on-all-sides-before-drawing-shapes.csDiagram, Pages, SaveSet custom page margins of twenty points on all sides before drawing shapes
set-fill-opacity-of-an-oval-shape-to-70-percent-for-semi-transparent-appearance.csDiagram, Pages, SaveSet fill opacity of an oval shape to 70 percent for semi transparent appearance
set-line-cap-style-of-an-oval-shape-to-round-for-smoother-line-ends.csDiagram, Pages, SaveSet line cap style of an oval shape to round for smoother line ends
set-line-join-style-of-a-circle-shape-to-bevel-for-sharper-corners.csDiagram, Pages, SaveSet line join style of a circle shape to bevel for sharper corners
set-rotation-pivot-point-of-a-circle-shape-to-its-geometric-center-before-rotating.csDiagram, Pages, SaveSet rotation pivot point of a circle shape to its geometric center before rotating
set-text-alignment-inside-a-diamond-shape-to-centered-horizontally-and-vertically.csDiagram, Page, PagesSet text alignment inside a diamond shape to centered horizontally and vertically
set-the-circle-shape-s-fill-color-to-blue-and-its-line-weight-to-0-5-points.csDiagram, Pages, SaveSet the circle shape s fill color to blue and its line weight to 0 5 points
set-the-connector-line-color-to-dark-gray-and-line-thickness-to-one-point-five.csDiagram, Pages, SaveSet the connector line color to dark gray and line thickness to one point five
set-the-diagram-page-background-to-a-light-gray-color-before-adding-shapes.csDiagram, Page, PagesSet the diagram page background to a light gray color before adding shapes
set-the-page-background-color-to-light-gray-and-draw-shapes-on-top.csDiagram, Page, PagesSet the page background color to light gray and draw shapes on top
set-the-page-background-color-to-light-gray-for-the-entire-diagram.csDiagram, Page, PagesSet the page background color to light gray for the entire diagram
set-the-pentagon-s-line-style-to-a-dashed-pattern-with-specific-thickness.csDiagram, Pages, SaveSet the pentagon s line style to a dashed pattern with specific thickness
set-the-rectangle-s-line-dash-pattern-to-dash-dot-and-increase-line-thickness-to-two-points.csDiagram, Pages, SaveSet the rectangle s line dash pattern to dash dot and increase line thickness to two points
set-the-rotation-angle-of-an-oval-shape-to-30-degrees-using-api-parameters.csDiagram, Pages, SaveSet the rotation angle of an oval shape to 30 degrees using api parameters
set-the-text-direction-inside-the-rectangle-to-vertical-for-column-layout.csDiagram, Pages, SaveSet the text direction inside the rectangle to vertical for column layout
set-the-triangle-s-line-dash-pattern-to-dashed-for-stylized-border.csDiagram, Pages, SaveSet the triangle s line dash pattern to dashed for stylized border
set-the-triangle-s-line-weight-to-2-points-and-change-line-color-to-navy.csDiagram, Pages, SaveSet the triangle s line weight to 2 points and change line color to navy
size-shapes-proportionally-to-page-dimensions-to-maintain-layout-across-page-sizes.csDiagram, Pages, SaveSize shapes proportionally to page dimensions to maintain layout across page sizes
snap-the-rectangle-to-the-nearest-grid-line-using-a-five-pixel-grid-spacing.csDiagram, Page, PagesSnap the rectangle to the nearest grid line using a five pixel grid spacing
unlock-the-rectangle-after-completing-all-drawing-operations-to-allow-further-editing.csDiagram, Pages, SaveUnlock the rectangle after completing all drawing operations to allow further editing
validate-that-all-pentagon-vertices-align-with-the-expected-coordinate-grid-positions.csDiagram, Page, PagesValidate that all pentagon vertices align with the expected coordinate grid positions
verify-that-the-exported-svg-contains-a-correct-ellipse-element-for-drawn-circles.csDiagram, Save, diagramVerify that the exported svg contains a correct ellipse element for drawn circles

Command Reference

# Build the warmup project
cd compiler/CSharpRunner/_warmup
dotnet build

# Run a specific example (copy .cs content to Program.cs first)
dotnet run

# Build with verbose output
dotnet build --verbosity detailed

.csproj Template

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>disable</ImplicitUsings>
    <NoWarn>MSB3277</NoWarn>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Aspose.Diagram">
      <HintPath>..\..\libs\Aspose.Diagram.dll</HintPath>
    </Reference>
  </ItemGroup>
</Project>

Testing Guide

Build Verification

dotnet build  # Must exit with rc=0, zero compiler errors

Run Verification

dotnet run    # rc=0 = pass, rc!=0 with unhandled exception = fail

Expected Output Patterns

PatternMeaning
rc=0✅ Pass — example compiled and ran successfully
rc=1 compiler errors❌ Fail — CS error codes indicate API misuse
rc!=0 runtime⚠️ Check — may be acceptable (missing input file)
TIMEOUT✅ Pass — Console.ReadLine() treated as successful completion

Common CS Error Codes

CodeMeaningFix
CS1061Member does not existCheck correct property/method name
CS0200Property is read-onlyAccess via .Value instead of assignment
CS0029Cannot convert typeUse correct enum type (BOOL not bool)
CS0117Name does not exist in typeCheck enum member name casing
CS0234Namespace not foundAdd correct using directive

Pipeline

AttemptStrategyTrigger
1MCP direct retrieval + code assemblyAlways
2MCP retrieval with injected rulesAttempt 1 fails
3LLM repair with compiler errors + rulesAttempt 2 fails

Only examples that pass both dotnet build and dotnet run are committed.

General Tips

  • See root agents.md for repository-wide boundaries, anti-patterns, domain knowledge, and testing guidelines
  • Always check rules/rules.json for the latest API correction rules
  • SaveFileFormat enum must always be PascalCase: Vsdx, Pdf, Png, Jpeg, Svg, Html — never ALL_CAPS
  • Diagram class does NOT implement IDisposable — never use using (Diagram ...)

Key API Surface

  • AddShape
  • ConnectShapesViaConnector
  • Diagram
  • Fonts
  • HTMLSaveOptions
  • ImageSaveOptions
  • Page
  • Pages
  • PdfSaveOptions
  • Prop
  • SVGSaveOptions
  • Save
  • Shape
  • Shapes
  • diagram
  • page
  • shape

Real-World Use Cases

Common scenarios where Aspose.Diagram for .NET drawing capabilities are applied in production applications:

  • Drawing custom shapes and annotations programmatically
  • Generating technical drawings from coordinate data
  • Creating geometric diagrams for educational or engineering use

Developer Q&A

Frequently asked questions about Drawing in Aspose.Diagram for .NET:

Q: How do I get started with Drawing in Aspose.Diagram for .NET?

A: Add a reference to Aspose.Diagram.dll (v26.9.0), include using Aspose.Diagram; and using Aspose.Diagram.Saving;, then use Diagram diagram = new Diagram("input.vsdx"); to load a file. All examples in this category target net8.0.

Q: Why do I get CS1674 when using using (Diagram diagram = ...)?

A: Diagram does not implement IDisposable in Aspose.Diagram for .NET. Remove the using statement and declare the variable normally: Diagram diagram = new Diagram("input.vsdx");

Q: Why does my code fail with CS0117 on SaveFileFormat.VSDX?

A: SaveFileFormat enum members use PascalCase in Aspose.Diagram for .NET. Use SaveFileFormat.Vsdx (not VSDX). The same applies to all formats: SaveFileFormat.Pdf, SaveFileFormat.Png, SaveFileFormat.Svg.

Q: Why do I get CS0029 when assigning true to a BOOL property?

A: Aspose.Diagram uses its own BOOL enumeration type, not C# bool. Use BOOL.True and BOOL.False instead of plain true/false for all Aspose.Diagram BOOL properties.

Related Categories

Category Statistics

  • Total examples: 125
  • Failed: 0
  • Pass rate: 100.0%

Failed Tasks

All tasks passed ✅


Updated: 2026-09-24 | Examples: 125 | Pass Rate: 100.0% | ↑ Root agents.md | Aspose.Diagram for .NET

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.