Блок схема windows form

Block-Diagram-App

Windows Forms block diagram app

DISCLAIMER:

Project was produced in span of approximately 5h as school project (1st project in Windows Forms).
The code does not represent actual state of programming knowledge of author.
The project has functions inspired by code from https://www.geeksforgeeks.org, which are used to determin if point is in ellipse or rhomboid.

DESCRIPTION:

Create new diagram — ‘Nowy schemat’ button

Save diagram — ‘Zapisz schemat’ button

Load diagram — ‘Wczytaj schemat’ button

Choose diagram element — ‘Edycja’ box buttons

Change text of elematn — ‘Tekst zaznaczonego bloku’ text box

Change language — ‘Język’ box buttons (not implemented)

FEATURES:

Scrollable bitmap. Save/load function with own extension (*.bq) format. Limit of start blocks (only 1 per diagram). Selecting and changing text content of block (stop and start blocks are unchangeable).
New diagram pop-up window with height and length options. Deleting blocks deletes outgoing arrows. Moving selected diagram elemants (however arrows stays in place — not implemented arrow movement with blocks).

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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
#pragma once
 
 
namespace курсач {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Data::SqlServerCe;
 
    using namespace System::IO;
 
    /// <summary>
    /// Сводка для Form1
    ///
    /// Внимание! При изменении имени этого класса необходимо также изменить
    ///          свойство имени файла ресурсов ("Resource File Name") для средства компиляции управляемого ресурса,
    ///          связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,
    ///          конструкторы не смогут правильно работать с локализованными
    ///          ресурсами, сопоставленными данной форме.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: добавьте код конструктора
            //
            textBox1->Visible=false;
            textBox2->Visible=false;
            textBox3->Visible=false;
            textBox4->Visible=false;
            textBox5->Visible=false;
            textBox6->Visible=false;
            textBox7->Visible=false;
            textBox8->Visible=false;
            textBox9->Visible=false;
        }
        
 
    protected:
        /// <summary>
        /// Освободить все используемые ресурсы.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Button^  button1;
    protected: 
    private: System::Windows::Forms::Button^  button2;
 
    private: System::Windows::Forms::Button^  button4;
    private: System::Windows::Forms::ListView^  listView1;
    private: System::Windows::Forms::ColumnHeader^  columnHeader1;
    private: System::Windows::Forms::ColumnHeader^  columnHeader2;
    private: System::Windows::Forms::ColumnHeader^  columnHeader3;
    private: System::Windows::Forms::ColumnHeader^  columnHeader4;
    private: System::Windows::Forms::ColumnHeader^  columnHeader5;
    private: System::Windows::Forms::ColumnHeader^  columnHeader6;
    private: System::Windows::Forms::ColumnHeader^  columnHeader7;
    private: System::Windows::Forms::ColumnHeader^  columnHeader8;
    private: System::Windows::Forms::ColumnHeader^  columnHeader9;
    private: System::Windows::Forms::ColumnHeader^  columnHeader10;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::TextBox^  textBox3;
    private: System::Windows::Forms::TextBox^  textBox4;
    private: System::Windows::Forms::TextBox^  textBox5;
    private: System::Windows::Forms::TextBox^  textBox6;
    private: System::Windows::Forms::TextBox^  textBox7;
    private: System::Windows::Forms::TextBox^  textBox8;
    private: System::Windows::Forms::TextBox^  textBox9;
    private: System::Windows::Forms::TextBox^  textBox10;
 
 
 
 
 
 
 
 
 
 
    private: System::Windows::Forms::Button^  button6;
    private: System::Windows::Forms::Button^  button7;
    private: System::Windows::Forms::Button^  button8;
    private: System::Windows::Forms::Panel^  panel1;
 
    private:
        /// <summary>
        /// Требуется переменная конструктора.
        /// </summary>
        System::ComponentModel::Container ^components;
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Обязательный метод для поддержки конструктора - не изменяйте
        /// содержимое данного метода при помощи редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->button4 = (gcnew System::Windows::Forms::Button());
            this->listView1 = (gcnew System::Windows::Forms::ListView());
            this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader4 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader5 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader6 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader7 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader8 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader9 = (gcnew System::Windows::Forms::ColumnHeader());
            this->columnHeader10 = (gcnew System::Windows::Forms::ColumnHeader());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->textBox3 = (gcnew System::Windows::Forms::TextBox());
            this->textBox4 = (gcnew System::Windows::Forms::TextBox());
            this->textBox5 = (gcnew System::Windows::Forms::TextBox());
            this->textBox6 = (gcnew System::Windows::Forms::TextBox());
            this->textBox7 = (gcnew System::Windows::Forms::TextBox());
            this->textBox8 = (gcnew System::Windows::Forms::TextBox());
            this->textBox9 = (gcnew System::Windows::Forms::TextBox());
            this->textBox10 = (gcnew System::Windows::Forms::TextBox());
            this->button6 = (gcnew System::Windows::Forms::Button());
            this->button7 = (gcnew System::Windows::Forms::Button());
            this->button8 = (gcnew System::Windows::Forms::Button());
            this->panel1 = (gcnew System::Windows::Forms::Panel());
            this->SuspendLayout();
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(560, 12);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(133, 27);
            this->button1->TabIndex = 0;
            this->button1->Text = L"Добавить";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(560, 45);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(133, 27);
            this->button2->TabIndex = 0;
            this->button2->Text = L"Поиск";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            // 
            // button4
            // 
            this->button4->Location = System::Drawing::Point(560, 78);
            this->button4->Name = L"button4";
            this->button4->Size = System::Drawing::Size(133, 27);
            this->button4->TabIndex = 0;
            this->button4->Text = L"Удалить";
            this->button4->UseVisualStyleBackColor = true;
            this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
            // 
            // listView1
            // 
            this->listView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(10) {this->columnHeader1, this->columnHeader2, 
                this->columnHeader3, this->columnHeader4, this->columnHeader5, this->columnHeader6, this->columnHeader7, this->columnHeader8, 
                this->columnHeader9, this->columnHeader10});
            this->listView1->FullRowSelect = true;
            this->listView1->GridLines = true;
            this->listView1->HideSelection = false;
            this->listView1->Location = System::Drawing::Point(12, 13);
            this->listView1->MultiSelect = false;
            this->listView1->Name = L"listView1";
            this->listView1->Size = System::Drawing::Size(528, 258);
            this->listView1->TabIndex = 1;
            this->listView1->UseCompatibleStateImageBehavior = false;
            this->listView1->View = System::Windows::Forms::View::Details;
            this->listView1->ColumnClick += gcnew System::Windows::Forms::ColumnClickEventHandler(this, &Form1::listView1_ColumnClick);
            this->listView1->ItemSelectionChanged += gcnew System::Windows::Forms::ListViewItemSelectionChangedEventHandler(this, &Form1::listView1_ItemSelectionChanged);
            this->listView1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::listView1_MouseDoubleClick);
            // 
            // columnHeader1
            // 
            this->columnHeader1->Text = L"cid";
            this->columnHeader1->Width = 0;
            // 
            // columnHeader2
            // 
            this->columnHeader2->Text = L"Номер поезда";
            this->columnHeader2->Width = 108;
            // 
            // columnHeader3
            // 
            this->columnHeader3->Text = L"Станция отправления";
            this->columnHeader3->Width = 106;
            // 
            // columnHeader4
            // 
            this->columnHeader4->Text = L"Станция прибытия";
            this->columnHeader4->Width = 114;
            // 
            // columnHeader5
            // 
            this->columnHeader5->Text = L"Время отправления";
            this->columnHeader5->Width = 118;
            // 
            // columnHeader6
            // 
            this->columnHeader6->Text = L"Дни отправления";
            this->columnHeader6->Width = 107;
            // 
            // columnHeader7
            // 
            this->columnHeader7->Text = L"Нал.Мест СВ";
            this->columnHeader7->Width = 81;
            // 
            // columnHeader8
            // 
            this->columnHeader8->Text = L"Нал.Мест купэ";
            this->columnHeader8->Width = 93;
            // 
            // columnHeader9
            // 
            this->columnHeader9->Text = L"Нал.Мест плац.";
            this->columnHeader9->Width = 97;
            // 
            // columnHeader10
            // 
            this->columnHeader10->Text = L"Нал.Мест общ.";
            this->columnHeader10->Width = 96;
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(23, 144);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(150, 20);
            this->textBox1->TabIndex = 2;
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(23, 170);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(150, 20);
            this->textBox2->TabIndex = 2;
            // 
            // textBox3
            // 
            this->textBox3->Location = System::Drawing::Point(23, 196);
            this->textBox3->Name = L"textBox3";
            this->textBox3->Size = System::Drawing::Size(150, 20);
            this->textBox3->TabIndex = 2;
            // 
            // textBox4
            // 
            this->textBox4->Location = System::Drawing::Point(179, 144);
            this->textBox4->Name = L"textBox4";
            this->textBox4->Size = System::Drawing::Size(150, 20);
            this->textBox4->TabIndex = 2;
            // 
            // textBox5
            // 
            this->textBox5->Location = System::Drawing::Point(179, 170);
            this->textBox5->Name = L"textBox5";
            this->textBox5->Size = System::Drawing::Size(150, 20);
            this->textBox5->TabIndex = 2;
            // 
            // textBox6
            // 
            this->textBox6->Location = System::Drawing::Point(179, 196);
            this->textBox6->Name = L"textBox6";
            this->textBox6->Size = System::Drawing::Size(150, 20);
            this->textBox6->TabIndex = 2;
            // 
            // textBox7
            // 
            this->textBox7->Location = System::Drawing::Point(335, 143);
            this->textBox7->Name = L"textBox7";
            this->textBox7->Size = System::Drawing::Size(150, 20);
            this->textBox7->TabIndex = 2;
            // 
            // textBox8
            // 
            this->textBox8->Location = System::Drawing::Point(335, 169);
            this->textBox8->Name = L"textBox8";
            this->textBox8->Size = System::Drawing::Size(150, 20);
            this->textBox8->TabIndex = 2;
            // 
            // textBox9
            // 
            this->textBox9->Location = System::Drawing::Point(335, 196);
            this->textBox9->Name = L"textBox9";
            this->textBox9->Size = System::Drawing::Size(150, 20);
            this->textBox9->TabIndex = 2;
            // 
            // textBox10
            // 
            this->textBox10->BackColor = System::Drawing::SystemColors::MenuBar;
            this->textBox10->BorderStyle = System::Windows::Forms::BorderStyle::None;
            this->textBox10->ForeColor = System::Drawing::SystemColors::MenuBar;
            this->textBox10->Location = System::Drawing::Point(393, 270);
            this->textBox10->Name = L"textBox10";
            this->textBox10->ReadOnly = true;
            this->textBox10->Size = System::Drawing::Size(147, 13);
            this->textBox10->TabIndex = 3;
            // 
            // button6
            // 
            this->button6->Location = System::Drawing::Point(560, 111);
            this->button6->Name = L"button6";
            this->button6->Size = System::Drawing::Size(133, 27);
            this->button6->TabIndex = 6;
            this->button6->Text = L"Построить диаграмму";
            this->button6->UseVisualStyleBackColor = true;
            this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
            // 
            // button7
            // 
            this->button7->Location = System::Drawing::Point(560, 144);
            this->button7->Name = L"button7";
            this->button7->Size = System::Drawing::Size(133, 27);
            this->button7->TabIndex = 7;
            this->button7->Text = L"Нал. своб. мест";
            this->button7->UseVisualStyleBackColor = true;
            this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
            // 
            // button8
            // 
            this->button8->Location = System::Drawing::Point(560, 177);
            this->button8->Name = L"button8";
            this->button8->Size = System::Drawing::Size(133, 27);
            this->button8->TabIndex = 8;
            this->button8->Text = L"Обновить";
            this->button8->UseVisualStyleBackColor = true;
            this->button8->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
            // 
            // panel1
            // 
            this->panel1->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
            this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
            this->panel1->Location = System::Drawing::Point(548, -9);
            this->panel1->Name = L"panel1";
            this->panel1->Size = System::Drawing::Size(5, 300);
            this->panel1->TabIndex = 27;
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->AutoSizeMode = System::Windows::Forms::AutoSizeMode::GrowAndShrink;
            this->ClientSize = System::Drawing::Size(705, 282);
            this->Controls->Add(this->panel1);
            this->Controls->Add(this->button8);
            this->Controls->Add(this->button7);
            this->Controls->Add(this->button6);
            this->Controls->Add(this->textBox10);
            this->Controls->Add(this->textBox9);
            this->Controls->Add(this->textBox8);
            this->Controls->Add(this->textBox7);
            this->Controls->Add(this->textBox6);
            this->Controls->Add(this->textBox5);
            this->Controls->Add(this->textBox4);
            this->Controls->Add(this->textBox3);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->listView1);
            this->Controls->Add(this->button4);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
            this->MaximizeBox = false;
            this->Name = L"Form1";
            this->Text = L"Расписание поездов";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
        private: void ShowDB()
             {
                SqlCeEngine^ engine =
                    gcnew SqlCeEngine("Data Source='schedule.sdf';");
                SqlCeConnection^ connection =
                    gcnew SqlCeConnection (engine->LocalConnectionString);
                connection->Open();
                SqlCeCommand^ command = connection->CreateCommand();
                command->CommandText = "SELECT * FROM schedule ORDER BY SOD";
                SqlCeDataReader^ dataReader = command->ExecuteReader();
                String^ st;
                int itemIndex = 0;
                listView1->Items->Clear();
                while (dataReader->Read())
                {
                    for(int i=0; i<dataReader->FieldCount; i++)
                    {
                        st = dataReader->GetValue(i)->ToString();
                        switch (i)
                        {
                        case 0:
                            listView1->Items->Add(st);
                            break;
                        case 1:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 2:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 3:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 4:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 5:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 6:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 7:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 8:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 9:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 10:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        };
                    }
                    itemIndex++;
                }
                connection->Close();
             }
 
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
 
                SqlCeEngine^ engine;
                engine = gcnew SqlCeEngine("Data Source='schedule.sdf';");
                ShowDB();
 
             }
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 
                Add^ add=gcnew Add; //Создаём переменную "add" формы Add
                add->Show();        //Показываем форму Add
             }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
 
                Search^ search=gcnew Search;
                search->Show();
    }
private: System::Void listView1_ItemSelectionChanged(System::Object^ sender, System::Windows::Forms::ListViewItemSelectionChangedEventArgs^ e)
    {
        if (e->IsSelected)
        {
            Change^ change=gcnew Change;
            textBox10->Text = listView1->Items[e->ItemIndex]->Text;
            for (int i = 1; i < listView1->Items[e->ItemIndex]->SubItems->Count; i++)
            {
                switch (i)
                {
                    case 1:
                        textBox1->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 2:
                        textBox2->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 3:
                        textBox3->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 4:
                        textBox4->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 5:
                        textBox5->Text =  listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 6:
                        textBox6->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 7:
                        textBox7->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 8:
                        textBox8->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                    case 9:
                        textBox9->Text = listView1->Items[e->ItemIndex]->SubItems[i]->Text;
                        break;
                }
            }
        }
    } 
 
private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
 
             if(listView1->SelectedItems->Count != 0)
             {
                SqlCeEngine^ engine = gcnew SqlCeEngine("Data Source='schedule.sdf';");
                SqlCeConnection^ connection = gcnew SqlCeConnection(engine->LocalConnectionString);
                connection->Open();
                SqlCeCommand^ command = connection->CreateCommand();
                command->CommandText = "DELETE FROM schedule WHERE (cid = ?)";
                command->Parameters->Add("cid", textBox10->Text);
                command->ExecuteScalar();
                ShowDB();
                
                textBox1->Clear();
                textBox2->Clear();
                textBox3->Clear();
                textBox4->Clear();
                textBox5->Clear();
                textBox6->Clear();
                textBox7->Clear();
                textBox8->Clear();
                textBox9->Clear();
             }
         }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
             
 
         }
