Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/3: Рейтинг темы: голосов - 3, средняя оценка - 5.00
TECHNO
 Аватар для Василий-Робот
28 / 28 / 8
Регистрация: 04.11.2009
Сообщений: 366

Избавиться от черного шлейфа при перемещении кружка

30.06.2011, 22:25. Показов 618. Ответов 2
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
как сделать, чтобы за кружочком не было черного шлейфа?

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
#pragma once
int a=0,b=1,x=20,y=20;
 
namespace графикавер2 {
 
    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>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }
 
    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Timer^  timer1;
    protected: 
    private: System::ComponentModel::IContainer^  components;
 
    private:
        /// <summary>
        /// Required designer variable.
        /// </summary>
 
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
            this->components = (gcnew System::ComponentModel::Container());
            this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
            this->SuspendLayout();
            // 
            // timer1
            // 
            this->timer1->Enabled=true;
            this->timer1->Interval=5;
            this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->BackColor = System::Drawing::Color::White;
            this->ClientSize = System::Drawing::Size(292, 266);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            this->ResumeLayout(false);
 
        }
#pragma endregion
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
                 Color ^col=gcnew Color();
                 Color ^bkcol=gcnew Color();
                 Pen ^pen=gcnew Pen(col->White);
                 Graphics ^im=this->CreateGraphics();
                 pen->Color=col->Black;
                 x+=b;
                 y+=b;
                 im->DrawEllipse(pen,x,y,50,50);
                 pen->Color=col->White;
                 im->DrawEllipse(pen,x,y,50,50);
                 pen->Color=col->Black;
                 x+=b;
                 y+=b;
                 im->DrawEllipse(pen,x,y,50,50);
 
 
 
 
 
             }
    private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
                 Color ^col=gcnew Color();
                 Color ^bkcol=gcnew Color();
                 Pen ^pen=gcnew Pen(col->White);
                 Graphics ^im=this->CreateGraphics();
                 pen->Color=col->Black;
                 x+=b;
                 y+=b;
                 im->DrawEllipse(pen,x,y,50,50);
                 pen->Color=col->White;
                 im->DrawEllipse(pen,x,y,50,50);
                 pen->Color=col->Black;
                 x+=b;
                 y+=b;
                 im->DrawEllipse(pen,x,y,50,50);
 
             }
    };
}
Добавлено через 7 минут
нашел решение через "фон" который дает прямоугольник, код которого стоит перед кодом окружности.
Но если способ более изящный?

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
#pragma endregion
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
                 Color ^col=gcnew Color();
                 Color ^bkcol=gcnew Color();
                 Pen ^pen=gcnew Pen(col->White);
                 Graphics ^im=this->CreateGraphics();
                 pen->Color=col->White;
                 im->FillRectangle(pen->Brush,0,0,1000,1000);
                 pen->Color=col->Black;
                 a+=b;
                 im->DrawEllipse(pen,20+a,20+a,50,50);
             }
    private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
                 Color ^col=gcnew Color();
                 Color ^bkcol=gcnew Color();
                 Pen ^pen=gcnew Pen(col->White);
                 Graphics ^im=this->CreateGraphics();
                 pen->Color=col->White;
                 im->FillRectangle(pen->Brush,0,0,1000,1000);
                 pen->Color=col->Black;
                 a+=b;
                 im->DrawEllipse(pen,20+a,20+a,50,50);
             }
    };
}
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
30.06.2011, 22:25
Ответы с готовыми решениями:

Как избавиться от мерцания при перемещении Picturebox?
привет, необходимо организовать движение спрайта по форме, при перемещении picturebox постоянно мигает. DoubleBuffered не помогает, знаю...

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

Не крутится жесткий диск при подключении шлейфа
Проблема такова: до недавнего времени жесткий диск работал без перебоев. Совсем недавно ПК неожиданно завис, я его перезагрузил и все,...

2
30.06.2011, 22:29

Не по теме:

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

1
TECHNO
 Аватар для Василий-Робот
28 / 28 / 8
Регистрация: 04.11.2009
Сообщений: 366
30.06.2011, 23:17  [ТС]
вопрос, почему при нажатии кнопки9 окружность дергается и двигается не по нужной мне траектории?

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
#pragma once
int a=0,b=0,c=5,d=5;
 
namespace графикавер2 {
 
    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>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }
 
    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Timer^  timer1;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::Button^  button3;
    private: System::Windows::Forms::Button^  button4;
    private: System::Windows::Forms::Button^  button5;
    private: System::Windows::Forms::Button^  button6;
    private: System::Windows::Forms::Button^  button7;
    private: System::Windows::Forms::Button^  button8;
    private: System::Windows::Forms::Button^  button9;
 
    protected: 
    private: System::ComponentModel::IContainer^  components;
 
    private:
        /// <summary>
        /// Required designer variable.
        /// </summary>
 
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
            this->components = (gcnew System::ComponentModel::Container());
            this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->button3 = (gcnew System::Windows::Forms::Button());
            this->button4 = (gcnew System::Windows::Forms::Button());
            this->button5 = (gcnew System::Windows::Forms::Button());
            this->button6 = (gcnew System::Windows::Forms::Button());
            this->button7 = (gcnew System::Windows::Forms::Button());
            this->button8 = (gcnew System::Windows::Forms::Button());
            this->button9 = (gcnew System::Windows::Forms::Button());
            this->SuspendLayout();
            // 
            // timer1
            // 
            this->timer1->Enabled = true;
            this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
            // 
            // button1
            // 
            this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button1->Location = System::Drawing::Point(420, 341);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(35, 35);
            this->button1->TabIndex = 0;
            this->button1->Text = L"\\";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click_1);
            // 
            // button2
            // 
            this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button2->Location = System::Drawing::Point(461, 341);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(35, 35);
            this->button2->TabIndex = 1;
            this->button2->Text = L"^\r\n";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click_1);
            // 
            // button3
            // 
            this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button3->Location = System::Drawing::Point(502, 341);
            this->button3->Name = L"button3";
            this->button3->Size = System::Drawing::Size(35, 35);
            this->button3->TabIndex = 2;
            this->button3->Text = L"/";
            this->button3->UseVisualStyleBackColor = true;
            this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click_1);
            // 
            // button4
            // 
            this->button4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button4->Location = System::Drawing::Point(420, 382);
            this->button4->Name = L"button4";
            this->button4->Size = System::Drawing::Size(35, 35);
            this->button4->TabIndex = 3;
            this->button4->Text = L"<";
            this->button4->UseVisualStyleBackColor = true;
            this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click_1);
            // 
            // button5
            // 
            this->button5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button5->Location = System::Drawing::Point(461, 382);
            this->button5->Name = L"button5";
            this->button5->Size = System::Drawing::Size(35, 35);
            this->button5->TabIndex = 4;
            this->button5->Text = L"X";
            this->button5->UseVisualStyleBackColor = true;
            this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
            // 
            // button6
            // 
            this->button6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button6->Location = System::Drawing::Point(502, 382);
            this->button6->Name = L"button6";
            this->button6->Size = System::Drawing::Size(35, 35);
            this->button6->TabIndex = 5;
            this->button6->Text = L">";
            this->button6->UseVisualStyleBackColor = true;
            this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click_1);
            // 
            // button7
            // 
            this->button7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button7->Location = System::Drawing::Point(420, 423);
            this->button7->Name = L"button7";
            this->button7->Size = System::Drawing::Size(35, 35);
            this->button7->TabIndex = 6;
            this->button7->Text = L"/";
            this->button7->UseVisualStyleBackColor = true;
            this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click_1);
            // 
            // button8
            // 
            this->button8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button8->Location = System::Drawing::Point(461, 423);
            this->button8->Name = L"button8";
            this->button8->Size = System::Drawing::Size(35, 35);
            this->button8->TabIndex = 7;
            this->button8->Text = L"|";
            this->button8->UseVisualStyleBackColor = true;
            this->button8->Click += gcnew System::EventHandler(this, &Form1::button8_Click_1);
            // 
            // button9
            // 
            this->button9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->button9->Location = System::Drawing::Point(502, 423);
            this->button9->Name = L"button9";
            this->button9->Size = System::Drawing::Size(35, 35);
            this->button9->TabIndex = 8;
            this->button9->Text = L"\\";
            this->button9->UseVisualStyleBackColor = true;
            this->button9->Click += gcnew System::EventHandler(this, &Form1::button9_Click_1);
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->BackColor = System::Drawing::Color::White;
            this->ClientSize = System::Drawing::Size(549, 470);
            this->Controls->Add(this->button9);
            this->Controls->Add(this->button8);
            this->Controls->Add(this->button7);
            this->Controls->Add(this->button6);
            this->Controls->Add(this->button5);
            this->Controls->Add(this->button4);
            this->Controls->Add(this->button3);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            this->ResumeLayout(false);
 
        }
