IDesignerOptionService.GetOptionValue(String, String) 方法     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指定的 Windows 窗体设计器选项的值。
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 -> objPublic Function GetOptionValue (pageName As String, valueName As String) As Object参数
- pageName
- String
定义该选项的页的名称。
- valueName
- String
该选项属性的名称。
返回
指定选项的值。
示例
下面的代码示例演示如何使用 GetOptionValue 方法来查询 选项的值 GridSize 。
// 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)
注解
参数 pageName 应包含“WindowsFormsDesigner\CategoryName”,其中 CategoryName 是选项类别名称,没有任何空格字符。 类别名称通常为“常规”。 因此,可以使用英文页面名称“WindowsFormsDesigner\General”访问“常规”设计器选项类别。
注意
页面和值名称始终应为英语。 因此,提供了下表来帮助你访问所需的选项。
下表指示英文值名称及其数据格式以及每个值的说明:
| 值名称 | 值格式 | 说明 | 
|---|---|---|
| GridSize | Size | 每个网格正方形的大小。 | 
| GridSize.Width | Int32 | 每个网格正方形的宽度。 通过设计器选项服务访问此嵌套属性时是只读的。 | 
| GridSize.Height | Int32 | 每个网格正方形的高度。 通过设计器选项服务访问此嵌套属性时是只读的。 | 
| ShowGrid | Boolean | true如果应显示网格,则为 ;false如果不应显示网格,则为 。 | 
| SnapToGrid | Boolean | true如果组件的位置应与网格对齐,则为 ;false如果位置不一定对齐,则为 。 | 
| LayoutMode | Microsoft.VisualStudio.Windows.Forms.LayoutMode | SnapLines使用对齐线,或SnapToGrid将控件与网格对齐, | 
| ObjectBoundSmartTagAutoShow | Boolean | 如果允许组件的智能标记面板在创建时自动打开,则为 true;否则为false。 | 
| AutoToolboxPopulate | Boolean | true将解决方案的自定义控件和组件自动添加到 工具箱;否则为false。 | 
| UseOptimizedCodeGeneration | Boolean | 如果启用组件缓存,则为 true;否则为false。 |