void ReloadTraceInstances() { flInstances.SuspendDrawing(); cbInstances.BeginUpdate(); cbInstances.Items.Clear(); flInstances.Controls.Clear(); foreach (var trace in auditConfig.Traces) { cbInstances.Items.Add(trace.Instance.DataSource); var mtile = new MetroTile(); mtile.ActiveControl = null; mtile.Size = new System.Drawing.Size(160, 70); mtile.TabIndex = 4; mtile.Text = trace.Instance.DataSource; mtile.UseSelectable = true; mtile.Tag = trace; mtile.MouseUp += mtile_MouseUp; this.flInstances.Controls.Add(mtile); } cbInstances.EndUpdate(); flInstances.ResumeDrawing(); }
//Click event for departments private void DepartmentClick(object sender, EventArgs e) { var button = (Button)sender; MasterItemPanel.Controls.Clear(); var masterItemList = _masterItemService.GetAllMasterItemPerDepartment(int.Parse(button.Name)); int left = 0; foreach (var item in masterItemList) { MetroTile masteritemButton = new MetroTile(); masteritemButton.TileTextFontWeight = MetroFramework.MetroTileTextWeight.Bold; masteritemButton.Left = left; masteritemButton.Height = 100; masteritemButton.Width = 155; masteritemButton.Click += MasterItemClick; masteritemButton.Name = item.MasterItemId.ToString(); masteritemButton.Text = item.LongDescription + Environment.NewLine + Math.Round(Convert.ToDecimal(item.UnitPrice), 2).ToString("N"); masteritemButton.TextAlign = ContentAlignment.MiddleCenter; MasterItemPanel.Controls.Add(masteritemButton); } }
/// <summary> /// This function gets all the available times for the professor. /// </summary> /// <param name="a_text"></param> private void PerformGetAvailability(string a_text) { HttpClient client = NetworkClient.getInstance().getHttpClient(); string uri = BaseConnection.g_appointments + "/" + BaseConnection.g_schedules + "/" + a_text + "/"; List <Appointment> availableDates = null; try { /// Gets all the available dates divided into the chunks of half an hour. var resp = client.GetAsync(uri).Result; if (resp.IsSuccessStatusCode) { availableDates = resp.Content.ReadAsAsync <List <Appointment> >().Result; } } catch (Exception) { Worker.printServerError(this); } /// Builds the tiles dynamically if the dates are available. if (availableDates != null) { int x = 10, y = 10; resultPanel.Visible = true; resultPanel.Controls.Clear(); foreach (Appointment app in availableDates) { MetroTile tile = MakeAppointmentTile(app, x, y); resultPanel.Controls.Add(tile); y += 90; } } }
public void DrawCharacterTile(Character character) { int originX = 10; int originY = 116; int sizeX = 120; int sizeY = 127; int max = 6; MetroTile tile = new MetroTile(); tile.Name = "Character" + character.Index; tile.Text = character.Name; tile.TextAlign = ContentAlignment.BottomCenter; tile.UseTileImage = true; try { var request = WebRequest.Create(character.AvatarUrl); using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) { tile.TileImage = Bitmap.FromStream(stream); } } catch { } tile.TileImageAlign = ContentAlignment.TopCenter; tile.Size = new Size(sizeX, sizeY); int x = originX + (sizeX * (character.Index >= max ? character.Index - 6 : character.Index)); int y = originY + ((character.Index / 6) * sizeY); tile.Location = new Point(x, y); tile.Tag = character.ID; tile.Click += new EventHandler(CharacterTile_Click); CharacterSelectTab.Controls.Add(tile); }
// here! private void metrotile_Click(object sender, EventArgs e) { MetroTile x = (MetroTile)sender; string[] words = x.Name.Split('_'); string type = (words[0].Equals("dalamNegeri")) ? "Dalam Negeri" : "Luar Negeri"; if (Application.OpenForms[words[0] + "_list_" + words[2]] == null) { DocumentList list = new DocumentList(this, type + "\\" + words[2], type); list.Name = words[0] + "_list_" + words[2]; list.Text = "Daftar Kerjasama " + type + " " + x.Text; list.Size = new Size(879, 565); list.Show(); } else { Form list = Application.OpenForms[words[0] + "_list_" + words[2]]; list.Activate(); } }
public void defocuser(object sender, EventArgs e) { MetroTile Mt = (MetroTile)sender; if (Mt != Mate) { if (Mt.Style != MetroFramework.MetroColorStyle.Magenta) { Mt.Width = 92; Mt.Height = 42; Mt.Style = MetroFramework.MetroColorStyle.Blue; Mt.Left += 15; Mt.BringToFront(); Mt.Refresh(); metroProgressBar2.BringToFront(); metroProgressBar1.BringToFront(); metroProgressBar3.BringToFront(); metroProgressBar4.BringToFront(); metroProgressBar5.BringToFront(); } } }
private void 连同父级一起删除ToolStripMenuItem_Click(object sender, EventArgs e) { if (_currSelectTitle == null) { return; } var host = (RemoteHost)_currSelectTitle.Tag; using (var conn = new SQLiteConnection(Common.ConnectionString)) { conn.Open(); var tran = conn.BeginTransaction(); conn.Execute("DELETE FROM RemoteHost WHERE FId=@id", new { id = host.FParentId }); conn.Execute("DELETE FROM RemoteHost WHERE FParentId=@id", new { id = host.FParentId }); tran.Commit(); } var parent = _currSelectTitle.Parent.Parent; parent.Parent.Controls.Remove(parent); _currSelectTitle = null; }
private void LoadHostConfig() { panelBody.Controls.Clear(); //清空原有 var hosts = (List <RemoteHost>)Db.Connection.Query <RemoteHost>( "SELECT Id,Name,Address,Port,User,Pwd,Sort,ParentId,RemoteProgram FROM RemoteHost"); //创建分组 foreach (var hostGroup in hosts.Where(x => x.ParentId == 0).OrderByDescending(x => x.Sort)) { //建立分组 var hostGroupBox = new HostGroupBox { Dock = DockStyle.Top, Height = 100, Text = hostGroup.Name }; panelBody.Controls.Add(hostGroupBox); //填充分组内容 foreach (var host in hosts.Where(x => x.ParentId == hostGroup.Id).OrderBy(x => x.Sort)) { var title = new MetroTile { Name = "title", ActiveControl = null, Height = 60, Text = $"{host.Name}\r\n {host.FullAddress}", UseSelectable = true, UseVisualStyleBackColor = true, Tag = host, AutoSize = true, ContextMenuStrip = menuTitle, StyleManager = metroStyleManager }; title.Click += ConnectRemoteHost; title.MouseDown += MenuTitleRightClick; hostGroupBox.AddControl(title); } } }
private void BWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { ThisDevice cObj = (ThisDevice)e.UserState; if (ConnectedDevices.UpdateFlag == 0 && cObj.flag == 1) { Console.Write("\n" + cObj.data); } else if (ConnectedDevices.UpdateFlag == 1) { //availFlowControl.Controls.Clear(); MessageBox.Show("Updating"); foreach (var item in ConnectedDevices.ListClient) { metTile = new MetroTile(); metTile.Tag = item; metTile.Text = item.ToString(); //metTile.Click += MetTile_Click; //addedFlowControl.Controls.Add(metTile); } ConnectedDevices.UpdateFlag = 0; } }
private void MainForm_Load(object sender, EventArgs e) { AppUserFullNameLabel.Text = AppUserStatic.FullName; DepartmentPanel.WrapContents = true; MasterItemPanel.WrapContents = true; var departmentList = _departmentService.GetAllDepartment(); int left = 0; foreach (var item in departmentList) { MetroTile departmentButton = new MetroTile(); departmentButton.TileTextFontWeight = MetroFramework.MetroTileTextWeight.Bold; departmentButton.Left = left; departmentButton.Height = 70; departmentButton.Width = 126; departmentButton.Click += DepartmentClick; departmentButton.Name = item.DepartmentId.ToString(); departmentButton.Text = item.DepartmentDescription; departmentButton.TextAlign = ContentAlignment.MiddleCenter; DepartmentPanel.Controls.Add(departmentButton); left += 120; } }
public void GetGridTiles() { if (!File.Exists(filePath)) { File.Create(filePath).Close(); } var fileData = File.ReadAllText(filePath); globalTileList = JsonConvert.DeserializeObject <List <Tile> >(fileData) ?? new List <Tile>(); foreach (var tile in globalTileList) { maxID = tile.ID > maxID ? tile.ID : maxID; rowColumns.Add(new GridLocation() { row = tile.GridRowCol.row, column = tile.GridRowCol.column }); MetroTile metroTile = new MetroTile(); metroTile.Location = new Point(((tile.GridRowCol.column * 100) + xOffset), ((tile.GridRowCol.row * 100) + yOffset)); metroTile.Size = new Size(71, 71); metroTile.Name = tile.ID.ToString(); metroTile.UseTileImage = true; metroTile.Text = tile.Name; metroTile.ForeColor = Color.Black; metroTile.CustomForeColor = true; metroTile.TileTextFontWeight = MetroFramework.MetroTileTextWeight.Bold; metroTile.TextAlign = ContentAlignment.BottomCenter; if (tile.ImageLocation != "") { metroTile.TileImage = ResizeImage(Image.FromFile(tile.ImageLocation), 71, 71); } ContextMenu cm = new ContextMenu(); cm.MenuItems.Add("Propertes", new EventHandler(Properties_click)); metroTile.ContextMenu = cm; this.Controls.Add(metroTile); } }
private void disable_click(object sender, EventArgs e) { MetroTile mt = (MetroTile)sender; int code = (int)mt.Tag; switch (code) { case LIP_STICK_COMMAND: mkParams.LipEnabled = false; break; case LIP_LINE_COMMAND: mkParams.LipEnabled = false; break; case EYE_COMMAND: mkParams.EyeEnabled = false; break; case EYEBROW_COMMAND: mkParams.EyebrowEnabled = false; break; case EYE_LINE_COMMAND: mkParams.EyeLineEnabled = false; break; case SKIN_COMMAND: mkParams.SkinEnabled = false; break; case HAIR_COMMAND: mkParams.HairEnabled = false; break; } Remakup(); }
private void frmDatBan_Load(object sender, EventArgs e) { metroTileList = new List <MetroTile>(tableList.Count); for (int i = 0; i < tableList.Count; i++) { selected.Add(null); // Thiết lập thuộc tính cho tile MetroTile tile = new MetroTile(); tile.Size = new Size(120, 75); tile.UseTileImage = true; tile.TileImage = Properties.Resources.round; tile.TileImageAlign = ContentAlignment.MiddleCenter; tile.Text = (i + 1).ToString(); tile.UseCustomForeColor = true; tile.ForeColor = Color.Black; tile.TextAlign = ContentAlignment.MiddleCenter; tile.TileTextFontSize = MetroTileTextSize.Tall; tile.TileTextFontWeight = MetroTileTextWeight.Bold; tile.Margin = new Padding(10); tile.Click += Tile_Click; if (tableList[i].TinhTrang == "Còn trống") { tile.Style = MetroColorStyle.Green; } else { tile.Style = MetroColorStyle.Red; } flowLayoutPanel.Controls.Add(tile); metroTileList.Add(tile); } }
public pnlLogin(Form owner) : base(owner) { InitializeComponent(); _owner = owner; for (int i = 3; i < 13; i++) { MetroTile _tile = new MetroTile(); _tile.Size = new Size(30, 30); _tile.Tag = i; _tile.Style = (MetroColorStyle)i; _tile.Click += _tile_Click; flpSettings.Controls.Add(_tile); } txtServer.Text = Settings.Default.Server; txtDB.Text = Settings.Default.Database; txtPortNo.Text = Settings.Default.Port; txtUser.Text = Settings.Default.Username; txtPass.Text = Settings.Default.Password; if (Settings.Default.Theme == MetroThemeStyle.Dark) { mrbDark.Checked = true; } else { mrbLight.Checked = true; } this.Shown += pnlLogin_Shown; metroToggle1.ForeColor = MetroColors.Green; metroToggle1.Text = "Open"; }
/// <summary> /// Добавление элемента Tile на форму и в лист /// </summary> public static MetroTile AddTile(string TileText) { MetroTile newTile = new MetroTile(); newTile.ActiveControl = null; newTile.Location = new System.Drawing.Point(0, 0); newTile.Name = "PMetroTile" + (TileList.Count + 1).ToString(); newTile.Size = new System.Drawing.Size(184, 136); newTile.TabIndex = TileList.Count + 1; newTile.Text = TileText; newTile.Theme = BankAccountsPage.Theme; newTile.TileImage = global::FinanceManager.Properties.Resources.PlasticCard; newTile.TileImageAlign = System.Drawing.ContentAlignment.MiddleCenter; newTile.UseSelectable = true; newTile.UseTileImage = true; newTile.MouseMove += GlavnForm.MouseOnTile; PlasticCardsPage.Controls.Add(newTile); TileList.Add(newTile); RePaint(); return(newTile); }
/// <summary> /// Binds to color properties in app controller and text box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ColorTile_Click(object sender, EventArgs e) { MetroTile root = (MetroTile)sender; Color newColor = OpenColorDialog(root.ForeColor); if (root.Name == Color1Tile.Name) { Color1TB.Text = newColor.ToHexString(); } else if (root.Name == Color2Tile.Name) { Color2TB.Text = newColor.ToHexString(); } SetTileColor(root, newColor); if (root.Name == Color1Tile.Name) { AppController.Color1 = newColor; } else if (root.Name == Color2Tile.Name) { AppController.Color2 = newColor; } }
//CREATE BUTTONS public MetroTile CreateButton(string name, string text, string tag) { //Button btnNuevo = new Button(); MetroTile btnNuevo = new MetroTile { Name = name, Text = text, AutoSize = true, Font = new Font("Microsoft Sans Serif", 14, FontStyle.Bold), Width = 50,// panelLeftDownChannels.Width - 20; Height = 70, //STYLE METRO BackColor = Color.RoyalBlue, Cursor = Cursors.Hand, TextAlign = ContentAlignment.MiddleCenter, TileTextFontSize = MetroFramework.MetroTileTextSize.Tall, TileTextFontWeight = MetroFramework.MetroTileTextWeight.Bold, Padding = new Padding(3), //TAG TO EVENT Tag = tag }; return(btnNuevo); }
private static void BlinkTile(MetroTile tile, Color color1, Color color2) { if (tile == null) { return; } tile.BeginInvoke(new Action(() => { tile.BackColor = color1; })); System.Threading.Thread.Sleep(100); tile.BeginInvoke(new Action(() => { tile.BackColor = color2; })); System.Threading.Thread.Sleep(100); tile.BeginInvoke(new Action(() => { tile.BackColor = color1; })); }
public EditorDialog( CollectionPropertyEditorUtils.CollectionType collectionType, Func <Dictionary <string, string>, string, PropertyEditor <T> > creator ) { m_collectionType = collectionType; m_creator = creator; MetroSkinManager.ApplyMetroStyle(this); Text = "Collection Editor"; TextAlign = MetroFormTextAlign.Center; Size = DEFAULT_SIZE; ShowInTaskbar = false; ControlBox = false; Resizable = false; DialogResult = DialogResult.None; MetroPanel panel = new MetroPanel(); MetroSkinManager.ApplyMetroStyle(panel); panel.Dock = DockStyle.Fill; Controls.Add(panel); MetroPanel contentPanel = new MetroPanel(); MetroSkinManager.ApplyMetroStyle(contentPanel); contentPanel.Width = panel.Width; contentPanel.Height = panel.Height - DEFAULT_BUTTON_HEIGHT - DEFAULT_SEPARATOR - DEFAULT_BUTTON_HEIGHT - 16; contentPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; panel.Controls.Add(contentPanel); m_content = new MetroPanel(); MetroSkinManager.ApplyMetroStyle(m_content); m_content.Dock = DockStyle.Fill; m_content.Controls.Clear(); contentPanel.Controls.Add(m_content); m_contentScrollbarV = new MetroScrollBar(MetroScrollOrientation.Vertical); MetroSkinManager.ApplyMetroStyle(m_contentScrollbarV); m_contentScrollbarV.Dock = DockStyle.Right; m_contentScrollbarV.Scroll += new ScrollEventHandler(m_contentScrollbarV_Scroll); contentPanel.Controls.Add(m_contentScrollbarV); m_addButton = new MetroTile(); MetroSkinManager.ApplyMetroStyle(m_addButton); m_addButton.Text = "Add Item"; m_addButton.TextAlign = ContentAlignment.MiddleCenter; m_addButton.TileTextFontWeight = MetroTileTextWeight.Bold; m_addButton.Width = panel.Width; m_addButton.Height = DEFAULT_BUTTON_HEIGHT; m_addButton.Top = panel.Height - DEFAULT_BUTTON_HEIGHT - DEFAULT_SEPARATOR - DEFAULT_BUTTON_HEIGHT; m_addButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; m_addButton.Click += new EventHandler(m_addButton_Click); panel.Controls.Add(m_addButton); m_okButton = new MetroTile(); MetroSkinManager.ApplyMetroStyle(m_okButton); m_okButton.Text = "OK"; m_okButton.TextAlign = ContentAlignment.MiddleCenter; m_okButton.TileTextFontWeight = MetroTileTextWeight.Bold; m_okButton.Width = panel.Width; m_okButton.Height = DEFAULT_BUTTON_HEIGHT; m_okButton.Top = panel.Height - DEFAULT_BUTTON_HEIGHT; m_okButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; m_okButton.Click += new EventHandler(m_okButton_Click); panel.Controls.Add(m_okButton); }
private void InitializeComponent() { this.metroTile1 = new MetroFramework.Controls.MetroTile(); this.metroTile2 = new MetroFramework.Controls.MetroTile(); this.metroTile3 = new MetroFramework.Controls.MetroTile(); this.metroTile4 = new MetroFramework.Controls.MetroTile(); this.metroTile5 = new MetroFramework.Controls.MetroTile(); this.metroTile6 = new MetroFramework.Controls.MetroTile(); this.metroTile7 = new MetroFramework.Controls.MetroTile(); this.metroTile8 = new MetroFramework.Controls.MetroTile(); this.metroTile9 = new MetroFramework.Controls.MetroTile(); this.metroTile10 = new MetroFramework.Controls.MetroTile(); this.metroTile11 = new MetroFramework.Controls.MetroTile(); this.metroTile12 = new MetroFramework.Controls.MetroTile(); this.metroTile13 = new MetroFramework.Controls.MetroTile(); this.metroTile14 = new MetroFramework.Controls.MetroTile(); this.metroTile15 = new MetroFramework.Controls.MetroTile(); this.metroTile19 = new MetroFramework.Controls.MetroTile(); this.metroTile25 = new MetroFramework.Controls.MetroTile(); this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); this.metroLabel3 = new MetroFramework.Controls.MetroLabel(); this.metroLabel4 = new MetroFramework.Controls.MetroLabel(); this.logout = new MetroFramework.Controls.MetroButton(); this.metroLabel5 = new MetroFramework.Controls.MetroLabel(); this.SuspendLayout(); // // metroTile1 // this.metroTile1.ActiveControl = null; this.metroTile1.Location = new System.Drawing.Point(199, 179); this.metroTile1.Name = "metroTile1"; this.metroTile1.Size = new System.Drawing.Size(88, 83); this.metroTile1.Style = MetroFramework.MetroColorStyle.Teal; this.metroTile1.TabIndex = 0; this.metroTile1.Text = "Abonos"; this.metroTile1.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile1.UseSelectable = true; // // metroTile2 // this.metroTile2.ActiveControl = null; this.metroTile2.Location = new System.Drawing.Point(25, 179); this.metroTile2.Name = "metroTile2"; this.metroTile2.Size = new System.Drawing.Size(168, 83); this.metroTile2.Style = MetroFramework.MetroColorStyle.Blue; this.metroTile2.TabIndex = 1; this.metroTile2.Text = "Cuentas"; this.metroTile2.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile2.UseSelectable = true; // // metroTile3 // this.metroTile3.ActiveControl = null; this.metroTile3.Location = new System.Drawing.Point(25, 91); this.metroTile3.Name = "metroTile3"; this.metroTile3.Size = new System.Drawing.Size(262, 82); this.metroTile3.Style = MetroFramework.MetroColorStyle.Green; this.metroTile3.TabIndex = 2; this.metroTile3.Text = "Empleado Afiliado"; this.metroTile3.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile3.UseSelectable = true; this.metroTile3.Click += new System.EventHandler(this.metroTile3_Click); // // metroTile4 // this.metroTile4.ActiveControl = null; this.metroTile4.Location = new System.Drawing.Point(25, 268); this.metroTile4.Name = "metroTile4"; this.metroTile4.Size = new System.Drawing.Size(88, 83); this.metroTile4.Style = MetroFramework.MetroColorStyle.Magenta; this.metroTile4.TabIndex = 3; this.metroTile4.Text = "Pagos"; this.metroTile4.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile4.UseSelectable = true; // // metroTile5 // this.metroTile5.ActiveControl = null; this.metroTile5.Location = new System.Drawing.Point(325, 91); this.metroTile5.Name = "metroTile5"; this.metroTile5.Size = new System.Drawing.Size(128, 82); this.metroTile5.Style = MetroFramework.MetroColorStyle.Orange; this.metroTile5.TabIndex = 4; this.metroTile5.Text = "Per. Emp. Pres."; this.metroTile5.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile5.UseSelectable = true; // // metroTile6 // this.metroTile6.ActiveControl = null; this.metroTile6.Location = new System.Drawing.Point(25, 357); this.metroTile6.Name = "metroTile6"; this.metroTile6.Size = new System.Drawing.Size(262, 83); this.metroTile6.Style = MetroFramework.MetroColorStyle.Orange; this.metroTile6.TabIndex = 9; this.metroTile6.Text = "Persona Externa"; this.metroTile6.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile6.UseSelectable = true; // // metroTile7 // this.metroTile7.ActiveControl = null; this.metroTile7.Location = new System.Drawing.Point(325, 268); this.metroTile7.Name = "metroTile7"; this.metroTile7.Size = new System.Drawing.Size(128, 83); this.metroTile7.Style = MetroFramework.MetroColorStyle.Magenta; this.metroTile7.TabIndex = 8; this.metroTile7.Text = "Rol Privilegio"; this.metroTile7.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile7.UseSelectable = true; // // metroTile8 // this.metroTile8.ActiveControl = null; this.metroTile8.Location = new System.Drawing.Point(795, 91); this.metroTile8.Name = "metroTile8"; this.metroTile8.Size = new System.Drawing.Size(87, 82); this.metroTile8.Style = MetroFramework.MetroColorStyle.Green; this.metroTile8.TabIndex = 7; this.metroTile8.Text = "Privilegios"; this.metroTile8.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile8.UseSelectable = true; // // metroTile9 // this.metroTile9.ActiveControl = null; this.metroTile9.Location = new System.Drawing.Point(119, 268); this.metroTile9.Name = "metroTile9"; this.metroTile9.Size = new System.Drawing.Size(168, 83); this.metroTile9.Style = MetroFramework.MetroColorStyle.Blue; this.metroTile9.TabIndex = 6; this.metroTile9.Text = "Prestamos"; this.metroTile9.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile9.UseSelectable = true; // // metroTile10 // this.metroTile10.ActiveControl = null; this.metroTile10.Location = new System.Drawing.Point(459, 91); this.metroTile10.Name = "metroTile10"; this.metroTile10.Size = new System.Drawing.Size(128, 82); this.metroTile10.Style = MetroFramework.MetroColorStyle.Teal; this.metroTile10.TabIndex = 5; this.metroTile10.Text = "Pres. Empleado"; this.metroTile10.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile10.UseSelectable = true; // // metroTile11 // this.metroTile11.ActiveControl = null; this.metroTile11.Location = new System.Drawing.Point(620, 302); this.metroTile11.Name = "metroTile11"; this.metroTile11.Size = new System.Drawing.Size(128, 82); this.metroTile11.Style = MetroFramework.MetroColorStyle.Orange; this.metroTile11.TabIndex = 14; this.metroTile11.Text = "Reporte Anual"; this.metroTile11.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile11.UseSelectable = true; // // metroTile12 // this.metroTile12.ActiveControl = null; this.metroTile12.Location = new System.Drawing.Point(620, 91); this.metroTile12.Name = "metroTile12"; this.metroTile12.Size = new System.Drawing.Size(169, 82); this.metroTile12.Style = MetroFramework.MetroColorStyle.Magenta; this.metroTile12.TabIndex = 13; this.metroTile12.Text = "Usuarios"; this.metroTile12.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile12.UseSelectable = true; // // metroTile13 // this.metroTile13.ActiveControl = null; this.metroTile13.Location = new System.Drawing.Point(325, 179); this.metroTile13.Name = "metroTile13"; this.metroTile13.Size = new System.Drawing.Size(128, 83); this.metroTile13.Style = MetroFramework.MetroColorStyle.Green; this.metroTile13.TabIndex = 12; this.metroTile13.Text = "Tel. Personas"; this.metroTile13.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile13.UseSelectable = true; // // metroTile14 // this.metroTile14.ActiveControl = null; this.metroTile14.Location = new System.Drawing.Point(459, 179); this.metroTile14.Name = "metroTile14"; this.metroTile14.Size = new System.Drawing.Size(128, 83); this.metroTile14.Style = MetroFramework.MetroColorStyle.Blue; this.metroTile14.TabIndex = 11; this.metroTile14.Text = "Tel. Empleados"; this.metroTile14.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile14.UseSelectable = true; // // metroTile15 // this.metroTile15.ActiveControl = null; this.metroTile15.Location = new System.Drawing.Point(459, 268); this.metroTile15.Name = "metroTile15"; this.metroTile15.Size = new System.Drawing.Size(128, 83); this.metroTile15.Style = MetroFramework.MetroColorStyle.Teal; this.metroTile15.TabIndex = 10; this.metroTile15.Text = "Rol Usuario"; this.metroTile15.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile15.UseSelectable = true; // // metroTile19 // this.metroTile19.ActiveControl = null; this.metroTile19.Location = new System.Drawing.Point(754, 302); this.metroTile19.Name = "metroTile19"; this.metroTile19.Size = new System.Drawing.Size(128, 82); this.metroTile19.Style = MetroFramework.MetroColorStyle.Blue; this.metroTile19.TabIndex = 16; this.metroTile19.Text = "Reporte Mensual"; this.metroTile19.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile19.UseSelectable = true; // // metroTile25 // this.metroTile25.ActiveControl = null; this.metroTile25.Location = new System.Drawing.Point(620, 179); this.metroTile25.Name = "metroTile25"; this.metroTile25.Size = new System.Drawing.Size(87, 83); this.metroTile25.Style = MetroFramework.MetroColorStyle.Teal; this.metroTile25.TabIndex = 20; this.metroTile25.Text = "Roles"; this.metroTile25.Theme = MetroFramework.MetroThemeStyle.Light; this.metroTile25.UseSelectable = true; this.metroTile25.Click += new System.EventHandler(this.metroTile25_Click); // // metroLabel1 // this.metroLabel1.AutoSize = true; this.metroLabel1.FontWeight = MetroFramework.MetroLabelWeight.Regular; this.metroLabel1.Location = new System.Drawing.Point(25, 47); this.metroLabel1.Name = "metroLabel1"; this.metroLabel1.Size = new System.Drawing.Size(45, 19); this.metroLabel1.Style = MetroFramework.MetroColorStyle.White; this.metroLabel1.TabIndex = 21; this.metroLabel1.Text = "Datos"; this.metroLabel1.UseCustomBackColor = true; this.metroLabel1.UseStyleColors = true; // // metroLabel2 // this.metroLabel2.AutoSize = true; this.metroLabel2.FontWeight = MetroFramework.MetroLabelWeight.Regular; this.metroLabel2.Location = new System.Drawing.Point(325, 47); this.metroLabel2.Name = "metroLabel2"; this.metroLabel2.Size = new System.Drawing.Size(72, 19); this.metroLabel2.Style = MetroFramework.MetroColorStyle.White; this.metroLabel2.TabIndex = 22; this.metroLabel2.Text = "Relaciones"; this.metroLabel2.UseCustomBackColor = true; this.metroLabel2.UseStyleColors = true; // // metroLabel3 // this.metroLabel3.AutoSize = true; this.metroLabel3.FontWeight = MetroFramework.MetroLabelWeight.Regular; this.metroLabel3.Location = new System.Drawing.Point(620, 269); this.metroLabel3.Name = "metroLabel3"; this.metroLabel3.Size = new System.Drawing.Size(63, 19); this.metroLabel3.Style = MetroFramework.MetroColorStyle.White; this.metroLabel3.TabIndex = 23; this.metroLabel3.Text = "Reportes"; this.metroLabel3.UseCustomBackColor = true; this.metroLabel3.UseStyleColors = true; // // metroLabel4 // this.metroLabel4.AutoSize = true; this.metroLabel4.FontWeight = MetroFramework.MetroLabelWeight.Regular; this.metroLabel4.Location = new System.Drawing.Point(620, 47); this.metroLabel4.Name = "metroLabel4"; this.metroLabel4.Size = new System.Drawing.Size(70, 19); this.metroLabel4.Style = MetroFramework.MetroColorStyle.White; this.metroLabel4.TabIndex = 24; this.metroLabel4.Text = "Seguridad"; this.metroLabel4.UseCustomBackColor = true; this.metroLabel4.UseStyleColors = true; // // logout // this.logout.Location = new System.Drawing.Point(419, 393); this.logout.Name = "logout"; this.logout.Size = new System.Drawing.Size(75, 23); this.logout.TabIndex = 25; this.logout.Text = "Cerrar Sesion"; this.logout.UseSelectable = true; this.logout.Click += new System.EventHandler(this.logout_Click); // // metroLabel5 // this.metroLabel5.AutoSize = true; this.metroLabel5.FontSize = MetroFramework.MetroLabelSize.Tall; this.metroLabel5.FontWeight = MetroFramework.MetroLabelWeight.Regular; this.metroLabel5.Location = new System.Drawing.Point(25, 9); this.metroLabel5.Name = "metroLabel5"; this.metroLabel5.Size = new System.Drawing.Size(57, 25); this.metroLabel5.Style = MetroFramework.MetroColorStyle.White; this.metroLabel5.TabIndex = 26; this.metroLabel5.Text = "Menu"; this.metroLabel5.UseCustomBackColor = true; this.metroLabel5.UseStyleColors = true; // // Menu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Purple; this.ClientSize = new System.Drawing.Size(928, 465); this.Controls.Add(this.metroLabel5); this.Controls.Add(this.logout); this.Controls.Add(this.metroLabel4); this.Controls.Add(this.metroLabel3); this.Controls.Add(this.metroLabel2); this.Controls.Add(this.metroLabel1); this.Controls.Add(this.metroTile25); this.Controls.Add(this.metroTile19); this.Controls.Add(this.metroTile11); this.Controls.Add(this.metroTile12); this.Controls.Add(this.metroTile13); this.Controls.Add(this.metroTile14); this.Controls.Add(this.metroTile15); this.Controls.Add(this.metroTile6); this.Controls.Add(this.metroTile7); this.Controls.Add(this.metroTile8); this.Controls.Add(this.metroTile9); this.Controls.Add(this.metroTile10); this.Controls.Add(this.metroTile5); this.Controls.Add(this.metroTile4); this.Controls.Add(this.metroTile3); this.Controls.Add(this.metroTile2); this.Controls.Add(this.metroTile1); this.Name = "Menu"; this.Text = "Menu"; this.Load += new System.EventHandler(this.Menu_Load); this.ResumeLayout(false); this.PerformLayout(); }
private void metroTile1_MouseMove(object sender, MouseEventArgs e) { MetroTile tile = (MetroTile)sender; tile.BackColor = Color.Silver; }
private void metroTile1_MouseLeave(object sender, EventArgs e) { MetroTile tile = (MetroTile)sender; tile.BackColor = Color.LightGray; }
private void CopyButtonMouseHover(object sender, EventArgs e) { MetroTile tile = sender as MetroTile; tile.BackColor = Color.Beige; }
private void metroTile_MouseHover(object sender, EventArgs e) { MetroTile btn = (MetroTile)sender; btn.BackColor = Color.Aqua; }
public FieldContainer( EditorDialog dialog, CollectionPropertyEditorUtils.CollectionType collectionType, Func <Dictionary <string, string>, string, PropertyEditor <T> > creator, string jsonValue, string memberName = null ) { m_collectionType = collectionType; m_creator = creator; if (m_creator == null) { throw new Exception("Creator cannot be null!"); } MetroSkinManager.ApplyMetroStyle(this); Height = 0; MetroTile remove = new MetroTile(); MetroSkinManager.ApplyMetroStyle(remove); remove.Text = "-"; remove.TextAlign = ContentAlignment.MiddleCenter; remove.TileTextFontWeight = MetroTileTextWeight.Bold; remove.Width = DEFAULT_BUTTON_SIZE + DEFAULT_BUTTON_SIZE; remove.Height = DEFAULT_BUTTON_SIZE; remove.Left = Width - remove.Width; remove.Anchor = AnchorStyles.Top | AnchorStyles.Right; remove.Click += new EventHandler(remove_Click); Controls.Add(remove); MetroTile add = new MetroTile(); MetroSkinManager.ApplyMetroStyle(add); add.Text = "+"; add.TextAlign = ContentAlignment.MiddleCenter; add.TileTextFontWeight = MetroTileTextWeight.Bold; add.Width = DEFAULT_BUTTON_SIZE + DEFAULT_BUTTON_SIZE; add.Height = DEFAULT_BUTTON_SIZE; add.Left = Width - add.Width - DEFAULT_SEPARATOR - remove.Width; add.Anchor = AnchorStyles.Top | AnchorStyles.Right; add.Click += new EventHandler(add_Click); Controls.Add(add); Height += Math.Max(add.Height, remove.Height); if (m_collectionType == CollectionPropertyEditorUtils.CollectionType.JsonObject) { m_memberTextBox = new MetroTextBox(); MetroSkinManager.ApplyMetroStyle(m_memberTextBox); m_memberTextBox.Text = memberName; m_memberTextBox.Width = Width; m_memberTextBox.Top = Height; m_memberTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; m_memberTextBox.TextChanged += new EventHandler(m_memberTextBox_TextChanged); Controls.Add(m_memberTextBox); Height += m_memberTextBox.Height; } try { m_propertyEditor = m_creator(m_imHereForNothing, "-.-"); if (m_propertyEditor == null) { throw new Exception("Property editor couldn't be created properly!"); } MetroUserControl editor = m_propertyEditor as MetroUserControl; IEditorJsonValue jvEditor = m_propertyEditor as IEditorJsonValue; if (editor != null && jvEditor != null) { jvEditor.Text = "Item"; jvEditor.JsonValue = jsonValue; jvEditor.UpdateEditorValue(); editor.Width = Width; editor.Top = Height; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } ErrorPropertyEditor editor = new ErrorPropertyEditor("Item", ex.Message); editor.Tag = string.Format("{0}\n{1}\n\nStack trace:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); editor.Width = Width; editor.Top = Height; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height; } }
private void 确认无误删除ToolStripMenuItem_Click(object sender, EventArgs e) { if (_currSelectTitle == null) return; var host = (RemoteHost)_currSelectTitle.Tag; using (var conn = new SQLiteConnection(Common.ConnectionString)) { conn.Execute("DELETE FROM RemoteHost WHERE FId=@id", new { id = host.FId }); } _currSelectTitle.Parent.Controls.Remove(_currSelectTitle); _currSelectTitle = null; }
/// <summary> /// 加载远程桌面配置 /// </summary> private void LoadHostConfig() { SetWait(true); panelBody.Controls.Clear(); //清空原有 #region 1.0 获取数据 RemoteHost[] hosts; using (var conn = new SQLiteConnection(Common.ConnectionString)) { const string sqlCmd = @"SELECT a.FId,a.FName,a.FConectId,a.FParentId,a.FSort,b.FId,b.FIpAddress,b.FIpPort,b.FLoginUser,b.FPassword,b.FFullUrl FROM RemoteHost a LEFT JOIN ConnectLib b ON a.FConectId=b.FId ORDER BY a.FSort ASC,a.FId DESC"; hosts = conn.Query<RemoteHost, IpAddress, RemoteHost>(sqlCmd, (host, ip) => { host.IpAddress = ip; return host; }, null, null, false, "FId", null, null).ToArray(); } #endregion #region 2.0 加载配置信息 var group = hosts.Where(x => x.FParentId == 0).OrderByDescending(x => x.FSort).ToArray(); foreach (var hostGroup in group) { //建立分组 var hostBox = new WHostGroupBox { Dock = DockStyle.Top, Height = 100, Text = hostGroup.FName }; panelBody.Controls.Add(hostBox); //分组Box //填充分组内容 foreach (var host in hosts.Where(x => x.FParentId == hostGroup.FId).OrderBy(x => x.FSort)) { var ipInfo = host.IpAddress; //IP地址信息 if (ipInfo == null) continue; var title = new MetroTile { Name = "title", ActiveControl = null, Height = 60, Text = string.Format("{0}\r\n {1}", host.FName, ipInfo.FFullUrl), UseSelectable = true, UseVisualStyleBackColor = true, Tag = host, AutoSize = true, ContextMenuStrip = menuTitle, StyleManager = metroStyleManager }; title.Click += ConnectRemoteHost; title.MouseDown += menuTitle_Show; hostBox.AddControl(title); } } #endregion SetWait(false); }
void menuTitle_Show(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var title = (MetroTile)sender; _currSelectTitle = title; } }
/// <summary> /// 加载远程桌面配置 /// </summary> private void LoadHostConfig() { SetWait(true); panelBody.Controls.Clear(); //清空原有 #region 1.0 获取数据 RemoteHost[] hosts; using (var conn = new SQLiteConnection(Common.ConnectionString)) { const string sqlCmd = @"SELECT a.FId,a.FName,a.FConectId,a.FParentId,a.FSort,b.FId,b.FIpAddress,b.FIpPort,b.FLoginUser,b.FPassword,b.FFullUrl FROM RemoteHost a LEFT JOIN ConnectLib b ON a.FConectId=b.FId ORDER BY a.FSort ASC,a.FId DESC"; hosts = conn.Query <RemoteHost, IpAddress, RemoteHost>(sqlCmd, (host, ip) => { host.IpAddress = ip; return(host); }, null, null, false, "FId", null, null).ToArray(); } #endregion #region 2.0 加载配置信息 var group = hosts.Where(x => x.FParentId == 0).OrderByDescending(x => x.FSort).ToArray(); foreach (var hostGroup in group) { //建立分组 var hostBox = new WHostGroupBox { Dock = DockStyle.Top, Height = 100, Text = hostGroup.FName }; panelBody.Controls.Add(hostBox); //分组Box //填充分组内容 foreach (var host in hosts.Where(x => x.FParentId == hostGroup.FId).OrderBy(x => x.FSort)) { var ipInfo = host.IpAddress; //IP地址信息 if (ipInfo == null) { continue; } var title = new MetroTile { Name = "title", ActiveControl = null, Height = 60, Text = string.Format("{0}\r\n {1}", host.FName, ipInfo.FFullUrl), UseSelectable = true, UseVisualStyleBackColor = true, Tag = host, AutoSize = true, ContextMenuStrip = menuTitle, StyleManager = metroStyleManager }; title.Click += ConnectRemoteHost; title.MouseDown += menuTitle_Show; hostBox.AddControl(title); } } #endregion SetWait(false); }
public void generateTiles(int numOfTiles, String[] letters) { letterTiles = new MetroTile[numOfTiles]; int counter = 0; int posX = 50; int posY = 0; //Generate tiles for (int i = 0; i < letterTiles.Length; i++) { letterTiles[i] = new MetroTile(); } int colorCount = 0; while (counter < numOfTiles) { letterTiles[counter].Tag = counter + 1; letterTiles[counter].Height = 80; letterTiles[counter].Width = 80; if (counter % 5 == 0) { posX = 50; posY += 100; } letterTiles[counter].Left = posX; letterTiles[counter].Top = posY; tilePanel.Controls.Add(letterTiles[counter]); posX = posX + letterTiles[counter].Width + 50; letterTiles[counter].TileTextFontSize = MetroTileTextSize.Tall; letterTiles[counter].TileTextFontWeight = MetroTileTextWeight.Bold; letterTiles[counter].Name = letters[counter]; letterTiles[counter].Text = letters[counter]; if (updateLevelTile(MainForm2.kidName, letterTiles[counter].Text)) { letterTiles[counter].Text += "\nDONE!"; } letterTiles[counter].TextAlign = ContentAlignment.MiddleCenter; if (colorCount == 0) { letterTiles[counter].Style = MetroColorStyle.Red; colorCount++; } else if (colorCount == 1) { letterTiles[counter].Style = MetroColorStyle.Yellow; colorCount++; } else if (colorCount == 2) { letterTiles[counter].Style = MetroColorStyle.Orange; colorCount++; } else if (colorCount == 3) { letterTiles[counter].Style = MetroColorStyle.Green; colorCount++; } else if (colorCount == 4) { colorCount = 0; } letterTiles[counter].Click += new System.EventHandler(ButtonEventHandler); counter++; } }
void main__form() { MetroPanel panel__left = new MetroPanel(); MetroTile panel__left__title = new MetroTile(); MetroPanel panel__Right = new MetroPanel(); MetroTile panel__Right__title = new MetroTile(); PictureBox[] picture__news = new PictureBox[8]; MetroLabel[] body = new MetroLabel[8]; MetroLabel[] date = new MetroLabel[8]; for (int i = 0; i < 8; i++) { date[i] = new MetroLabel(); picture__news[i] = new PictureBox(); body[i] = new MetroLabel(); } // Main // Left panel__left.Location = new Point(27, 72); panel__left.Size = new Size(1030, 720); panel__left.Name = "Left"; panel__left.Theme = MetroFramework.MetroThemeStyle.Dark; panel__left.BorderStyle = MetroFramework.Drawing.MetroBorderStyle.FixedSingle; //Left label panel__left__title.Location = new Point(3, 3); panel__left__title.Size = new Size(148, 53); panel__left__title.Name = "Left__title"; panel__left__title.Text = "Главное"; panel__left__title.Style = MetroFramework.MetroColorStyle.Red; //Right panel__Right.Location = new Point(1082, 72); panel__Right.Size = new Size(472, 720); panel__Right.Name = "Right"; panel__Right.Theme = MetroFramework.MetroThemeStyle.Dark; panel__Right.BorderStyle = MetroFramework.Drawing.MetroBorderStyle.FixedSingle; //Right__title panel__Right__title.Location = new Point(3, 3); panel__Right__title.Size = new Size(151, 53); panel__Right__title.Name = "Right__title"; panel__Right__title.Text = "Новости"; panel__Right__title.Style = MetroFramework.MetroColorStyle.Red; //Left Panel this.metroPanel2.Controls.Add(panel__left); panel__left.Controls.Add(panel__left__title); //Right Panel metroPanel2.Controls.Add(panel__Right); panel__Right.Controls.Add(panel__Right__title); connect con = new connect(); string[] news = con.news().Split('='); int width = 100; int j = 0; for (int i = news.Length - 2; i >= 0; i--) { if (j > -8) { //header date[Math.Abs(j)].Location = new Point(26, width); date[Math.Abs(j)].Size = new Size(76, 64); date[Math.Abs(j)].Name = "Body__News " + i; date[Math.Abs(j)].Text = news[i].Split('%')[0]; date[Math.Abs(j)].Theme = MetroFramework.MetroThemeStyle.Light; //body body[Math.Abs(j)].Location = new Point(106, width); body[Math.Abs(j)].Size = new Size(247, 64); body[Math.Abs(j)].Name = "Body__News " + i; body[Math.Abs(j)].Text = news[i].Split('%')[1]; body[Math.Abs(j)].Theme = MetroFramework.MetroThemeStyle.Light; //picturebox picture__news[Math.Abs(j)].Location = new Point(359, width); picture__news[Math.Abs(j)].Size = new Size(100, 64); picture__news[Math.Abs(j)].Name = "Body__News " + i; picture__news[Math.Abs(j)].Image = Image.FromFile(news[i].Split('%')[2]); picture__news[Math.Abs(j)].SizeMode = PictureBoxSizeMode.Zoom; panel__Right.Controls.Add(date[Math.Abs(j)]); panel__Right.Controls.Add(body[Math.Abs(j)]); panel__Right.Controls.Add(picture__news[Math.Abs(j)]); width += 78; j--; } else { break; } } }
public pnlSettings(Form owner, string _DBName) : base(owner) { InitializeComponent(); ReadSettings("Settings.txt"); for (int i = 3; i < 13; i++) { MetroTile _tile = new MetroTile(); _tile.Size = new Size(30, 30); _tile.Tag = i; _tile.Style = (MetroColorStyle)i; _tile.Click += _tile_Click; flpSettings.Controls.Add(_tile); if (Temp.Ayuda) { string color = ((MetroTile)_tile).Style.ToString(); switch (color) { case "Silver": mttHelp.SetToolTip((Control)_tile, "Planta"); break; case "Blue": mttHelp.SetToolTip((Control)_tile, "Azul"); break; case "Green": mttHelp.SetToolTip((Control)_tile, "Verde"); break; case "Lime": mttHelp.SetToolTip((Control)_tile, "Verde Limon"); break; case "Teal": mttHelp.SetToolTip((Control)_tile, "Celeste"); break; case "Orange": mttHelp.SetToolTip((Control)_tile, "Naranja"); break; case "Brown": mttHelp.SetToolTip((Control)_tile, "Cafe"); break; case "Pink": mttHelp.SetToolTip((Control)_tile, "Rosa"); break; case "Magenta": mttHelp.SetToolTip((Control)_tile, "Magenta"); break; case "Purple": mttHelp.SetToolTip((Control)_tile, "Morado"); break; default: break; } } } DBName = _DBName; this.StyleManager.Update(); }
private void CopyButtonMouseLeaveEvent(object sender, EventArgs e) { MetroTile tile = sender as MetroTile; tile.BackColor = Color.SeaGreen; }
private void 连同父级一起删除ToolStripMenuItem_Click(object sender, EventArgs e) { if (_currSelectTitle == null) return; var host = (RemoteHost)_currSelectTitle.Tag; using (var conn = new SQLiteConnection(Common.ConnectionString)) { conn.Open(); var tran = conn.BeginTransaction(); conn.Execute("DELETE FROM RemoteHost WHERE FId=@id", new { id = host.FParentId }); conn.Execute("DELETE FROM RemoteHost WHERE FParentId=@id", new { id = host.FParentId }); tran.Commit(); } var parent = _currSelectTitle.Parent.Parent; parent.Parent.Controls.Remove(parent); _currSelectTitle = null; }