System.ComponentModel.Design.IDesignerOptionService.SetOptionValue Method

Sets the value of the specified Windows Forms Designer option.

Syntax

public void SetOptionValue (string pageName, string valueName, object value)

Parameters

pageName
The name of the page that defines the option.
valueName
The name of the option property.
value
The new value.

Remarks

The pageName parameter should consist of "WindowsFormsDesigner\CategoryName", where CategoryName is an options category name without any white space characters. The category name is typically "General". Therefore, you can access the "General" designer options category with the English page name "WindowsFormsDesigner\General".

Note:

The page and value names are always expected in English. Therefore, the following table is provided to help you access the options you want.

The following table indicates the English value names, their data format, and a description of each:

GridSize

System.Drawing.Size

The size of each grid square.

GridSize.Width

int

The width of each grid square. This nested property is read-only when accessed through the designer option service.

GridSize.Height

int

The height of each grid square. This nested property is read-only when accessed through the designer option service.

ShowGrid

bool

true if the grid should be shown; false if the grid should not be shown.

SnapToGrid

bool

true if the positions of the components should be aligned to the grid; false if the positions should not necessarily be aligned.

LayoutMode

Microsoft.VisualStudio.Windows.Forms.LayoutMode

SnapLines to use snaplines, or SnapToGrid to align controls to the grid,

ObjectBoundSmartTagAutoShow

bool

true to allow a component's smart tag panel to open automatically upon creation; otherwise, false.

AutoToolboxPopulate

bool

true to automatically add a solution's custom controls and components to the Toolbox; otherwise, false.

UseOptimizedCodeGeneration

bool

true if the component cache is enabled; otherwise, false.

Requirements

Namespace: System.ComponentModel.Design
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0