Skybound Rebar

RebarTheme.IsReadOnly Property

Gets or sets a value that indicates whether the color properties of this scheme may only be read.

[Visual Basic]
Protected Property IsReadOnly As Boolean
[C#]
protected bool IsReadOnly {get; set;}

Property Value

True if the properties of this scheme may only be read; otherwise, false, and they may be read and written.

Remarks

When making a preset for a custom theme, set this property to true after all the properties of the preset have been set. Otherwise, leave this property false, and the properties of new, empty instances of your theme will be able to be set to custom values.

Example

This example displays the members from a custom theme class called SpecialTheme. It demonstrates how to use IsReadOnly and AssertNotReadOnly (drawing code is omitted for clarity).

/// <summary>
/// Initializes a new instance of a <see cref="SpecialTheme"/>.
/// </summary>
public SpecialTheme()
{
}

/// <summary>Private constructor for presets.</summary>
private SpecialTheme(bool readOnly)
{
    this.IsReadOnly = readOnly;
}

static SpecialTheme()
{
    // create the preset object
    _Blue = new SpecialTheme(true);
    
    // assign the field values directly to avoid the set assessor
    _Blue.BackColor = Color._DarkBlue;
    _Blue.TextColor = Color._LightBlue;
}

/// <summary>
/// Gets the special theme preset which uses blue colors.
/// </summary>
public static SpecialTheme Blue
{
    get { return _Blue; }
}
static SpecialTheme _Blue;

/// <summary>
/// Gets or sets the background color of a rebar.
/// </summary>
/// <value>A <see cref="Color"/> structure representing the background color of a rebar.</value>
public Color BackColor
{
    get { return _BackColor; }
    set { AssertNotReadOnly(); _BackColor = value; }
}
Color _BackColor;

/// <summary>
/// Gets or sets the color of text on a rebar.
/// </summary>
/// <value>A <see cref="Color"/> structure representing the color of text on a rebar.</value>
public Color TextColor
{
    get { return _TextColor; }
    set { AssertNotReadOnly(); _TextColor = value; }
}
Color _TextColor;

See Also

RebarTheme Class | Skybound.Rebar.Rendering Namespace