#pragma endregion
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
            }
    private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
                 Color ^col=gcnew Color();
                 Color ^bkcol=gcnew Color();
                 Pen ^pen=gcnew Pen(col->White);
                 Graphics ^im=this->CreateGraphics();
                 pen->Color=col->White;
                 im->FillRectangle(pen->Brush,0,0,1000,1000);
                 pen->Color=col->Black;
                 a+=c;
                 b+=d;
                 im->DrawEllipse(pen,200+a,200+b,50,50);
             }
    private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
                 this->Close();
             }
 
private: System::Void button1_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=-10;
             d=-10;
         }
private: System::Void button2_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=0;
             d=-10;
         }
private: System::Void button3_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=10;
             d=-10;
         }
private: System::Void button4_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=-10;
             d=0;
         }
private: System::Void button6_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=10;
             d=0;
         }
private: System::Void button7_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=-10;
             d=10;
         }
private: System::Void button8_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=0;
             d=10;
         }
private: System::Void button9_Click_1(System::Object^  sender, System::EventArgs^  e) {
             c=10;
             b=10;
         }
};
}
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
30.06.2011, 23:17
Помогаю со студенческими работами здесь

ASUS X55C при подключении шлейфа матрицы отключается
Всем привет. Такая тема, достался мне ASUS X55C который не включался. После разборки выяснилось что отгорел или был вырван с посадочной...

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

Samsung np300e5x. При подключении шлейфа матрицы не включается
Всем привет Такая проблемка: при подключении шлейфа матрицы не включается ноутбук. При этом, перестает гореть индикатор питания,...

Сгорит ли коннектор шлейфа матрицы при несъемном аккумуляторе?
Здравствуйте, у родственников на ноутбуке разбита матрица, попросили заменить. У ноутбука несъемный аккумулятор. Если я разряжу аккумулятор...

ASUS d541n выключается при работе от аккумулятора и при перемещении
Здравствуйте. Купил ноут в декабре 2018...


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

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Новые блоги и статьи
Программный контроль заполнения реквизита табличной части документа
Maks 02.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: реализовать контроль заполнения реквизита "ПричинаСписания". . .
wmic не является внутренней или внешней командой
Maks 02.04.2026
Решение: DISM / Online / Add-Capability / CapabilityName:WMIC~~~~ Отсюда: https:/ / winitpro. ru/ index. php/ 2025/ 02/ 14/ komanda-wmic-ne-naydena/
Программная установка даты и запрет ее изменения
Maks 02.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: при создании документов установить период списания автоматически. . .
Вывод данных в справочнике через динамический список
Maks 01.04.2026
Реализация из решения ниже выполнена на примере нетипового справочника "Спецтехника" разработанного в конфигурации КА2. Задача: вывести данные из ТЧ нетипового документа. . .
Программное заполнения текстового поля в реквизите формы документа
Maks 01.04.2026
Алгоритм из решения ниже реализован на нетиповом документе "ВыдачаОборудованияНаСпецтехнику" разработанного в конфигурации КА2, в дополнении к предыдущему решению. На форме документа создается. . .
К слову об оптимизации
kumehtar 01.04.2026
Вспоминаю начало 2000-х, университет, когда я писал на Delphi. Тогда среди программистов на форумах активно обсуждали аккуратную работу с памятью: нужно было следить за переменными, вовремя. . .
Идея фильтра интернета (сервер = слой+фильтр).
Hrethgir 31.03.2026
Суть идеи заключается в том, чтобы запустить свой сервер, о чём я если честно мечтал давно и давно приобрёл книгу как это сделать. Но не было причин его запускать. Очумелые учёные напечатали на. . .
Модель здравосоХранения 6. ESG-повестка и устойчивое развитие; углублённый анализ кадрового бренда
anaschu 31.03.2026
В прикрепленном документе раздумья о том, как можно поменять модель в будущем
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru