|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|
Создание собственного элемента управления18.02.2011, 16:02. Показов 22229. Ответов 12
Метки нет (Все метки)
Всем доброго время суток. Столкнулся с такой проблемой нужно создать пользовательский элемент MyCustomControl содержащий ползунок (trackBar), числовое поле (numericUpDown), метки (label) и рисунок. Сам пользовательский элемент я создал и все туда добавил. Вопрос как объединить все это, чтобы стал единый целый пользовательский элемент, который можно добавить на форму и меня его свойства, а не каждого из перечисленных выше элементов по отдельности. Может где то надо галочку добавить, или какие то свойства поменять я все просмотрел, но пока к сожалению ничего не нашел. Подскажите пожалуйста. Заранее огромное спасибо.
0
|
|
| 18.02.2011, 16:02 | |
|
Ответы с готовыми решениями:
12
Управление свойствами собственного элемента управления
В чем отличия пользовательского элемента управления от настраиваемого элемента управления? |
|
181 / 107 / 13
Регистрация: 22.03.2010
Сообщений: 456
|
||
| 18.02.2011, 17:09 | ||
|
Оттуда его перетаскиваешь как и другие элементы. Ну либо вручную пишешь в коде.
0
|
||
|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|
| 18.02.2011, 18:55 [ТС] | |
|
С начала я добавил элемент UserControl на него добавил (trackBar), числовое поле (numericUpDown), метки (label), он должен появиться в списке панели элементов, от куда его можно добавить на форму, но он почему то не появился в списке панели элементов. Вот что должно быть (рис. MyCustomControl и рис. Demo a custom user control)
0
|
|
|
181 / 107 / 13
Регистрация: 22.03.2010
Сообщений: 456
|
||
| 18.02.2011, 21:25 | ||
|
1
|
||
|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|
| 18.02.2011, 21:43 [ТС] | |
|
После того как собрал свой UserControl перестроил решение, UserControl появился на панели элементов. Добавил UserControl на форму. У меня три UserControl, соотвествующие трем цветам: red, blue, green зашел в свойство, чтобы выставить свойство ColorPart соотвественно: R,G,B, а там его нет и надо заменить значение метки Label на MyCustomControl его нет что еще нужно сделать. Подскажите пожалуйста. Помогите пожалуйста целый день сижу. Заранее огромное спасибо.
![]()
0
|
|
|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|||||||||||
| 18.02.2011, 23:08 [ТС] | |||||||||||
|
Вот код, для контрола:
Error 1 Ambiguity between 'CustomControl.MyCustomControl.component s' and 'CustomControl.MyCustomControl.component s' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 24 31 CustomControl Error 2 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 33 18 CustomControl Error 3 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 34 18 CustomControl Error 4 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 35 18 CustomControl Error 5 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 36 62 CustomControl Error 6 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 37 62 CustomControl Error 7 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 40 18 CustomControl Error 8 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 41 18 CustomControl Error 9 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 42 18 CustomControl Error 10 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 43 18 CustomControl Error 11 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 44 18 CustomControl Error 12 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 45 18 CustomControl Error 13 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 47 18 CustomControl Error 14 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 48 18 CustomControl Error 15 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 49 18 CustomControl Error 16 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 50 18 CustomControl Error 17 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 52 18 CustomControl Error 18 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 53 18 CustomControl Error 19 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 54 18 CustomControl Error 20 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 55 18 CustomControl Error 21 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 59 36 CustomControl Error 22 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 60 36 CustomControl Error 23 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 61 36 CustomControl Error 24 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 64 62 CustomControl Error 25 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 65 62 CustomControl Error 26 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 76 24 CustomControl Error 27 Ambiguity between 'CustomControl.MyCustomControl.labelLabe l' and 'CustomControl.MyCustomControl.labelLabe l' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 80 17 CustomControl Error 28 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 88 29 CustomControl Error 29 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 92 17 CustomControl Error 30 The call is ambiguous between the following methods or properties: 'CustomControl.MyCustomControl.Initializ eComponent()' and 'CustomControl.MyCustomControl.Initializ eComponent()' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 100 13 CustomControl Error 31 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 102 13 CustomControl Error 32 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 104 13 CustomControl Error 33 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 117 17 CustomControl Error 34 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 117 44 CustomControl Error 35 Ambiguity between 'CustomControl.MyCustomControl.trackBarV alue' and 'CustomControl.MyCustomControl.trackBarV alue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 127 17 CustomControl Error 36 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 127 44 CustomControl Error 37 Ambiguity between 'CustomControl.MyCustomControl.numericUp DownValue' and 'CustomControl.MyCustomControl.numericUp DownValue' C:\Users\Администратор\Documents\Visual Studio 2010\Projects\C#\CustomControl\CustomCon trol\MyCustomControl.cs 146 44 CustomControl Вот код для формы на которой находятся ползунки для выбора цвета:
![]()
0
|
|||||||||||
|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|
| 19.02.2011, 00:56 [ТС] | |
|
Ну как тогда свойства контрола определить я уже сутки бьюсь, оба кода правильных, че тогда делать. Помогите кто-нибудь
![]()
0
|
|
|
90 / 125 / 28
Регистрация: 17.10.2010
Сообщений: 1,321
|
|
| 19.02.2011, 12:51 [ТС] | |
|
Спасибо все работает тему можно закрыть
0
|
|
| 19.02.2011, 12:51 | |
|
Помогаю со студенческими работами здесь
13
Создание элемента управления,который скрывает/раскрывает некоторую панель Создание пользовательского элемента управления: заменить стандартный DropDown у ComboBox Создание собственного контрола
2D графика(создание собственного движка) Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |
|
Новые блоги и статьи
|
|||
|
SDL3 для Web (WebAssembly): Обработчик клика мыши в браузере ПК и касания экрана в браузере на мобильном устройстве
8Observer8 02.02.2026
Содержание блога
Для начала пошагово создадим рабочий пример для подготовки к экспериментам в браузере ПК и в браузере мобильного устройства. Потом напишем обработчик клика мыши и обработчик. . .
|
Философия технологии
iceja 01.02.2026
На мой взгляд у человека в технических проектах остается роль генерального директора. Все остальное нейронки делают уже лучше человека. Они не могут нести предпринимательские риски, не могут. . .
|
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога
В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
|
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 30.01.2026
Содержание блога
Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
|
|
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 30.01.2026
Содержание блога
Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
|
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога
Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
|
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования.
Часть библиотеки BedvitCOM
Использованы. . .
|
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога
SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
|