File: DesignerOptionServiceExt.cs
Web Access
Project: src\src\System.Windows.Forms\tests\IntegrationTests\DesignSurface\DesignSurfaceExt\DesignSurfaceExt.csproj (DesignSurfaceExt)
using System.ComponentModel.Design;
using System.Windows.Forms.Design;
 
namespace DesignSurfaceExt;
 
internal sealed class DesignerOptionServiceExt4SnapLines : DesignerOptionService
{
    public DesignerOptionServiceExt4SnapLines() : base() { }
 
    protected override void PopulateOptionCollection(DesignerOptionCollection options)
    {
        if (options.Parent is not null)
            return;
 
        DesignerOptions ops = new()
        {
            UseSnapLines = true,
            UseSmartTags = true
        };
        DesignerOptionCollection wfd = CreateOptionCollection(options, "WindowsFormsDesigner", null);
        CreateOptionCollection(wfd, "General", ops);
    }
}
 
internal sealed class DesignerOptionServiceExt4Grid : DesignerOptionService
{
    private System.Drawing.Size _gridSize;
 
    public DesignerOptionServiceExt4Grid(System.Drawing.Size gridSize) : base() { _gridSize = gridSize; }
 
    protected override void PopulateOptionCollection(DesignerOptionCollection options)
    {
        if (options.Parent is not null)
            return;
 
        DesignerOptions ops = new()
        {
            GridSize = _gridSize,
            SnapToGrid = true,
            ShowGrid = true,
            UseSnapLines = false,
            UseSmartTags = true
        };
        DesignerOptionCollection wfd = CreateOptionCollection(options, "WindowsFormsDesigner", null);
        CreateOptionCollection(wfd, "General", ops);
    }
}
 
internal sealed class DesignerOptionServiceExt4GridWithoutSnapping : DesignerOptionService
{
    private System.Drawing.Size _gridSize;
 
    public DesignerOptionServiceExt4GridWithoutSnapping(System.Drawing.Size gridSize) : base() { _gridSize = gridSize; }
 
    protected override void PopulateOptionCollection(DesignerOptionCollection options)
    {
        if (options.Parent is not null)
            return;
 
        DesignerOptions ops = new()
        {
            GridSize = _gridSize,
            SnapToGrid = false,
            ShowGrid = true,
            UseSnapLines = false,
            UseSmartTags = true
        };
        DesignerOptionCollection wfd = CreateOptionCollection(options, "WindowsFormsDesigner", null);
        CreateOptionCollection(wfd, "General", ops);
    }
}
 
internal sealed class DesignerOptionServiceExt4NoGuides : DesignerOptionService
{
    public DesignerOptionServiceExt4NoGuides() : base() { }
 
    protected override void PopulateOptionCollection(DesignerOptionCollection options)
    {
        if (options.Parent is not null)
            return;
 
        DesignerOptions ops = new()
        {
            GridSize = new System.Drawing.Size(8, 8),
            SnapToGrid = false,
            ShowGrid = false,
            UseSnapLines = false,
            UseSmartTags = true
        };
        DesignerOptionCollection wfd = CreateOptionCollection(options, "WindowsFormsDesigner", null);
        CreateOptionCollection(wfd, "General", ops);
    }
}