Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

PropertyGrid + Combobox

16K
23 марта 2006 года
sclif13
6 / / 23.03.2006
Пишу тут программку и вней связал datagridview и propertygrid почитав здесь http://www.rsdn.ru/Forum/?mid=1267835
вот только вопрос как мне теперь добавить в propertygrid combobox?
273
23 марта 2006 года
3A3-968M
1.2K / / 22.12.2005
Цитата:
Originally posted by sclif13
Пишу тут программку и вней связал datagridview и propertygrid почитав здесь http://www.rsdn.ru/Forum/?mid=1267835
вот только вопрос как мне теперь добавить в propertygrid combobox?


Смотри переписку
http://forum.codenet.ru/showthread.php?s=&threadid=30196

16K
23 марта 2006 года
sclif13
6 / / 23.03.2006
Посмотрел!
мне не подействиям нужно
мне нужно как тыкаешь на опцию с боку появляется стрелка вниз ее нажимаешь и вываливается
combobox со значениями из базы! тут как-то надо преобразовать propertygrid
273
23 марта 2006 года
3A3-968M
1.2K / / 22.12.2005
Не понял, чем тебе тот вариант не устраивает? Ты просто заменяешь PropertyGrid'овый комбо на свой. Другие попытки разрулить PropertyGrid на combobox закончились ничем....
16K
24 марта 2006 года
sclif13
6 / / 23.03.2006
А через Typeconverter нельзя что-ли?
16K
24 марта 2006 года
sclif13
6 / / 23.03.2006
Вот нашел пример!

For example, if you have a string property that you want to limit to a few
choices, create a class like this:
public class MyConverter : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext
context)
{
//true means show a combobox
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext
context)
{
//true will limit to list. false will show the list, but allow free-form
entry
return true;
}

public override
System.ComponentModel.TypeConverter.StandardValuesCollection
GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(
new string[] { "entry1", "entry2", "entry3" });
}

}

Then hook it up to your property like this: (note the [TypeConverter]
attribute)
private string _myProp = "entry1";
[Browsable(true)]
[DefaultValue("entry1")]
[CategoryAttribute("Behavior")]
[TypeConverter(typeof(MyConverter))]
public string MyProp
{
get{ return _myprop;}
set{ _myprop = value;}
}
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог