IDesignerOptionService.GetOptionValue(String, String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the value of the specified Windows Forms Designer option.
public:
System::Object ^ GetOptionValue(System::String ^ pageName, System::String ^ valueName);
public object GetOptionValue (string pageName, string valueName);
public object? GetOptionValue (string pageName, string valueName);
abstract member GetOptionValue : string * string -> obj
Public Function GetOptionValue (pageName As String, valueName As String) As Object
- pageName
- String
The name of the page that defines the option.
- valueName
- String
The name of the option property.
The value of the specified option.
The following code example demonstrates using the GetOptionValue method to query for the value of the GridSize
option.
// Obtains and shows the size of the standard design-mode grid square.
System::Drawing::Size size = *dynamic_cast<System::Drawing::Size^>(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "GridSize" ));
// Obtains and shows the size of the standard design-mode grid square.
Size size = (Size)designerOptionService.GetOptionValue("WindowsFormsDesigner\\General", "GridSize");
' Obtains and shows the size of the standard design-mode grid square.
Dim size As Size = CType(designerOptionService.GetOptionValue("WindowsFormsDesigner\General", "GridSize"), Size)
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:
Value Name | Value Format | Description |
---|---|---|
GridSize | Size | The size of each grid square. |
GridSize.Width | Int32 | The width of each grid square. This nested property is read-only when accessed through the designer option service. |
GridSize.Height | Int32 | The height of each grid square. This nested property is read-only when accessed through the designer option service. |
ShowGrid | Boolean | true if the grid should be shown; false if the grid should not be shown. |
SnapToGrid | Boolean | 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 | Boolean | true to allow a component's smart tag panel to open automatically upon creation; otherwise, false . |
AutoToolboxPopulate | Boolean | true to automatically add a solution's custom controls and components to the Toolbox; otherwise, false . |
UseOptimizedCodeGeneration | Boolean | true if the component cache is enabled; otherwise, false . |
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: