Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
0 / 0 / 0
Регистрация: 13.04.2021
Сообщений: 19

Создание массива кнопок

13.04.2021, 19:15. Показов 1834. Ответов 0

Студворк — интернет-сервис помощи студентам
Добрый день

Сгенерировал форму в Visual Studio 2019 с окном и кнопками, хочу создать массив этих кнопок, чтобы они хранились у меня и я мог через цикл бегать по ним и что либо в них менять. Если писать так как я написал в 414 строке, в строке под номером 480 возникает ошибка, оно понятно почему, в Void MyForm_KeyDown нет Butt_mass, она создана в Void roll_Click_1 и вида только там, НО, как мне создать массив копок таким образом и в таком месте, чтобы он был глобальным для всего класса, сколько бы я не пробовал я постоянно получаю ошибки, например: "Использование массивов дискрипторов не допускается", "глобальая или статическая переменная не может иметь тип управляемый" и т.п. Классы в с++ это самая моя нелюбимая штука, и как раз таки именно по этой причине, вообще не понятно как объявлять переменную, в методе она прекрасно работает, переносишь ту же строчку в друое место СМЭРЬ

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
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
#pragma once
#include <stdlib.h>
#include <time.h>
#include <string>
#include <list>
#include "windows.h"
#include <algorithm>
 
using namespace std;
 
namespace Project1 {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
 
    /// <summary>
    /// Сводка для MyForm
    /// </summary>
    
    //cli::array<Button^>^ Butt_mass = gcnew cli::array<Button^>(16) { button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8, button_9, button_10, button_11, button_12, button_13, button_14, button_15, button_16 };
 
    int mas[4][4];
    bool flag = false;
    public ref class MyForm : public System::Windows::Forms::Form
    {
        //cli::array<Button^>^ Butt_mass = gcnew cli::array<Button^>(16);
    public:
        MyForm(void)
        {
            InitializeComponent();
            //
            //TODO: добавьте код конструктора
            //
        }
 
    protected:
        /// <summary>
        /// Освободить все используемые ресурсы.
        /// </summary>
        ~MyForm()
        {
            if (components)
            {
                delete components;
            }
        }
    public: System::Windows::Forms::Button^ button_1;
    public: System::Windows::Forms::Button^ button_2;
    public: System::Windows::Forms::Button^ button_4;
    protected:
 
    protected:
 
 
    public: System::Windows::Forms::Button^ button_3;
    public: System::Windows::Forms::Button^ button_8;
 
 
    public: System::Windows::Forms::Button^ button_7;
 
    public: System::Windows::Forms::Button^ button_6;
 
    public: System::Windows::Forms::Button^ button_5;
    public: System::Windows::Forms::Button^ button_16;
 
 
    public: System::Windows::Forms::Button^ button_15;
 
    public: System::Windows::Forms::Button^ button_14;
 
    public: System::Windows::Forms::Button^ button_13;
 
    public: System::Windows::Forms::Button^ button_12;
 
    public: System::Windows::Forms::Button^ button_11;
 
    public: System::Windows::Forms::Button^ button_10;
 
    public: System::Windows::Forms::Button^ button_9;
    public: System::Windows::Forms::Button^ roll;
    public: System::Windows::Forms::Label^ label1;
    private: System::Windows::Forms::Label^ label2;
    private: System::Windows::Forms::Button^ button1;
 
 
    public:
    public:
 
 
    public:
        /// <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(MyForm::typeid));
            this->button_1 = (gcnew System::Windows::Forms::Button());
            this->button_2 = (gcnew System::Windows::Forms::Button());
            this->button_4 = (gcnew System::Windows::Forms::Button());
            this->button_3 = (gcnew System::Windows::Forms::Button());
            this->button_8 = (gcnew System::Windows::Forms::Button());
            this->button_7 = (gcnew System::Windows::Forms::Button());
            this->button_6 = (gcnew System::Windows::Forms::Button());
            this->button_5 = (gcnew System::Windows::Forms::Button());
            this->button_16 = (gcnew System::Windows::Forms::Button());
            this->button_15 = (gcnew System::Windows::Forms::Button());
            this->button_14 = (gcnew System::Windows::Forms::Button());
            this->button_13 = (gcnew System::Windows::Forms::Button());
            this->button_12 = (gcnew System::Windows::Forms::Button());
            this->button_11 = (gcnew System::Windows::Forms::Button());
            this->button_10 = (gcnew System::Windows::Forms::Button());
            this->button_9 = (gcnew System::Windows::Forms::Button());
            this->roll = (gcnew System::Windows::Forms::Button());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->SuspendLayout();
            // 
            // button_1
            // 
            this->button_1->Enabled = false;
            this->button_1->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_1->Location = System::Drawing::Point(193, 151);
            this->button_1->Name = L"button_1";
            this->button_1->Size = System::Drawing::Size(120, 104);
            this->button_1->TabIndex = 0;
            this->button_1->Text = L"\?";
            this->button_1->UseVisualStyleBackColor = true;
            // 
            // button_2
            // 
            this->button_2->Enabled = false;
            this->button_2->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_2->Location = System::Drawing::Point(319, 151);
            this->button_2->Name = L"button_2";
            this->button_2->Size = System::Drawing::Size(120, 104);
            this->button_2->TabIndex = 1;
            this->button_2->Text = L"\?";
            this->button_2->UseVisualStyleBackColor = true;
            // 
            // button_4
            // 
            this->button_4->Enabled = false;
            this->button_4->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_4->Location = System::Drawing::Point(571, 151);
            this->button_4->Name = L"button_4";
            this->button_4->Size = System::Drawing::Size(120, 104);
            this->button_4->TabIndex = 3;
            this->button_4->Text = L"\?";
            this->button_4->UseVisualStyleBackColor = true;
            // 
            // button_3
            // 
            this->button_3->Enabled = false;
            this->button_3->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_3->Location = System::Drawing::Point(445, 151);
            this->button_3->Name = L"button_3";
            this->button_3->Size = System::Drawing::Size(120, 104);
            this->button_3->TabIndex = 2;
            this->button_3->Text = L"\?";
            this->button_3->UseVisualStyleBackColor = true;
            // 
            // button_8
            // 
            this->button_8->Enabled = false;
            this->button_8->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_8->Location = System::Drawing::Point(571, 261);
            this->button_8->Name = L"button_8";
            this->button_8->Size = System::Drawing::Size(120, 104);
            this->button_8->TabIndex = 8;
            this->button_8->Text = L"\?";
            this->button_8->UseVisualStyleBackColor = true;
            // 
            // button_7
            // 
            this->button_7->Enabled = false;
            this->button_7->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_7->Location = System::Drawing::Point(445, 261);
            this->button_7->Name = L"button_7";
            this->button_7->Size = System::Drawing::Size(120, 104);
            this->button_7->TabIndex = 7;
            this->button_7->Text = L"\?";
            this->button_7->UseVisualStyleBackColor = true;
            // 
            // button_6
            // 
            this->button_6->Enabled = false;
            this->button_6->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_6->Location = System::Drawing::Point(319, 261);
            this->button_6->Name = L"button_6";
            this->button_6->Size = System::Drawing::Size(120, 104);
            this->button_6->TabIndex = 6;
            this->button_6->Text = L"\?";
            this->button_6->UseVisualStyleBackColor = true;
            // 
            // button_5
            // 
            this->button_5->Enabled = false;
            this->button_5->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_5->Location = System::Drawing::Point(193, 261);
            this->button_5->Name = L"button_5";
            this->button_5->Size = System::Drawing::Size(120, 104);
            this->button_5->TabIndex = 5;
            this->button_5->Text = L"\?";
            this->button_5->UseVisualStyleBackColor = true;
            // 
            // button_16
            // 
            this->button_16->Enabled = false;
            this->button_16->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 24, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_16->Location = System::Drawing::Point(571, 481);
            this->button_16->Name = L"button_16";
            this->button_16->Size = System::Drawing::Size(120, 104);
            this->button_16->TabIndex = 18;
            this->button_16->Text = L"0";
            this->button_16->UseVisualStyleBackColor = true;
            // 
            // button_15
            // 
            this->button_15->Enabled = false;
            this->button_15->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_15->Location = System::Drawing::Point(445, 481);
            this->button_15->Name = L"button_15";
            this->button_15->Size = System::Drawing::Size(120, 104);
            this->button_15->TabIndex = 17;
            this->button_15->Text = L"\?";
            this->button_15->UseVisualStyleBackColor = true;
            // 
            // button_14
            // 
            this->button_14->Enabled = false;
            this->button_14->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_14->Location = System::Drawing::Point(319, 481);
            this->button_14->Name = L"button_14";
            this->button_14->Size = System::Drawing::Size(120, 104);
            this->button_14->TabIndex = 16;
            this->button_14->Text = L"\?";
            this->button_14->UseVisualStyleBackColor = true;
            // 
            // button_13
            // 
            this->button_13->Enabled = false;
            this->button_13->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_13->Location = System::Drawing::Point(193, 481);
            this->button_13->Name = L"button_13";
            this->button_13->Size = System::Drawing::Size(120, 104);
            this->button_13->TabIndex = 15;
            this->button_13->Text = L"\?";
            this->button_13->UseVisualStyleBackColor = true;
            // 
            // button_12
            // 
            this->button_12->Enabled = false;
            this->button_12->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_12->Location = System::Drawing::Point(571, 371);
            this->button_12->Name = L"button_12";
            this->button_12->Size = System::Drawing::Size(120, 104);
            this->button_12->TabIndex = 13;
            this->button_12->Text = L"\?";
            this->button_12->UseVisualStyleBackColor = true;
            // 
            // button_11
            // 
            this->button_11->Enabled = false;
            this->button_11->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_11->Location = System::Drawing::Point(445, 371);
            this->button_11->Name = L"button_11";
            this->button_11->Size = System::Drawing::Size(120, 104);
            this->button_11->TabIndex = 12;
            this->button_11->Text = L"\?";
            this->button_11->UseVisualStyleBackColor = true;
            // 
            // button_10
            // 
            this->button_10->Enabled = false;
            this->button_10->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_10->Location = System::Drawing::Point(319, 371);
            this->button_10->Name = L"button_10";
            this->button_10->Size = System::Drawing::Size(120, 104);
            this->button_10->TabIndex = 11;
            this->button_10->Text = L"\?";
            this->button_10->UseVisualStyleBackColor = true;
            // 
            // button_9
            // 
            this->button_9->Enabled = false;
            this->button_9->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 27.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->button_9->Location = System::Drawing::Point(193, 371);
            this->button_9->Name = L"button_9";
            this->button_9->Size = System::Drawing::Size(120, 104);
            this->button_9->TabIndex = 10;
            this->button_9->Text = L"\?";
            this->button_9->UseVisualStyleBackColor = true;
            // 
            // roll
            // 
            this->roll->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 26.25F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this->roll->Location = System::Drawing::Point(319, 12);
            this->roll->Name = L"roll";
            this->roll->Size = System::Drawing::Size(246, 108);
            this->roll->TabIndex = 19;
            this->roll->Text = L"Начать игру";
            this->roll->UseVisualStyleBackColor = true;
            this->roll->Click += gcnew System::EventHandler(this, &MyForm::roll_Click_1);
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->BackColor = System::Drawing::SystemColors::ActiveBorder;
            this->label1->Cursor = System::Windows::Forms::Cursors::Cross;
            this->label1->Location = System::Drawing::Point(795, 9);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(67, 13);
            this->label1->TabIndex = 20;
            this->label1->Text = L"XXXXXXXXX";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(12, 590);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(10, 13);
            this->label2->TabIndex = 21;
            this->label2->Text = L" ";
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(12, 553);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(64, 23);
            this->button1->TabIndex = 22;
            this->button1->Text = L"Отладка";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
            // 
            // MyForm
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->BackColor = System::Drawing::SystemColors::Control;
            this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"$this.BackgroundImage")));
            this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
            this->ClientSize = System::Drawing::Size(874, 889);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->Controls->Add(this->roll);
            this->Controls->Add(this->button_16);
            this->Controls->Add(this->button_15);
            this->Controls->Add(this->button_14);
            this->Controls->Add(this->button_13);
            this->Controls->Add(this->button_12);
            this->Controls->Add(this->button_11);
            this->Controls->Add(this->button_10);
            this->Controls->Add(this->button_9);
            this->Controls->Add(this->button_8);
            this->Controls->Add(this->button_7);
            this->Controls->Add(this->button_6);
            this->Controls->Add(this->button_5);
            this->Controls->Add(this->button_4);
            this->Controls->Add(this->button_3);
            this->Controls->Add(this->button_2);
            this->Controls->Add(this->button_1);
            this->DoubleBuffered = true;
            this->ForeColor = System::Drawing::SystemColors::ControlText;
            this->KeyPreview = true;
            this->Name = L"MyForm";
            this->Text = L"Пятнашки";
            this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
            this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &MyForm::MyForm_KeyDown);
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
    public: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e)
    {
 
    }
    //При нажатии на "Играть" или "Перемешать"
    public: System::Void roll_Click_1(System::Object^ sender, System::EventArgs^ e)
    {
        //Массив кнопок
        cli::array<Button^>^ Butt_mass = gcnew cli::array<Button^>(16) { button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8, button_9, button_10, button_11, button_12, button_13, button_14, button_15, button_16 };
 
        //cli::array<Button^>^ Butt_mass[] = { button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8, button_9, button_10, button_11, button_12, button_13, button_14, button_15, button_16 };
 
 
        roll->Text = "Перемешать";
        //Активируем все "кнопки"
        for (int i = 0; i < 16; i++)
            Butt_mass[i]->Enabled = "True";
 
        //Записываем в матрицу числа от 0 до 16 через цикл
        int t = 0;
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                mas[i][j] = Convert::ToInt32(t);
                t += 1;
            }
        }
 
        //Перемешиваем матрицу случайным образом (все 4 матрицы внтури матрицы) и саму матрицу с 4 матрицами -.-
        for (int i=0; i<4; i++)
            random_shuffle(&mas[i][0], &mas[i][4]);
        random_shuffle(&mas[0], &mas[4]);
 
        //Просто для отладки выводим значения матицы в Label
        label2->Text = "";
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
                label2->Text += Convert::ToString(mas[i][j]) + " ";
            label2->Text += "\n";
        }
 
        //Пробегаемся по всем кнопкам по порядку и записываем в них значение массива
        int i = 0;
        for (int q = 0; q < 4; q++)
            for (int w = 0; w < 4; w++)
            {
                Butt_mass[i]->Text = Convert::ToString(mas[q][w]);
                i++;
            }
    }
 
    //При нажатии на кнопки на клавиатуре
    public: System::Void MyForm_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e)
    {
        if (e->KeyCode == Keys::W)
        {
            //находим в массиве элемент 0 и меняем его местами
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                    if (mas[i][j] == 0)
                    {
                        int tmp = mas[i-1][j];
                        mas[i-1][j] = mas[i][j];
                        mas[i][j] = tmp;
                    }
        }
 
        //Пробегаемся по всем кнопкам по порядку и записываем в них значение массива
        int i = 0;
        for (int q = 0; q < 4; q++)
            for (int w = 0; w < 4; w++)
            {
                Butt_mass[i]->Text = Convert::ToString(mas[q][w]);
                i++;
            }
 
        //Просто для отладки выводим значения матицы в Label
        label2->Text = "";
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
                label2->Text += Convert::ToString(mas[i][j]) + " ";
            label2->Text += "\n";
        }
 
    }
    public: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
    {
        flag = true;
    }
};
}
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
13.04.2021, 19:15
Ответы с готовыми решениями:

создание массива кнопок Visual C++ CLR
Не подскажет кто как создать массив кнопок типа Button?:)

Создание массива кнопок
В общем, хочется сделать универсальный скрипт для кнопок, чтоб при добавлении новых предметов, нужно бы было просто закинуть объект и...

Создание массива из существующих кнопок
Ребят, помогите разобраться. Этот код создает массив из новых объектов(кнопок) QPushButton *button; button = new QPushButton(this); ...

0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
13.04.2021, 19:15
Помогаю со студенческими работами здесь

Создание массива кнопок на панели
Хотелось бы создать массив кнопок на форме (панели). Есть некий код с GridBagLayout // конструктор public ColorChoosing(ColorsList...

Создание и обработка массива кнопок
Здравствуйте, необходимо создать массив кнопок (10х10), по нажатию на кнопку она будет менять свой цвет на красный/зеленый и запоминать,...

Динамическое создание массива кнопок
Объясните, пожалуйста, подробнее, как создается массив кнопок и происходит к ним обращение.

Динамическое создание массива кнопок с событием
Только начинаю копать C#, прошу сильно не пинать. Создаю массив кнопок с событием: Button btnDisk1; //////// ...

Из созданного массива кнопок одна из кнопок (9) должна выполнять метод Percent
Из созданного массива кнопок одна из кнопок (9) должна выполнять метод Percent, но после запуска выдаёт исключение &quot;Ссылка на объект...


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

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Новые блоги и статьи
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
Загрузка PNG с альфа-каналом на SDL3 для Android: с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
Загрузка PNG с альфа-каналом на SDL3 для Android: с помощью SDL3_image
8Observer8 27.01.2026
Содержание блога SDL3_image - это библиотека для загрузки и работы с изображениями. Эта пошаговая инструкция покажет, как загрузить и вывести на экран смартфона картинку с альфа-каналом, то есть с. . .
Влияние грибов на сукцессию
anaschu 26.01.2026
Бифуркационные изменения массы гриба происходят тогда, когда мы уменьшаем массу компоста в 10 раз, а скорость прироста биомассы уменьшаем в три раза. Скорость прироста биомассы может уменьшаться за. . .
Воспроизведение звукового файла с помощью 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, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru