Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
18.11.2012, 19:56
|
|||
---|---|---|---|
|
|||
Нужна помощь по C# |
|||
#18+
Задание звучит так: Напишите приложение, которое в заголовке формы выводит ее размеры и координаты на экране, а по центру формы независимо от ее размеров изображает круг радиусом 30 пикселей. Минимальный размер формы – 150×150. Проблема: При расширении формы эллипс перетаскивается и когда выходит за первоначальные границы формы (300; 300) - исчезает. Как это исправить? Вот мой код: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Задание_1 { public partial class MainForm : Form { Graphics G; Pen MyPen; int x, y; public MainForm() { InitializeComponent(); G = CreateGraphics(); MyPen = new Pen(Color.Blue, 3); } private void MainForm_Move(object sender, EventArgs e) { Text = "Размер " + Width + "*" + Height + "," + this.Location; int x = this.ClientSize.Width / 2; int y = this.ClientSize.Height / 2; } private void MainForm_Resize(object sender, EventArgs e) { G.Clear(Color.Silver); Text = "Размер " + Width + "*" + Height + "," + this.Location; x = ClientSize.Width / 2; y = ClientSize.Height / 2; G.DrawEllipse(MyPen, x - 30, y - 30, 60, 60); } private void MainForm_Shown(object sender, EventArgs e) { Text = "Размер " + Width + "*" + Height + "," + this.Location; x = ClientSize.Width / 2 ; y = ClientSize.Height / 2; G.DrawEllipse(MyPen, x - 30, y - 30, 60, 60); } private void MainForm_Load(object sender, EventArgs e) { this.MinimumSize = new Size(150, 150); } } } Модератор: Тема перенесена из форума "C++". ... |
|||
:
Нравится:
Не нравится:
|
|||
|
19.11.2012, 04:06
|
|||
---|---|---|---|
Нужна помощь по C# |
|||
#18+
djmalina, Код: c# 1. 2. 3. 4. 5. 6. 7. 8. 9.
... |
|||
:
Нравится:
Не нравится:
|
|||
|
|
start [/forum/topic.php?fid=20&tablet=1&tid=1405631]: |
0ms |
get settings: |
12ms |
get forum list: |
12ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
37ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
42ms |
get tp. blocked users: |
2ms |
others: | 359ms |
total: | 487ms |
0 / 0 |