DesignerOptionService.Options 属性

定义

获取此服务的选项集合。

public:
 property System::ComponentModel::Design::DesignerOptionService::DesignerOptionCollection ^ Options { System::ComponentModel::Design::DesignerOptionService::DesignerOptionCollection ^ get(); };
public System.ComponentModel.Design.DesignerOptionService.DesignerOptionCollection Options { get; }
member this.Options : System.ComponentModel.Design.DesignerOptionService.DesignerOptionCollection
Public ReadOnly Property Options As DesignerOptionService.DesignerOptionCollection

属性值

用可用的设计器选项进行填充的 DesignerOptionService.DesignerOptionCollection

示例

下面的代码示例演示如何通过命名索引器导航集合,以便获取 选项的值 GridSize 。 所有三个变体都返回相同的值。

// Obtains and shows the size of the standard design-mode grid square.
PropertyDescriptor pd;
pd = designerOptionSvc.Options.Properties["GridSize"];
e.Graphics.DrawString("GridSize", 
    new Font("Arial", 8), 
    new SolidBrush(Color.Black), 4, ypos);
e.Graphics.DrawString(pd.GetValue(null).ToString(), 
    new Font("Arial", 8), 
    new SolidBrush(Color.Black), 200, ypos);
ypos += 12;

// Uncomment the following code to demonstrate that this
// alternate syntax works the same as the previous syntax.

//pd = designerOptionSvc.Options["WindowsFormsDesigner"].Properties["GridSize"];
//e.Graphics.DrawString("GridSize",
//    new Font("Arial", 8),
//    new SolidBrush(Color.Black), 4, ypos);
//e.Graphics.DrawString(pd.GetValue(null).ToString(),
//    new Font("Arial", 8),
//    new SolidBrush(Color.Black), 200, ypos);
//ypos += 12;

//pd = designerOptionSvc.Options["WindowsFormsDesigner"]["General"].Properties["GridSize"];
//e.Graphics.DrawString("GridSize",
//    new Font("Arial", 8),
//    new SolidBrush(Color.Black), 4, ypos);
//e.Graphics.DrawString(pd.GetValue(null).ToString(),
//    new Font("Arial", 8),
//    new SolidBrush(Color.Black), 200, ypos);
//ypos += 12;
' Obtains and shows the size of the standard design-mode grid square.
Dim pd As PropertyDescriptor
pd = designerOptionSvc.Options.Properties("GridSize")

e.Graphics.DrawString("GridSize", _
New Font("Arial", 8), _
New SolidBrush(Color.Black), 4, ypos)

e.Graphics.DrawString(pd.GetValue(Nothing).ToString(), _
New Font("Arial", 8), _
New SolidBrush(Color.Black), 200, ypos)

ypos += 12

' Uncomment the following code to demonstrate that this
' alternate syntax works the same as the previous syntax.
'pd = designerOptionSvc.Options["WindowsFormsDesigner"].Properties["GridSize"];
'e.Graphics.DrawString("GridSize",
'    new Font("Arial", 8),
'    new SolidBrush(Color.Black), 4, ypos);
'e.Graphics.DrawString(pd.GetValue(null).ToString(),
'    new Font("Arial", 8),
'    new SolidBrush(Color.Black), 200, ypos);
'ypos += 12;
'pd = designerOptionSvc.Options["WindowsFormsDesigner"]["General"].Properties["GridSize"];
'e.Graphics.DrawString("GridSize",
'    new Font("Arial", 8),
'    new SolidBrush(Color.Black), 4, ypos);
'e.Graphics.DrawString(pd.GetValue(null).ToString(),
'    new Font("Arial", 8),
'    new SolidBrush(Color.Black), 200, ypos);
'ypos += 12;

注解

始终有一个包含子集合的全局选项集合。

适用于

另请参阅