An unofficial extension library enhanced for GstarCAD .NET SDK
$ dotnet add package DrawableViewerThis is an unofficial extension library enhanced for GstarCAD .NET SDK.
You can get GstarCAD SDK on the official website https://www.gstarcad.com/download/, or on the Nuget Gallery.
Windows forms sample can be written:
using (var circle = new Circle(Point3d.Origin, Vector3d.ZAxis, 100))
using (var form = new Form { Size = new Size(300, 350) })
{
var viewer = new DrawableViewer() { Dock = DockStyle.Fill };
viewer.Add(circle);
viewer.ZoomExtents();
viewer.CanMouseOperation = false;
form.Controls.Add(viewer);
form.ShowDialog();
}
The xaml file can be written:
<Window x:Class="DrawableViewer.Test.WpfViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dv="http://shaprer.gstarcad.extensions/xaml"
Height="450" Width="800">
<Grid>
<WindowsFormsHost Grid.Row="0" Grid.Column="0" Margin="10"
dv:DrawableViewerBehavior.DrawableObject="{Binding Drawable}"
dv:DrawableViewerBehavior.AutoZoomingWhenDrawableChanged="True"
dv:DrawableViewerBehavior.CanMouseOperation="False">
<dv:DrawableViewer />
</WindowsFormsHost>
</Grid>
</Window>
> build.bat
If 'msbuild' is not recognized, please set compilation environment firstly.
This library is published as a nuget package in nuget.org.