Export (0) Print
Expand All

DesignerOptionService.Options Property

Gets the options collection for this service.

Namespace:  System.ComponentModel.Design
Assembly:  System (in System.dll)

public DesignerOptionService.DesignerOptionCollection Options { get; }

There is always a global options collection that contains child collections.

The following code example shows how you can navigate the collections by named indexers so you can get the value of the GridSize option. All three variations return the same value.

// 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;

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft