Форум программистов, компьютерный форум, киберфорум
C# Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.89/18: Рейтинг темы: голосов - 18, средняя оценка - 4.89
0 / 0 / 0
Регистрация: 16.12.2017
Сообщений: 44

Создание UML-диаграммы

09.06.2019, 18:06. Показов 3763. Ответов 5
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Как бы сделать к этой программе диаграмму, не очень в них разбираюсь
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    public partial class Form1 : Form
    {
        private SortableBindingList<Apartment> Apartments = new SortableBindingList<Apartment>();
        public Form1()
        {
            InitializeComponent();
            dataGridView1.DataSource = Apartments;
            dataGridView1.Columns[0].HeaderText = "Кол-во комнат";
            dataGridView1.Columns[1].HeaderText = "Площадь";
            dataGridView1.Columns[2].HeaderText = "Район";
            dataGridView1.Columns[3].HeaderText = "Этаж";
            dataGridView1.Columns[4].HeaderText = "Кол-во комнат";
            dataGridView1.Columns[5].HeaderText = "Площадь";
            dataGridView1.Columns[6].HeaderText = "Район";
            dataGridView1.Columns[7].HeaderText = "Этаж";
        }
 
        private void AddButton_Click(object sender, EventArgs e)
        {
            SearchandAdd();
        }
        public void SearchandAdd()
        {
            label6.Text = "";
            AddRequest AR = new AddRequest();
            if (AR.ShowDialog() == DialogResult.OK)
            {
                byte rooms = Convert.ToByte(AR.textBox1.Text);
                double square = Convert.ToDouble(AR.textBox2.Text);
                string region = AR.textBox3.Text;
                byte floor = Convert.ToByte(AR.textBox4.Text);
                byte roomsn = Convert.ToByte(AR.textBox5.Text);
                double squaren = Convert.ToDouble(AR.textBox6.Text);
                string regionn = AR.textBox7.Text;
                byte floorn = Convert.ToByte(AR.textBox8.Text);
                if (Apartments.Count == 0) Apartments.Add(new Apartment(rooms, square, region, floor, roomsn, squaren, regionn, floorn));
                else
                {
                    var xapartment = Apartments.Where(t => t.Rooms == roomsn && t.Floor == floorn && t.RoomsN == rooms && t.FloorN == floor && 0 <= Math.Abs(t.Square - squaren) / (t.Square + squaren) / 2 * 0.01 && Math.Abs(t.Square - squaren) / (t.Square + squaren) / 2 * 0.01 <= 10 && 0 <= Math.Abs(t.SquareN - square) / (t.SquareN + square) / 2 * 0.01 && Math.Abs(t.SquareN - square) / (t.SquareN + square) / 2 * 0.01 <= 10).FirstOrDefault();
                    {
                        if (xapartment != null)
                        {
                            Apartments.Remove(xapartment);
                            label6.Text="Ваша новая " + AR.textBox5.Text + "-комнатная квартира площадью " + AR.textBox6.Text + " кв.м. находится на " + AR.textBox8.Text + " этаже в районе " + regionn;
                        }
                        else  Apartments.Add(new Apartment(rooms, square, region, floor, roomsn, squaren, regionn, floorn));
                    }
                }
                dataGridView1.DataSource = Apartments;
            }
        }
    }
 
    public class Apartment
    {
        public byte Rooms { get; set; }
        public double Square { get; set; }
        public string Region { get; set; }
        public byte Floor { get; set; }
        public byte RoomsN { get; set; }
        public double SquareN { get; set; }
        public string RegionN { get; set; }
        public byte FloorN { get; set; }
        public Apartment(byte rooms, double square, string region, byte floor, byte roomsN, double squareN, string regionN, byte floorN)
        {
            Rooms = rooms;
            Square = square;
            Region = region;
            Floor = floor;
            RoomsN = roomsN;
            SquareN = squareN;
            RegionN = regionN;
            FloorN = floorN;
        }
    }
    public class SortableBindingList<T> : BindingList<T>
    {
        private readonly Dictionary<Type, PropertyComparer<T>> comparers;
        private bool isSorted;
        private ListSortDirection listSortDirection;
        private PropertyDescriptor propertyDescriptor;
 
        public SortableBindingList()
            : base(new List<T>())
        {
            this.comparers = new Dictionary<Type, PropertyComparer<T>>();
        }
 
        public SortableBindingList(IEnumerable<T> enumeration)
            : base(new List<T>(enumeration))
        {
            this.comparers = new Dictionary<Type, PropertyComparer<T>>();
        }
 
        protected override bool SupportsSortingCore
        {
            get { return true; }
        }
 
        protected override bool IsSortedCore
        {
            get { return this.isSorted; }
        }
 
        protected override PropertyDescriptor SortPropertyCore
        {
            get { return this.propertyDescriptor; }
        }
 
        protected override ListSortDirection SortDirectionCore
        {
            get { return this.listSortDirection; }
        }
 
        protected override bool SupportsSearchingCore
        {
            get { return true; }
        }
 
        protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
        {
            List<T> itemsList = (List<T>)this.Items;
 
            Type propertyType = property.PropertyType;
            PropertyComparer<T> comparer;
            if (!this.comparers.TryGetValue(propertyType, out comparer))
            {
                comparer = new PropertyComparer<T>(property, direction);
                this.comparers.Add(propertyType, comparer);
            }
 
            comparer.SetPropertyAndDirection(property, direction);
            itemsList.Sort(comparer);
 
            this.propertyDescriptor = property;
            this.listSortDirection = direction;
            this.isSorted = true;
 
            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
        }
 
        protected override void RemoveSortCore()
        {
            this.isSorted = false;
            this.propertyDescriptor = base.SortPropertyCore;
            this.listSortDirection = base.SortDirectionCore;
 
            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
        }
 
        protected override int FindCore(PropertyDescriptor property, object key)
        {
            int count = this.Count;
            for (int i = 0; i < count; ++i)
            {
                T element = this[i];
                if (property.GetValue(element).Equals(key))
                {
                    return i;
                }
            }
 
            return -1;
        }
    }
 
    public class PropertyComparer<T> : IComparer<T>
    {
        private readonly IComparer comparer;
        private PropertyDescriptor propertyDescriptor;
        private int reverse;
 
        public PropertyComparer(PropertyDescriptor property, ListSortDirection direction)
        {
            this.propertyDescriptor = property;
            Type comparerForPropertyType = typeof(Comparer<>).MakeGenericType(property.PropertyType);
            this.comparer = (IComparer)comparerForPropertyType.InvokeMember("Default", BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.Public, null, null, null);
            this.SetListSortDirection(direction);
        }
 
        #region IComparer<T> Members
 
        public int Compare(T x, T y)
        {
            return this.reverse * this.comparer.Compare(this.propertyDescriptor.GetValue(x), this.propertyDescriptor.GetValue(y));
        }
 
        #endregion
 
        private void SetPropertyDescriptor(PropertyDescriptor descriptor)
        {
            this.propertyDescriptor = descriptor;
        }
 
        private void SetListSortDirection(ListSortDirection direction)
        {
            this.reverse = direction == ListSortDirection.Ascending ? 1 : -1;
        }
 
        public void SetPropertyAndDirection(PropertyDescriptor descriptor, ListSortDirection direction)
        {
            this.SetPropertyDescriptor(descriptor);
            this.SetListSortDirection(direction);
        }
    }
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
09.06.2019, 18:06
Ответы с готовыми решениями:

Создание круговой диаграммы брать данные для диаграммы из dataGridView1 ?
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using...

Создание круговой диаграммы
Здравствуйте. Я написала код, все необходимое, но почему-то программа не работает. Я ввожу значения, нажимаю построить и выскакивает...

Спроектировать UML-диаграммы классов: Интернет-оператор – Тариф – Абонент
Спроектировать UML-диаграммы классов согласно варианту индивидуального задания. В каждом классе предусмотреть поля (2-4), свойства (2-4) и...

5
 Аватар для ashsvis
923 / 503 / 202
Регистрация: 08.10.2018
Сообщений: 1,553
Записей в блоге: 11
09.06.2019, 18:56
Цитата Сообщение от bulat24 Посмотреть сообщение
сделать к этой программе диаграмму
Разве сначала не диаграмму делают, а потом по ней программу?
0
0 / 0 / 0
Регистрация: 16.12.2017
Сообщений: 44
09.06.2019, 19:01  [ТС]
Как бы да, но код то редактировать легче(да, это неправильный подход, но всё же...)
0
 Аватар для shelluser
146 / 39 / 26
Регистрация: 11.05.2019
Сообщений: 122
09.06.2019, 19:33
Цитата Сообщение от ashsvis Посмотреть сообщение
Разве сначала не диаграмму делают, а потом по ней программу?
А какая разница? Диаграмма это всего лишь схема, которая сто раз может измениться по
мере разработки приложения. Диаграмма это же не закон, нужна чтобы помочь в разработке.

Ах да , по теме

Цитата Сообщение от bulat24 Посмотреть сообщение
Как бы сделать к этой программе диаграмму,
Подробно описано
https://docs.microsoft.com/en-... ew=vs-2019

Добавлено через 6 минут
видео на ютюбе можно посмотреть
https://www.youtube.com/watch?v=SsP_LabcMao
основное где-то с 3:45
0
 Аватар для ashsvis
923 / 503 / 202
Регистрация: 08.10.2018
Сообщений: 1,553
Записей в блоге: 11
09.06.2019, 19:34
Цитата Сообщение от shelluser Посмотреть сообщение
А какая разница?
Разница в том, что диаграмма как раз и помогает избежать многочисленные (и порой, бестолковые) переделки программы.
0
 Аватар для shelluser
146 / 39 / 26
Регистрация: 11.05.2019
Сообщений: 122
09.06.2019, 19:35
Цитата Сообщение от ashsvis Посмотреть сообщение
что диаграмма как раз и помогает избежать многочисленные (и порой, бестолковые) переделки программы.
А кто говорил что нет?

Есть проект и хотелось бы иметь по нему диаграмму. Так же тоже бывает.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
09.06.2019, 19:35
Помогаю со студенческими работами здесь

Создать программу – UML-редактор, позволяющий конструировать статические диаграммы классов
Добрый день. Помогите пожалуйста советом с чего начать и как лучше было бы выполнить это задание. Если у кого-то есть наработки по этому...

Создание диаграммы
Как можно создать точечную диаграмму (как в excel) в c#?

Создание диаграммы в Excel
Почему это ObjExcel.ActiveChart.ChartType = Excel.XlChartType.xlLineMarkers; Строит график который обведен красным? Надо чтобы строил...

Создание uml диаграммы
Понадобилось создать uml диаграмму на основе кода c++. В таких инструментах как VisualStudio 2010 или StarUML есть возможность...

Создание UML диаграммы классов
Помогите описать код программы используя диаграмму классов. Или хотя бы подскажите как это сделать.Зарание спс. File1.cpp #include...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
6
Ответ Создать тему
Новые блоги и статьи
Воспроизведение звукового файла с помощью SDL3_mixer при касании экрана Android
8Observer8 26.01.2026
Содержание блога SDL3_mixer - это библиотека я для воспроизведения аудио. В отличие от инструкции по добавлению текста код по проигрыванию звука уже содержится в шаблоне примера. Нужно только. . .
Установка Android SDK, NDK, JDK, CMake и т.д.
8Observer8 25.01.2026
Содержание блога Перейдите по ссылке: https:/ / developer. android. com/ studio и в самом низу страницы кликните по архиву "commandlinetools-win-xxxxxx_latest. zip" Извлеките архив и вы увидите. . .
Вывод текста со шрифтом TTF на Android с помощью библиотеки SDL3_ttf
8Observer8 25.01.2026
Содержание блога Если у вас не установлены Android SDK, NDK, JDK, и т. д. то сделайте это по следующей инструкции: Установка Android SDK, NDK, JDK, CMake и т. д. Сборка примера Скачайте. . .
Использование SDL3-callbacks вместо функции main() на Android, Desktop и WebAssembly
8Observer8 24.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
моя боль
iceja 24.01.2026
Выложила интерполяцию кубическими сплайнами www. iceja. net REST сервисы временно не работают, только через Web. Написала за 56 рабочих часов этот сайт с нуля. При помощи perplexity. ai PRO , при. . .
Модель сукцессии микоризы
anaschu 24.01.2026
Решили писать научную статью с неким РОманом
http://iceja.net/ математические сервисы
iceja 20.01.2026
Обновила свой сайт http:/ / iceja. net/ , приделала Fast Fourier Transform экстраполяцию сигналов. Однако предсказывает далеко не каждый сигнал (см ограничения http:/ / iceja. net/ fourier/ docs ). Также. . .
http://iceja.net/ сервер решения полиномов
iceja 18.01.2026
Выкатила http:/ / iceja. net/ сервер решения полиномов (находит действительные корни полиномов методом Штурма). На сайте документация по API, но скажу прямо VPS слабенький и 200 000 полиномов. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru