/
Motlokhov
/
ASKYZ
Обзор
Документация
Войти
/
Motlokhov
/
ASKYZ
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
SystemVerifyKnowledge.StudentUI/Windows/ChoseDirectionForm.cs
58 строк
2 KB
Mikhail Motlokhov
Renamed all lib
07 июн 2021, 18:25
07 июн 2021, 18:25
dc4644b
Код
Авторство
О чём код?
using Database.Result; using System; using System.Windows.Forms; using SystemVerifyKnowledge.CoreLib; namespace StudentUI { public partial class ChoseDirectionForm : AbstractForm { private readonly QueryResult _queryResult = new QueryResult(CustomDependencyInjection.DbConnection); public ChoseDirectionForm() { InitializeComponent(); Show(); CreateDirectionsButtons(); } public void CreateDirectionsButtons() { (byte id, string name)[] result = _queryResult.LoadAllDirections(); int top = 250; int width = 500; int height = 60; int margin = height + 10; for( int i = 0; i < result.Length; i++ ) { Button button = new Button { Text = result[i].name, Tag = result[i].id, Width = width , Height = height , Left = Width / 2 - width / 2 , Top = top , Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left , Font = new System.Drawing.Font("Arial" , 18) }; button.Click += (s , e) => { var but = s as Button; Core.SetDirection(Convert.ToByte(but.Tag),but.Text); var form = new ChoseProgramGroup(); form.Show(); Close(); }; Controls.Add(button); top += margin; } } private void ОПрограммеToolStripMenuItem_Click(object sender, EventArgs e) { AboutForm aboutForm = new AboutForm(); aboutForm.Show(); } } }