Hi, i wrote this class/component:
Code Snippet
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.ComponentModel;
namespace
MyComponentSet
{
public class FontStyle
{
private bool _fsBold = false;
private bool _fsItalic = false;
private bool _fsStrikeOut = false;
public FontStyle()
{
}
public FontStyle(bool fsBold, bool fsItalic, bool fsStrikeOut)
{
this.FsBold = fsBold;
this.FsItalic = fsItalic;
this.FsStrikeOut = fsStrikeOut;
}
~FontStyle()
{
}
public override string ToString()
{
return String.Format("FsBold = {0}, FsItalic = {1}, FsStrikeOut = {2}", new Object[] { FsBold.ToString(), FsItalic.ToString(), FsStrikeOut.ToString() });
}
public bool FsBold
{
get { return _fsBold; }
set
{
if (!value.Equals(_fsBold))
{
_fsBold =
value;
}
}
}
public bool FsItalic
{
get { return _fsItalic; }
set
{
if (!value.Equals(_fsItalic))
{
_fsItalic =
value;
}
}
}
public bool FsStrikeOut
{
get { return _fsStrikeOut; }
set
{
if (!value.Equals(_fsStrikeOut))
{
_fsStrikeOut =
value;
}
}
}
}
public class MyComponent : System.ComponentModel.Component
{
private FontStyle _fontStyle;
public MyComponent()
{
_fontStyle =
new FontStyle();
}
[
Description("Font Style."), Browsable(true)]
public FontStyle FontStyle
{
get { return _fontStyle; }
set
{
if (!value.Equals(_fontStyle))
{
_fontStyle =
value;
}
}
}
}
}
When i drop MyComponent into the form, the property FontStyle has no plus signal to expand the subproperties.
The Method ToString() returns "MyComponentSet.MyComponent" and in the Properties Window, the value os the FontStyle is "FsBold = False, FsItalic = False, FsStrikeOut = False".
What is wrong?
Thanks.