private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
 
            textBox1->Clear();
            textBox2->Clear();
            textBox3->Clear();
            textBox4->Clear();
            textBox5->Clear();
            textBox6->Clear();
            textBox7->Clear();
            textBox8->Clear();
            textBox9->Clear();
         }
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
 
            Form2^ form2=gcnew Form2;
            form2->Show();
         }
private: System::Void button7_Click(System::Object^  sender, System::EventArgs^  e) {
 
            Form3^ form3=gcnew Form3;
            form3->Show();
         }
private: System::Void button8_Click(System::Object^  sender, System::EventArgs^  e) {
 
            ShowDB();
         }
private: System::Void listView1_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
 
             Change^ change=gcnew Change;
             change->textBox10->Text = Convert::ToString(textBox10->Text);
             change->textBox1->Text = Convert::ToString(textBox1->Text);
             change->textBox2->Text = Convert::ToString(textBox2->Text);
             change->textBox3->Text = Convert::ToString(textBox3->Text);
             change->textBox4->Text = Convert::ToString(textBox4->Text);
             change->textBox5->Text = Convert::ToString(textBox5->Text);
             change->textBox6->Text = Convert::ToString(textBox6->Text);
             change->textBox7->Text = Convert::ToString(textBox7->Text);
             change->textBox8->Text = Convert::ToString(textBox8->Text);
             change->textBox9->Text = Convert::ToString(textBox9->Text);
             change->Show();
         }
private: System::Void listView1_ColumnClick(System::Object^  sender, System::Windows::Forms::ColumnClickEventArgs^  e) {
 
        String^ st;
            st = listView1->Columns[e->Column]->Text;
            if(st == listView1->Columns[1]->Text)
            {
                SqlCeEngine^ engine =
                    gcnew SqlCeEngine("Data Source='schedule.sdf';");
                SqlCeConnection^ connection =
                    gcnew SqlCeConnection (engine->LocalConnectionString);
                connection->Open();
                SqlCeCommand^ command = connection->CreateCommand();
                command->CommandText = "SELECT * FROM schedule ORDER BY SOD";
                SqlCeDataReader^ dataReader = command->ExecuteReader();
                String^ st;
                int mas[500];
                int counter=0;
                while (dataReader->Read())
                {
                    st = dataReader->GetValue(1)->ToString();
                    int per = Convert::ToInt32(st);
                    mas[counter]=per;
                    counter++;
                }
                connection->Close();
                int step = counter / 2;
                while (step > 0)//пока шаг не 0
                {
                    for (int i = 0; i < (counter - step); i++)
                    {
                        int j = i;
//будем идти начиная с i-го элемента
                        while (j >= 0 && mas[j] > mas[j + step])
//пока не пришли к началу массива
//и пока рассматриваемый элемент больше
//чем элемент находящийся на расстоянии шага
                        {
//меняем их местами
                            int temp = mas[j];
                            mas[j] = mas[j + step];
                            mas[j + step] = temp;
                            j--; 
                        }
                    }
                    step = step / 2;//уменьшаем шаг
                }
                int j=0;
                int itemIndex=0;
                SqlCeEngine^ engine1 =
                    gcnew SqlCeEngine("Data Source='schedule.sdf';");
                SqlCeConnection^ connection1 =
                    gcnew SqlCeConnection (engine1->LocalConnectionString);
                
                listView1->Items->Clear();
                for( int a=0;a<counter ;a++ )
                {
                    connection1->Open();
                    SqlCeCommand^ command1 = connection1->CreateCommand();
                    command1->CommandText = "SELECT * FROM schedule ORDER BY SOD";
                    SqlCeDataReader^ dataReader1 = command1->ExecuteReader();
                    while (dataReader1->Read())
                    {
                            st = dataReader1->GetValue(1)->ToString();
                            int per = Convert::ToInt32(st);
                            if (per==mas[a])
                            {
                                
                                for(int i=0; i<dataReader1->FieldCount; i++)
                                {
                                    st = dataReader1->GetValue(i)->ToString();
                                    switch (i)
                                    {
                                        case 0:
                                            listView1->Items->Add(st);
                                            break;
                                        case 1:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 2:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 3:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 4:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 5:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 6:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 7:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 8:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 9:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        case 10:
                                            listView1->Items[itemIndex]->SubItems->Add(st);
                                            break;
                                        };
                                }
                            }
                    }
                    connection1->Close();
                    itemIndex++;
 
                }
                
            }
            else
            {
                SqlCeEngine^ engine =
                    gcnew SqlCeEngine("Data Source='schedule.sdf';");
                SqlCeConnection^ connection =
                    gcnew SqlCeConnection (engine->LocalConnectionString);
                connection->Open();
                SqlCeCommand^ command = connection->CreateCommand();
                if(listView1->Columns[e->Column]->Text=="Станция отправления")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SOD";
                if(listView1->Columns[e->Column]->Text=="Станция прибытия")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SOA";
                if(listView1->Columns[e->Column]->Text=="Время отправления")
                    command->CommandText = "SELECT * FROM schedule ORDER BY TOD";
                if(listView1->Columns[e->Column]->Text=="Дни отправления")
                    command->CommandText = "SELECT * FROM schedule ORDER BY DOD";
                if(listView1->Columns[e->Column]->Text=="Нал.Мест СВ")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SSW";
                if(listView1->Columns[e->Column]->Text=="Нал.Мест купэ")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SCU";
                if(listView1->Columns[e->Column]->Text=="Нал.Мест плац.")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SPL";
                    if(listView1->Columns[e->Column]->Text=="Нал.Мест общ.")
                    command->CommandText = "SELECT * FROM schedule ORDER BY SGE";
                SqlCeDataReader^ dataReader = command->ExecuteReader();
                String^ st;
                int itemIndex = 0;
                listView1->Items->Clear();
                while (dataReader->Read())
                {
                    for(int i=0; i<dataReader->FieldCount; i++)
                    {
                        st = dataReader->GetValue(i)->ToString();
                        switch (i)
                        {
                        case 0:
                            listView1->Items->Add(st);
                            break;
                        case 1:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 2:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 3:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 4:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 5:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 6:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 7:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 8:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 9:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        case 10:
                            listView1->Items[itemIndex]->SubItems->Add(st);
                            break;
                        };
                    }
                    itemIndex++;
                }
                connection->Close();
            }
         }
};
}

In the world of data visualization, representing hierarchical structures clearly and effectively can be challenging. However, with tools like Syncfusion’s Diagram control, creating visually appealing and highly functional diagrams becomes much easier. In this blog post, I’ll walk you through the process of creating a visual diagram using Syncfusion’s HierarchicLayoutManager in a Windows Forms application.

We’ll dive into the step-by-step process of initializing the diagram, populating it with nodes representing data objects, and customizing the layout to meet your specific needs.

Setting Up the Windows Forms Application

Before we begin, ensure you have Syncfusion’s Diagram control installed in your project. If you don’t have it yet, you can add it via NuGet:

Install-Package Syncfusion.Windows.Forms.Diagram

Enter fullscreen mode

Exit fullscreen mode

The Code Implementation

The following code demonstrates how to set up a diagram in a Windows Forms application using Syncfusion’s HierarchicLayoutManager. This example uses static data for simplicity.

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Diagram;

namespace TADA.EndAround.DataOrganizer.UI.General
{
    public partial class WorkspaceSnapshot : Form
    {
        #region Members

        HierarchicLayoutManager hierarchicalLayout;

        #endregion

        public WorkspaceSnapshot()
        {
            InitializeComponent();

            dataSourceDiagram.BeginUpdate();
            this.dataSourceDiagram.Model.BoundaryConstraintsEnabled = false;
            comboLytDirection.SelectedIndex = 0;

            PopulateFields();

            this.dataSourceDiagram.Model.RenderingStyle.SmoothingMode = SmoothingMode.HighQuality;
            this.dataSourceDiagram.View.BackgroundColor = Color.Transparent;
            this.dataSourceDiagram.Model.BoundaryConstraintsEnabled = false;
            this.dataSourceDiagram.View.HandleRenderer.HandleColor = Color.AliceBlue;
            this.dataSourceDiagram.View.HandleRenderer.HandleOutlineColor = Color.SkyBlue;
            this.dataSourceDiagram.View.SelectionList.Clear();

            hierarchicalLayout = new HierarchicLayoutManager(this.dataSourceDiagram.Model, 0, 55, 10);
            hierarchicalLayout.LeftMargin = 25;
            hierarchicalLayout.TopMargin = 25;
            hierarchicalLayout.Model.RightMargin = 25;
            hierarchicalLayout.Model.BottomMargin = 25;

            this.dataSourceDiagram.LayoutManager = hierarchicalLayout;
            this.dataSourceDiagram.View.Magnification = 55;
            this.dataSourceDiagram.LayoutManager.UpdateLayout(null);

            txtHSpacing.Text = hierarchicalLayout.HorizontalSpacing.ToString();
            txtVSpacing.Text = hierarchicalLayout.VerticalSpacing.ToString();
            txtLMarigin.Text = hierarchicalLayout.LeftMargin.ToString();
            txtTMarigin.Text = hierarchicalLayout.TopMargin.ToString();
            txtBMarigin.Text = hierarchicalLayout.Model.BottomMargin.ToString();
            txtRMarigin.Text = hierarchicalLayout.Model.RightMargin.ToString();

            chkAutoLayout.Checked = hierarchicalLayout.AutoLayout;

            dataSourceDiagram.EndUpdate();
        }

        #region InitializeDiagram

        /// <summary>
        /// Initialize the nodes and links in the diagram based on static data.
        /// </summary>
        private void PopulateFields()
        {
            // Static Architecture Node
            string architectureName = "System Architecture";

            Syncfusion.Windows.Forms.Diagram.RoundRect architectureNode = new Syncfusion.Windows.Forms.Diagram.RoundRect(0, 0, 120, 75, MeasureUnits.Pixel);
            architectureNode.FillStyle.Color = Color.FromArgb(255, 86, 4);
            architectureNode.FillStyle.ForeColor = Color.FromArgb(255, 165, 74);
            architectureNode.LineStyle.LineColor = Color.White;
            architectureNode.FillStyle.Type = FillStyleType.LinearGradient;
            architectureNode.Name = architectureName;

            Syncfusion.Windows.Forms.Diagram.Label architectureLabel = new Syncfusion.Windows.Forms.Diagram.Label(architectureNode, architectureName);
            architectureLabel.FontStyle.Family = "Segoe UI";
            architectureLabel.FontStyle.Size = 10;
            architectureLabel.FontColorStyle.Color = Color.Black;
            architectureNode.Labels.Add(architectureLabel);

            dataSourceDiagram.Model.AppendChild(architectureNode);

            // Static Data Source and Tables
            int dataSourceX = 150;
            int dataSourceY = 150;
            int tableX = 300;
            int tableY = 150;
            int clauseX = 450;
            int clauseY = 150;
            int columnOffset = 70;

            string[] dataSources = { "Database A", "Database B" };
            string[][] tables = {
                new string[] { "Table 1", "Table 2" },
                new string[] { "Table 3", "Table 4" }
            };

            string[][][] dataClauses = {
                new string[][] { new string[] { "Clause 1A", "Clause 1B" }, new string[] { "Clause 2A", "Clause 2B" } },
                new string[][] { new string[] { "Clause 3A", "Clause 3B" }, new string[] { "Clause 4A", "Clause 4B" } }
            };

            for (int i = 0; i < dataSources.Length; i++)
            {
                Syncfusion.Windows.Forms.Diagram.RoundRect dataSourceNode = new Syncfusion.Windows.Forms.Diagram.RoundRect(dataSourceX, dataSourceY, 100, 60, MeasureUnits.Pixel);
                dataSourceNode.FillStyle.Color = Color.FromArgb(123, 104, 238);
                dataSourceNode.LineStyle.LineColor = Color.White;
                dataSourceNode.Name = dataSources[i];

                Syncfusion.Windows.Forms.Diagram.Label dataSourceLabel = new Syncfusion.Windows.Forms.Diagram.Label(dataSourceNode, dataSources[i]);
                dataSourceLabel.FontStyle.Family = "Segoe UI";
                dataSourceLabel.FontStyle.Size = 10;
                dataSourceLabel.FontColorStyle.Color = Color.Black;
                dataSourceNode.Labels.Add(dataSourceLabel);

                dataSourceDiagram.Model.AppendChild(dataSourceNode);
                ConnectNodes(architectureNode, dataSourceNode);

                dataSourceY += 100;

                for (int j = 0; j < tables[i].Length; j++)
                {
                    Syncfusion.Windows.Forms.Diagram.RoundRect tableNode = new Syncfusion.Windows.Forms.Diagram.RoundRect(tableX, tableY, 100, 60, MeasureUnits.Pixel);
                    tableNode.FillStyle.Color = Color.FromArgb(72, 209, 204);
                    tableNode.LineStyle.LineColor = Color.White;
                    tableNode.Name = tables[i][j];

                    Syncfusion.Windows.Forms.Diagram.Label tableLabel = new Syncfusion.Windows.Forms.Diagram.Label(tableNode, tables[i][j]);
                    tableLabel.FontStyle.Family = "Segoe UI";
                    tableLabel.FontStyle.Size = 10;
                    tableLabel.FontColorStyle.Color = Color.Black;
                    tableNode.Labels.Add(tableLabel);

                    dataSourceDiagram.Model.AppendChild(tableNode);
                    ConnectNodes(dataSourceNode, tableNode);

                    tableY += 100;

                    for (int k = 0; k < dataClauses[i][j].Length; k++)
                    {
                        Syncfusion.Windows.Forms.Diagram.RoundRect clauseNode = new Syncfusion.Windows.Forms.Diagram.RoundRect(clauseX, clauseY, 100, 60, MeasureUnits.Pixel);
                        clauseNode.FillStyle.Color = Color.FromArgb(144, 238, 144);
                        clauseNode.LineStyle.LineColor = Color.White;
                        clauseNode.Name = dataClauses[i][j][k];

                        Syncfusion.Windows.Forms.Diagram.Label clauseLabel = new Syncfusion.Windows.Forms.Diagram.Label(clauseNode, dataClauses[i][j][k]);
                        clauseLabel.FontStyle.Family = "Segoe UI";
                        clauseLabel.FontStyle.Size = 10;
                        clauseLabel.FontColorStyle.Color = Color.Black;
                        clauseNode.Labels.Add(clauseLabel);

                        dataSourceDiagram.Model.AppendChild(clauseNode);
                        ConnectNodes(tableNode, clauseNode);

                        clauseX += columnOffset;
                    }
                    clauseX = 450;
                }
                dataSourceY = 150;
            }
        }

        /// <summary>
        /// Connects the given nodes
        /// </summary>
        /// <param name="parentNode">Parent Node</param>
        /// <param name="childNode">Child node</param>
        private void ConnectNodes(Node parentNode, Node childNode)
        {
            if (parentNode != null && childNode != null)
            {
                OrgLineConnector conn = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                conn.VerticalDistance = 35;
                conn.LineStyle.LineColor = Color.Gray;
                Decorator decor = conn.HeadDecorator;
                decor.DecoratorShape = DecoratorShape.Filled45Arrow;
                decor.FillStyle.Color = Color.White;
                decor.LineStyle.LineColor = Color.Gray;

                this.dataSourceDiagram.Model.AppendChild(conn);

                parentNode.CentralPort.TryConnect(conn.TailEndPoint);
                childNode.CentralPort.TryConnect(conn.HeadEndPoint);

                this.dataSourceDiagram.Model.SendToBack(conn);
            }
        }

        #endregion

        #region Event Handlers

        private void apply_Click(object sender, EventArgs e)
        {
            float rotationAngle = 0;
            float parseVal;
            if (txtHSpacing.Text != string.Empty && float.TryParse(txtHSpacing.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).HorizontalSpacing = parseVal;
            else
                txtHSpacing.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).HorizontalSpacing.ToString();

            if (txtVSpacing.Text != string.Empty && float.TryParse(txtVSpacing.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).VerticalSpacing = parseVal;
            else
                txtVSpacing.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).VerticalSpacing.ToString();

            if (txtRMarigin.Text != string.Empty && float.TryParse(txtRMarigin.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).Model.RightMargin = parseVal;
            else
                txtRMarigin.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).Model.RightMargin.ToString();

            if (txtBMarigin.Text != string.Empty && float.TryParse(txtBMarigin.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).Model.BottomMargin = parseVal;
            else
                txtBMarigin.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).Model.BottomMargin.ToString();

            if (txtLMarigin.Text != string.Empty && float.TryParse(txtLMarigin.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).LeftMargin = parseVal;
            else
                txtLMarigin.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).LeftMargin.ToString();

            if (txtTMarigin.Text != string.Empty && float.TryParse(txtTMarigin.Text.ToString(), out parseVal))
                ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).TopMargin = parseVal;
            else
                txtTMarigin.Text = ((HierarchicLayoutManager)this.dataSourceDiagram.LayoutManager).TopMargin.ToString();

            hierarchicalLayout.Model.DocumentSize = new SizeF((hierarchicalLayout.Model.BoundingRect.Size.Width + hierarchicalLayout.Model.RightMargin),
                                               (hierarchicalLayout.Model.BoundingRect.Size.Height + hierarchicalLayout.Model.BottomMargin));
        }

        #endregion
    }
}

Enter fullscreen mode

Exit fullscreen mode

Breakdown of Key Components

  1. Diagram Initialization:
    The diagram is initialized with specific settings, such as boundary constraints, rendering styles, and handle colors, to ensure the diagram’s layout is smooth and visually appealing.

  2. PopulateFields Method:
    This method creates the nodes representing the system architecture, data sources, tables, and clauses. The nodes are connected using connectors (OrgLineConnector) to establish relationships between them.

  3. HierarchicLayoutManager:
    The HierarchicLayoutManager is configured to manage the layout of nodes within the diagram, including spacing and margins. It automatically adjusts the positions of nodes to create a hierarchical layout.

  4. Event Handlers:
    The apply_Click event handler allows users to adjust spacing and margins dynamically, which can be useful for fine-tuning the layout in real-time.

Conclusion

With Syncfusion’s powerful diagramming tools, creating complex hierarchical diagrams becomes straightforward. By leveraging the HierarchicLayoutManager, you can ensure that your diagram is not only functional but also aesthetically pleasing. This approach provides a solid foundation for visualizing complex data structures in a Windows Forms application.

Feel free to modify the code to suit your specific requirements, whether it involves more complex data structures or different visual styles. The flexibility of Syncfusion’s controls allows for endless possibilities in data visualization.

Данный проект предназначен для создания наглядной блок-схемы алгоритма Хаффмана с использованием платформы C# Windows Forms. Блок-схема будет разбита на несколько этапов, отражающих ключевые фазы алгоритма, включая сбор данных, построение дерева Хаффмана, создание кодов и процесс кодирования и декодирования текста. Проект позволит визуализировать алгоритм и сделать его понятным для изучения и реализации в программном обеспечении, предоставляя четкий и доступный интерфейс для пользователя.

Идея

Идея проекта состоит в разработке визуального инструмента, который поможет пользователям лучше понять механизм работы алгоритма Хаффмана через блок-схему, где каждый блок будет описывать конкретный шаг алгоритма.

Продукт

Блок-схема, отображающая алгоритм Хаффмана на C# в формате документа или графического изображения.

Проблема

Проблема заключается в том, что многие начинающие программисты и студенты сталкиваются с трудностями в понимании алгоритмов сжатия данных, таких как алгоритм Хаффмана, и нуждаются в визуальных пояснениях для лучшего усвоения.

Актуальность

Актуальность проекта обусловлена ростом интереса к алгоритмике и программированию, а также необходимостью наглядного представления сложных алгоритмов для образовательных целей.

Цель

Создание блок-схемы для алгоритма Хаффмана для более простого понимания алгоритма кодирования и декодирования.

Задачи

Разработка структурированной блок-схемы с четким отображением основных этапов алгоритма; реализация на C# в Windows Forms; тестирование функциональности и понимания алгоритма; подготовка документации к проекту.

Ресурсы

Необходимы временные ресурсы на разработку (40 часов), доступ к компьютеру с установленной средой разработки Visual Studio, программное обеспечение для рисования блок-схем.

Роли в проекте

Разработчик, Исследователь, Тестировщик

Целевая аудитория

Студенты, изучающие алгоритмы, программисты-новички, преподаватели IT-курс.

Предпросмотр документа

Наименование образовательного учреждения

Выполнил:ФИО

Руководитель:ФИО

Содержание

Введение

Введение в алгоритм Хаффмана

Сбор и обработка данных для кодирования

Построение дерева Хаффмана

Создание двоичных кодов

Кодирование текста

Декодирование текста

Отображение результата пользователя

Тестирование функциональности приложения

Заключение

Список литературы

Введение

Текст доступен в расширенной версии

Описание темы работы, актуальности, целей, задач, новизны, тем, содержащихся внутри работы.
Контент доступен только автору оплаченного проекта

Введение в алгоритм Хаффмана

Текст доступен в расширенной версии

Данный раздел предоставляет общее представление о алгоритме Хаффмана, его цели и области применения в современных системах сжатия данных. Обсуждаются ключевые характеристики алгоритма и причины его популярности в программировании.
Контент доступен только автору оплаченного проекта

Сбор и обработка данных для кодирования

Текст доступен в расширенной версии

В этом разделе подробно рассматривается процесс сбора входных данных для алгоритма Хаффмана, включая методы ввода текста и подсчета частоты появления символов. Описываются инструменты C#, используемые для этих задач.
Контент доступен только автору оплаченного проекта

Построение дерева Хаффмана

Текст доступен в расширенной версии

Раздел посвящен описанию процесса построения дерева Хаффмана с использованием собранных данных. Рассматриваются основные шаги по созданию узлов и объединению их в дерево, что является ключевым этапом в алгоритме.
Контент доступен только автору оплаченного проекта

Создание двоичных кодов

Текст доступен в расширенной версии

В этом разделе описывается метод создания двоичных кодов для символов на основе структуры дерева Хаффмана. Подробно рассматриваются механизмы обхода дерева и принцип формирования кодов symbol-based encoding.
Контент доступен только автору оплаченного проекта

Кодирование текста

Текст доступен в расширенной версии

Этот раздел посвящен описанию процесса кодирования текста с использованием блок-схемы алгоритма Хаффмана. Рассматриваются различные подходы к интеграции этого процесса в программы на C#.
Контент доступен только автору оплаченного проекта

Декодирование текста

Текст доступен в расширенной версии

В данном разделе подробно описывается процесс декодирования текста с применением дерева Хаффмана. Подходы к восстановлению оригинального текста рассматриваются в контексте использования идентификаторов из предыдущих процессов.
Контент доступен только автору оплаченного проекта

Отображение результата пользователя

Текст доступен в расширенной версии

Этот раздел фокусируется на пользовательском интерфейсе, созданном для демонстрации результатов работы алгоритма. Описываются ключевые компоненты Windows Forms, позволяющие визуализировать закодированный текст и иногда сам исходный текст.
Контент доступен только автору оплаченного проекта

Тестирование функциональности приложения

Текст доступен в расширенной версии

Последний раздел подводит итоги о процессе тестирования созданного приложения на платформе C#. Обсуждаются важные аспекты функционального тестирования и отладка, направленные на подтверждение эффективности реализации всех частей проекта.
Контент доступен только автору оплаченного проекта

Заключение

Текст доступен в расширенной версии

Описание результатов работы, выводов.
Контент доступен только автору оплаченного проекта

Список литературы

Текст доступен в расширенной версии

Список литературы.
Контент доступен только автору оплаченного проекта

Нужен проект на эту тему?20 страниц, список литературы, антиплагиат

На
рисунке
2
представлен
алгоритм
решения
задачи
в
виде
блок-схемы.

Рисунок
2

Блок-схема
к заданию
1

1.4 Разработка программного кода

Далее
представлен
разработанный
программный
код.
Реализации
алгоритма
решения
задания
1
в
соответствие
с
алгоритмом,
представленном
в
виде
блок-схемы
на
рисунке
2,
соответствует
процедура
button1_Click().

using
System;

using
System.Collections.Generic;

using
System.ComponentModel;

using
System.Data;

using
System.Drawing;

using
System.Linq;

using
System.Text;

using
System.Threading.Tasks;

using
System.Windows.Forms;

using
static
System.Math;

namespace
WindowsFormsApp2

{

public
partial
class
Form1
: Form

{

public
Form1()

{

InitializeComponent();

}

private
void
pictureBox1_Click(object
sender, EventArgs e)

{

}

private
void
button1_Click(object
sender, EventArgs e)

{

double
x, y;

x
= Convert.ToDouble(textBox1.Text);

y
= Exp(x) + Cos(-3*x + (PI/2));

textBox2.Text
= Convert.ToString(y);

textBox2.Text
= string.Format(«{0,10:F4}»,
y);

}

private
void
button2_Click(object
sender, EventArgs e)

{

Close();

}

}

}

На
рисунке 3 представлен результат
вычислений

Рисунок
3 – Пример выполнения задания 1

Рисунок
3

Результат
вычислений
задания
1

2 Индивидуальное задание 2

2.1 Постановка задачи

Создать
форму,
программный
код
которой
позволяет
вычислить
значение
функций
для
заданных
пользователем
аргументов
x,a,b,c.
Функции:

или

Входные
данные:

x,a,b,c
– аргументы
функции,
вещественные
числа
(Double).

Z,
F
– вычисленные
значения
заданных
функций,
вещественные
числа
(Double).

2.2 Разработка интерфейса

На
рисунке
4
представлен
интерфейс
формы
для
решения
задания
2.

Рисунок
4

Интерфейс
формы
для
задания
2

В таблице 2 перечислены элементы управления, которые были
использованы
при создании
интерфейса.

Таблица
2

Элементы
управления
формы к
заданию
2

Элемент управления

Пояснение

2

Окно для решения
задания 2

TextBox1

Текстовое поле
для ввода значения функции х

TextBox2

Текстовое поле
для ввода значения функции a

TextBox3

Текстовое поле
для ввода значения функции b

TextBox5

Текстовое поле
для ввода значения функции c

TextBox4

Текстовое поле
для вывода значения функции F
или Z

Label1,
Label2, Label3, Label4, Label5, Label6

Метки пояснений

Button1

Кнопка для запуска
программного кода для вычисления
значения функции

Button2

Кнопка для запуска
программного кода для закрытия формы

PictureBox1

Графическое поле
для размещения изображения с заданной
функцией

RadioButton1,
RadioButton2

Кнопка для выбора
уравнения, по которому будет решаться
задача

Соседние файлы в предмете Информатика

  • #
  • #

    17.10.2023612.98 Кб34.docx

  • #

    17.10.2023563.91 Кб46.docx

  • #
  • #
  • #

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Некоторыми параметрами управляет ваша организация windows 10 как исправить центр обновления
  • Как настроить домашний dlna сервер в windows 10
  • Как подключиться к vps серверу через windows 10
  • Убедитесь что запустили приложение ncalayer или установите по ссылке для ос windows для ос linux
  • Обновление windows 10 для принтеров usb портов