public void Setup() { #region set up the form string paletteFile = @"ColourTables\gameboy.act"; _palette = Palette.FromFile(paletteFile); string paletteName = Path.GetFileNameWithoutExtension(paletteFile); _hap = new HasAPaletteProperty(_palette, paletteName); _pg = new PropertyGrid(); _pg.Dock = DockStyle.Fill; _pg.SelectedObject = _hap; _form = new Form(); _form.Controls.Add(_pg); _form.Show(); #endregion #region get the PaletteConverter from the form PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(_pg.SelectedObject, true); foreach (PropertyDescriptor pd in pdc) { string name = pd.Name; if (name == "ThePalette") { // it's the palette property - get its PaletteConverter _converter = pd.Converter; } } #endregion }
public void Setup() { #region set up the form string paletteFile = @"ColourTables\gameboy.act"; _palette = Palette.FromFile( paletteFile ); string paletteName = Path.GetFileNameWithoutExtension( paletteFile ); _hap = new HasAPaletteProperty( _palette, paletteName ); _pg = new PropertyGrid(); _pg.Dock = DockStyle.Fill; _pg.SelectedObject = _hap; _form = new Form(); _form.Controls.Add( _pg ); _form.Show(); #endregion #region get the PaletteConverter from the form PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties( _pg.SelectedObject, true ); foreach( PropertyDescriptor pd in pdc ) { string name = pd.Name; if( name == "ThePalette" ) { // it's the palette property - get its PaletteConverter _converter = pd.Converter; } } #endregion }