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;

Комментарии

Всегда существует глобальная коллекция параметров, содержащая дочерние коллекции.

Применяется к

См. также раздел