public void FormKontrolluGetir(MetroForm gelenform) { Form kutuIciForm = null; foreach (Control item in grpAnaKutu.Controls) { foreach (MetroForm form in item.Controls) { if (form.Name == gelenform.Name) { istasyonMu = true; } else { kutuIciForm = form; break; } } } if (!istasyonMu) { //Tools.FormGetir(this, gelenform, grpAnaKutu, kutu, kutuVarMi, mlBilet); FormGetir(gelenform); mlBilet.Style = MetroColorStyle.Black; mlIstasyonTren.Style = MetroColorStyle.Blue; } }
public static void ShowForm(MetroForm myfrm) { var mymsm = MyFormStyles.GetStyleManager(myfrm); //check tagging of the form specific size. if (myfrm.Tag != null) { switch (myfrm.Tag.ToString().ToLower()) { case "menu": //for the menu list for short cuts. myfrm.Size = MenuWindowSettings.WindowSize; if (MyFormStyles.MyStyle == MetroFramework.MetroThemeStyle.Light) { mymsm.Theme = MetroFramework.MetroThemeStyle.Dark; } else { mymsm.Theme = MetroFramework.MetroThemeStyle.Light; } break; case "list": //for the menu list for short cuts. myfrm.Size = ListWindowSettings.WindowSize; break; default: break; } } myfrm.StyleManager = mymsm; myfrm.StartPosition = FormStartPosition.CenterScreen; myfrm.ShadowType = MetroFormShadowType.DropShadow; myfrm.BorderStyle = MetroFormBorderStyle.FixedSingle; myfrm.Show(); }
public static DialogResult RestoreConfigAsk() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1)); MetroForm metroForm = new MetroForm { ShadowType = MetroFormShadowType.AeroShadow, Width = 280, Height = 135, FormBorderStyle = FormBorderStyle.None, Resizable = false, AutoSize = true, Icon = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"), AutoSizeMode = AutoSizeMode.GrowOnly, ControlBox = false, Theme = MetroThemeStyle.Dark, DisplayHeader = false, TopMost = true, Text = "", StartPosition = FormStartPosition.CenterScreen }; MetroLabel metroLabel = new MetroLabel(); metroLabel.Text = "You are about to restore the selected file back to normal" + Environment.NewLine + "Please make sure the file is dated from this patch." + Environment.NewLine + "Are you willing to continue?"; metroLabel.AutoSize = true; metroLabel.Left = 5; metroLabel.Top = 20; metroLabel.Width = 270; metroLabel.Height = 40; metroLabel.TextAlign = ContentAlignment.MiddleCenter; metroLabel.Theme = MetroThemeStyle.Dark; MetroLabel value = metroLabel; MetroButton metroButton = new MetroButton { Text = "Yes", Left = 5, Width = 100, Top = 100, DialogResult = DialogResult.Yes, Theme = MetroThemeStyle.Dark }; MetroButton metroButton2 = new MetroButton { Text = "No", Left = 125, Width = 100, Top = 100, DialogResult = DialogResult.No, Theme = MetroThemeStyle.Dark }; metroButton.TabStop = false; metroButton2.TabStop = false; metroForm.Controls.Add(metroButton); metroForm.Controls.Add(value); metroForm.Controls.Add(metroButton2); metroForm.AcceptButton = metroButton; metroForm.AcceptButton = metroButton2; metroForm.Style = ColorSet; return(metroForm.ShowDialog()); }
public static void SetStyle(this IContainer container, MetroForm ownerForm) { var manager = new MetroStyleManager(container ?? (container = new Container())); manager.Owner = ownerForm; container.SetDefaultStyle(ownerForm, FormStyle); }
/// <summary> /// 双击行修改制图参数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvQuickBrowse_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgvQuickBrowse.RowCount == 0) { return; } if (dgvQuickBrowse.CurrentRow == null) { return; } string moduleTreeId = dgvQuickBrowse.CurrentRow.Cells["ModuleTreeId"].Value.ToString(); ModuleTree objModuleTree = objModuleTreeService.GetModuleTreeById(moduleTreeId); DialogResult result = DialogResult.No; //利用反射,打开修改模型参数窗口,同时实现传递窗口参数 object[] parameters = new object[2]; parameters[0] = objDrawing; parameters[1] = objModuleTree; MetroForm objFrmModel = (MetroForm)Assembly.Load("Compass").CreateInstance("Compass.Frm" + objModuleTree.CategoryName, true, BindingFlags.Default, null, parameters, null, null); result = objFrmModel.ShowDialog(); if (result == DialogResult.OK) { RefreshData(objDrawing, objModuleTree);//更新数据表 } }
public static DialogResult MultipleClient() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1)); MetroForm obj = new MetroForm { ShadowType = MetroFormShadowType.AeroShadow, Width = 280, Height = 135, FormBorderStyle = FormBorderStyle.None, Resizable = false, AutoSize = true, Icon = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"), AutoSizeMode = AutoSizeMode.GrowOnly, ControlBox = false, Theme = MetroThemeStyle.Dark, DisplayHeader = false, TopMost = true, Text = "", StartPosition = FormStartPosition.CenterScreen }; MetroLabel value = new MetroLabel { Text = "32bit and 64bit clients were found. Which would you like to use by default?", AutoSize = true, Left = 5, Top = 20, Width = 270, Height = 40, TextAlign = ContentAlignment.MiddleCenter, Theme = MetroThemeStyle.Dark }; MetroButton metroButton = new MetroButton { Text = "32 bit", Left = 5, Width = 100, Top = 100, DialogResult = DialogResult.Yes, Theme = MetroThemeStyle.Dark }; MetroButton metroButton2 = new MetroButton { Text = "64 bit", Left = 125, Width = 100, Top = 100, DialogResult = DialogResult.No, Theme = MetroThemeStyle.Dark }; metroButton.TabStop = false; metroButton2.TabStop = false; obj.Controls.Add(metroButton); obj.Controls.Add(value); obj.Controls.Add(metroButton2); obj.AcceptButton = metroButton; obj.AcceptButton = metroButton2; obj.Style = ColorSet; return(obj.ShowDialog()); }
public static bool CheckRequirement(MetroForm frm, Control[] AllControl) { bool check = false; foreach (Control ctrl in AllControl) { check = ctrl.Text.Trim() == "" ? SetRedBox(frm, ctrl) : check; if (ctrl.Tag == "double") { try { if (double.Parse(ctrl.Text.Trim()) <= 0 ) { check = SetRedBox(frm, ctrl); } } catch (Exception) { check = SetRedBox(frm, ctrl); } } } return(check); }
private static Form GetProgressForm(Form parentForm, Action <Form> setup) { var control = new MetroForm(); control.ShowInTaskbar = false; control.MaximizeBox = false; control.MinimizeBox = false; //var spinner = new MetroProgressBar(); //spinner.ProgressBarStyle = ProgressBarStyle.Marquee; //spinner.Enabled = true; //spinner.Dock = DockStyle.Top; //control.Controls.Add(spinner); control.ControlBox = false; control.Size = new Size(parentForm.Width, control.Height); control.StartPosition = FormStartPosition.CenterParent; if (setup != null) { setup(control); } return(control); }
public static async Task AlgorithmStart(MetroForm form, Label lbl_Score, Label lbl_BestScore, Label lbl_Generation, Label lblBestNum) { Initialization(form); while (true) { _generation++; Players.Clear(); lbl_Generation.Text = $@"{_generation} 세대"; for (int i = 0; i < _weights.Length; i++) { TetrisAI player = TetrisAI.GeneticMode(_panels[i], lbl_Score, lblBestNum, i + 1, _weights[i].Clone()); Players.Add(player); } await GameStart(); _bestScore = Math.Max(_bestScore, Players.Max(t => t.Score)); lbl_BestScore.Text = _bestScore.ToString(); lbl_Score.Text = "0"; MixParents(); } }
public static string ShowDialog(string text, string caption) { MetroForm prompt = new MetroForm() { Width = 450, Height = 150, Text = caption, Style = MetroFramework.MetroColorStyle.Orange, Resizable = false, ControlBox = false, TextAlign = MetroFormTextAlign.Center, StartPosition = FormStartPosition.CenterScreen }; MetroTextBox textBox = new MetroTextBox() { Left = 115, Top = 65, Width = 200 }; MetroButton confirmation = new MetroButton() { Text = "Ok", Left = 165, Width = 100, Top = 100, DialogResult = DialogResult.OK }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(textBox); prompt.Controls.Add(confirmation); textBox.Style = MetroFramework.MetroColorStyle.Orange; textBox.KeyPress += (sender, e) => { e.Handled = !char.IsLetter(e.KeyChar) && !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar); }; prompt.AcceptButton = confirmation; return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""); }
public static void AgregarForm(MetroForm metroForm) { listaForms.Add(metroForm); RecorridoForm.CambiarIdioma(metroForm); }
public Form1() { InitializeComponent(); SymbolsForm = new MetroForm(); SymbolsForm.Name = "SymbolsForm"; SymbolsForm.Text = "Symbols"; }
public static DialogResult ShowNotification(MetroForm parentForm, NotificationType type, string message, MessageBoxButtons notificationButtons = MessageBoxButtons.OK) { var title = NotificationTitle + " - " + type; MessageBoxIcon boxStyle; switch (type) { case NotificationType.Information: boxStyle = MessageBoxIcon.Information; break; case NotificationType.Warning: boxStyle = MessageBoxIcon.Warning; break; case NotificationType.Error: boxStyle = MessageBoxIcon.Error; break; default: boxStyle = MessageBoxIcon.Information; break; } return(MetroMessageBox.Show(parentForm, message, title, notificationButtons, boxStyle)); }
/// <summary> /// 双击模型树添加标签图片,修改制图参数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvModule_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (tvModule.SelectedNode == null) { return; } if (tvModule.SelectedNode.Level == 2) { string drawingPlanId = tvModule.SelectedNode.Parent.Tag.ToString(); string moduleTreeId = tvModule.SelectedNode.Tag.ToString(); if (drawingPlanId.Length < 4) { return; } drawingPlanId = drawingPlanId.Substring(4);//除去item Drawing objDrawing = objDrawingService.GetDrawingById(drawingPlanId); ModuleTree objModuleTree = objModuleTreeService.GetModuleTreeById(moduleTreeId); //利用反射,打开修改模型参数窗口,同时实现传递窗口参数 object[] parameters = new object[2]; parameters[0] = objDrawing; parameters[1] = objModuleTree; MetroForm objFrmModel = (MetroForm)Assembly.Load("Compass").CreateInstance("Compass.Frm" + objModuleTree.CategoryName, true, BindingFlags.Default, null, parameters, null, null); objFrmModel.ShowDialog(); } }
public static void CloseForms(MetroForm parentform, Boolean isLogOff) { try { var strname = "a"; var isclose = true; foreach (var frm in parentform.MdiChildren) { isclose = true; strname = frm.Name; if (!isLogOff) { if (strname == "frmMenus") { isclose = false; } } if (isclose) { frm.Close(); } } } catch (Exception ex) { throw ex; } }
public static void SetDefaultTheme(this IContainer contr, MetroForm owner, MetroThemeStyle thme) { MetroStyleManager manager = FindManager(contr, owner); manager.Theme = thme; owner.Theme = thme; }
public static void SetDefaultStyle(this IContainer contr, MetroForm owner, MetroColorStyle style) { MetroStyleManager manager = FindManager(contr, owner); manager.Style = style; owner.Style = style; }
private ThemeManager(MetroForm form) { _form = form; _styleManager = new MetroStyleManager { Owner = _form }; }
public static bool login(user ExisitingUser, MetroForm ui) { try { row = UserDataTable.FindByusername(ExisitingUser.username); if (row == null) { MSG.ERROR(ui, "User Doesn't Exists in the System"); return(false); } if ((row.username.ToString() == ExisitingUser.username) && (row.password.ToString() == ExisitingUser.password)) { MSG.SUCCESS(ui, "Login Success.!"); ui.Hide(); frm_dashboard n = new frm_dashboard(); n.ShowDialog(); ui.Close(); return(true); } else { MSG.ERROR(ui, "Username and Password Doesn't Match!"); return(false); } } catch (MySql.Data.MySqlClient.MySqlException ex) { MSG.ERROR(ui, "Login Error.!, " + ex.Message); return(false); } }
public bool txtTurStringKontrol(string[] txtBoxAdlar, MetroPanel pnl, MetroForm frm) { int i = 0; while (i < txtBoxAdlar.Length) { MetroTextBox txtBox = (MetroTextBox)pnl.Controls.Find("txt" + txtBoxAdlar[i], true)[0]; double x; int y; if (int.TryParse(txtBox.Text, out y)) { i++; } else if (double.TryParse(txtBox.Text, out x)) { return(true); } else { MetroMessageBox.Show(frm, "Hata !", txtBoxAdlar[i] + " alanı metinsel ifade içeremez !", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (txtBoxAdlar.Length == i) { return(true); } return(false); }
public ReceiveManager(MySqlDataReader dataReader, MetroForm _login) { InitializeComponent(); login = _login; this.FormClosing += ReceiveManager_FormClosing; worker_id = dataReader.GetString("worker_name"); this.Text = "欢迎回来," + dataReader.GetString("worker_name"); dataReader.Close(); DataGridViewButtonColumn request_column = new DataGridViewButtonColumn(); request_column.HeaderText = "请求"; //gigUrlColumn.Name = "Gig Url name"; request_column.Text = "确认"; request_column.UseColumnTextForButtonValue = true; request_column.Width = 106; WaitToConfrimDataGridView.Columns.Add(request_column); WaitToConfrimDataGridView.DataSource = FillDataGrid(); DataGridViewButtonColumn request2_column = new DataGridViewButtonColumn(); request2_column.HeaderText = "请求"; //gigUrlColumn.Name = "Gig Url name"; request2_column.Text = "接货成功"; request2_column.UseColumnTextForButtonValue = true; request2_column.Width = 106; CheckGridView.Columns.Add(request2_column); CheckGridView.DataSource = FillCheckData(); }
public static void SetSalesDataSet(string currentUser, MetroForm tempForm) { ResetSalesData(); SelectedForm = tempForm; CurrentUser = currentUser; if (Accounts.IsAdmin(CurrentUser) || currentUser == "") { CurrentAdmin = CurrentUser; AdminSales(); return; } SalesView = SelectedForm.GetControl <DataGridViewX>("SalesView"); SalesView.AllowUserToDeleteRows = true; SalesCalendar = SelectedForm.GetControl <MonthCalendarAdv>("SalesCalendar"); SalesCalendar.SelectionStart = DateTime.Now; SalesCalendar.SelectionEnd = DateTime.Now; SalesCalendar.MarkedDates = null; SalesCalendar.UpdateMarkedDates(); InitializeSalesData(); SelectedForm.GetControl <LabelX>("TotalTeamSales").Text = $"Total Team Sales: {SalesDataSet.GetAllSales()}"; InitializeEvents(); }
public FormUSBCopySNTool(MetroForm Sender, string[] RemovableDisks, string Source) { InitializeComponent(); this.sender = Sender; this.source = Source; this.metroComboBoxRemovableDisks.DataSource = RemovableDisks; this.metroComboBoxRemovableDisks.SelectedIndex = 0; string[] vendors = Directory.GetDirectories(this.source, "*", SearchOption.TopDirectoryOnly); if (vendors.Length > 0) { List <string> vendorNames = new List <string>(); foreach (string vendor in vendors) { vendorNames.Add(new DirectoryInfo(vendor).Name); } this.metroComboBoxFirmwareVendors.DataSource = vendorNames; this.metroComboBoxFirmwareVendors.SelectedIndex = 0; } }
public static void SetDefaultTheme(this IContainer contr, MetroForm owner, MetroThemeStyle theme) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) MetroStyleManager val = FindManager(contr, owner); val.set_Theme(theme); }
public static string ShowDialog(string text) { MetroForm prompt = new MetroForm { Width = 500, Height = 150, FormBorderStyle = FormBorderStyle.FixedDialog, StartPosition = FormStartPosition.CenterScreen, Theme = MetroThemeStyle.Dark, ShowInTaskbar = false, MinimizeBox = false, MaximizeBox = false }; MetroLabel textLabel = new MetroLabel() { Left = 50, Top = 20, Text = text, Width = 400, Theme = MetroThemeStyle.Dark }; MetroTextBox textBox = new MetroTextBox() { Left = 50, Top = 50, Width = 400, Theme = MetroThemeStyle.Dark }; MetroButton confirmation = new MetroButton() { Text = "Confirm", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK, Theme = MetroThemeStyle.Dark }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(textBox); prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.AcceptButton = confirmation; return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""); }
private static void UpdateFormStyle(MetroForm form) { form.StyleManager = AppStyleManager; AppStyleManager.Owner = form; UpdateFormIcon(form); InvokeSwitchStyle(form); }
/// <summary> /// Set the cell format by Tool Strip Menu Item /// </summary> private void formatCellsToolStripMenuItem_Click(object sender, EventArgs e) { form = new MetroForm(); form.IsMdiContainer = true; dialog = new GroupingGridFormatCellDialog(this.gridGroupingControl1); dialog.FormBorderStyle = FormBorderStyle.None; dialog.Dock = DockStyle.Fill; dialog.MdiParent = form; form.Size = dialog.Size + new Size(17, 37); dialog.Controls[1].Click += new EventHandler(ButtonClick); dialog.Controls[0].Click += new EventHandler(ButtonClick); form.FormBorderStyle = FormBorderStyle.FixedSingle; form.Font = new System.Drawing.Font("Segoe UI", 8.25F); form.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226))))); form.BorderThickness = 2; form.CaptionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226))))); form.ShowIcon = false; form.MaximizeBox = false; form.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226))))); form.MinimizeBox = false; form.Text = "Format Cell Dialog"; dialog.Show(); form.ShowDialog(); }
public static void FormKontrolluGetir(Form anaForm, MetroForm gelenForm, GroupBox anaKutu, GroupBox kutu, bool istasyonMu, MetroLink mlBilet, MetroLink mlIstasyonTren) { Form kutuIciForm = null; foreach (Control item in anaKutu.Controls) { foreach (MetroForm form in item.Controls) { if (form.Name == gelenForm.Name) { istasyonMu = true; } else { kutuIciForm = form; break; } } } if (!istasyonMu) { Tools.FormGetir(anaForm, gelenForm, anaKutu, kutu, istasyonMu, mlBilet); mlBilet.Style = MetroColorStyle.Black; mlIstasyonTren.Style = MetroColorStyle.Blue; } }
private void AbrirUnFormulario(MetroForm myForm) { this.Hide(); CmdAbrirFormulario myCommand = CmdAbrirFormulario.Crear(myForm); myCommand.Ejecutar(); this.Show(); }
internal void createObject(MetroForm form) { if (form != null) { form.Close(); } form = new MetroForm(); }
protected override void OnCreateControl() { Form f = this.FindForm(); if (!(f is MetroForm)) throw new Exception("A metro control must be created in a MetroWindow"); ParentForm = (MetroForm)f; base.OnCreateControl(); }