private void picSupply_MyMouseLeave(object sender, EventArgs e) { Expando expEquipment = (Expando)this.Parent; if (expEquipment.TaskPane != null) { expEquipment.TaskPane.PreventAutoScroll = false; } BegmMisc.FocusTaskPane(this); }
private void picSupply_MyMouseEnter(object sender, EventArgs e) { BegmMisc.FocusWithoutScroll(pnlSupply); Expando expEquipment = (Expando)this.Parent; if (expEquipment.TaskPane != null) { expEquipment.TaskPane.PreventAutoScroll = true; } }
private void picGerman_MyMouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
private void expFrench_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
// dynamic focus private void tskFactory_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
// prevent scroll on focus private void tvwOrbat_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusWithoutScroll(tvwOrbat); }
/// <summary> /// Create a new Expando control with the appropriate settings and sub-controls, based on the given ChokePoint. /// </summary> /// <param name="cp">The ChokePoint the Expando will represent.</param> /// <returns>The new Expando control</returns> private Expando CreateExpando(ChokePoint cp) { // control container CAControls controls = new CAControls(); // expando Expando expando = new Expando(); expando.Animate = true; expando.Collapse(); expando.CustomHeaderSettings.BackImageHeight = 25; expando.CustomHeaderSettings.NormalGradientEndColor = Color.FromArgb(51, 51, 51); expando.CustomHeaderSettings.NormalGradientStartColor = Color.FromArgb(51, 51, 51); expando.CustomHeaderSettings.NormalTitleColor = Color.FromArgb(224, 224, 224); expando.CustomHeaderSettings.NormalTitleHotColor = Color.White; expando.CustomHeaderSettings.TitleFont = new Font("Arial", 9F, FontStyle.Bold, GraphicsUnit.Point, 0); expando.CustomHeaderSettings.TitleGradient = true; expando.CustomHeaderSettings.TitleRadius = 0; expando.CustomSettings.NormalBackColor = Color.Black; expando.CustomSettings.NormalBorderColor = Color.Black; expando.ExpandedHeight = EXPANDO_DEFAULT_HEIGHT; expando.Text = cp.Name; // event datagridview controls.dgvEventList = new DataGridView(); controls.dgvEventList.AllowUserToAddRows = false; controls.dgvEventList.AllowUserToDeleteRows = false; controls.dgvEventList.AllowUserToResizeColumns = false; controls.dgvEventList.AllowUserToResizeRows = false; controls.dgvEventList.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; controls.dgvEventList.BackgroundColor = Color.Black; controls.dgvEventList.BorderStyle = BorderStyle.None; controls.dgvEventList.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal; controls.dgvEventList.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; controls.dgvEventList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; controls.dgvEventList.ColumnHeadersVisible = false; DataGridViewCellStyle cellStyle1 = new DataGridViewCellStyle(); cellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft; cellStyle1.BackColor = Color.Black; cellStyle1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); cellStyle1.ForeColor = Color.FromArgb(224, 224, 224); cellStyle1.SelectionBackColor = Color.Black; cellStyle1.SelectionForeColor = Color.FromArgb(224, 224, 224); cellStyle1.WrapMode = DataGridViewTriState.False; controls.dgvEventList.DefaultCellStyle = cellStyle1; controls.dgvEventList.GridColor = Color.FromArgb(64, 64, 64); controls.dgvEventList.Location = new Point(3, 21 + 16); // 21 = header controls.dgvEventList.MultiSelect = false; controls.dgvEventList.RowHeadersVisible = false; controls.dgvEventList.ScrollBars = ScrollBars.Vertical; controls.dgvEventList.SelectionMode = DataGridViewSelectionMode.FullRowSelect; controls.dgvEventList.Size = new Size(330, 128); controls.dgvEventList.StandardTab = true; controls.dgvEventList.DataError += (sender, args) => { }; //// avoid default DataError dialog DataGridViewImageColumn imagecol = new DataGridViewImageColumn(); imagecol.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; DataGridViewCellStyle cellStyle2 = new DataGridViewCellStyle(); cellStyle2.Alignment = DataGridViewContentAlignment.TopLeft; cellStyle2.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0); imagecol.DefaultCellStyle = cellStyle2; imagecol.ImageLayout = DataGridViewImageCellLayout.Zoom; imagecol.ReadOnly = true; imagecol.Resizable = DataGridViewTriState.False; imagecol.Width = 20; controls.dgvEventList.Columns.Add(imagecol); DataGridViewTextBoxColumn textcol = new DataGridViewTextBoxColumn(); textcol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; DataGridViewCellStyle cellStyle3 = new DataGridViewCellStyle(); cellStyle3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); cellStyle3.WrapMode = DataGridViewTriState.True; textcol.DefaultCellStyle = cellStyle3; textcol.ReadOnly = true; textcol.Resizable = DataGridViewTriState.False; textcol.SortMode = DataGridViewColumnSortMode.NotSortable; controls.dgvEventList.Columns.Add(textcol); // focus on mouse enter expando.MouseEnter += delegate { BegmMisc.FocusWithoutScroll(controls.dgvEventList); }; controls.dgvEventList.MouseEnter += delegate { BegmMisc.FocusWithoutScroll(controls.dgvEventList); }; // don't draw focus rectangle controls.dgvEventList.RowPrePaint += delegate(object sender, DataGridViewRowPrePaintEventArgs e) { e.PaintParts &= ~DataGridViewPaintParts.Focus; }; // reveal other widgets on double click controls.dgvEventList.CellDoubleClick += dgvEventList_CellDoubleClick; expando.Items.Add(controls.dgvEventList); // event checkbox controls.cbShowAlerts = new CheckBox(); controls.cbShowAlerts.AutoSize = true; controls.cbShowAlerts.Text = Language.CurrentAttacks_ShowAlerts; if (Application.RenderWithVisualStyles) { controls.cbShowAlerts.Location = new Point(2, 21 + 2); } else { controls.cbShowAlerts.Location = new Point(2, 21 + 4); } if (options.Alerts.filterChokePoint == false || // not filtering, or options.Alerts.filterChokePointIDs.Contains(cp.ID)) // filtering and includes this cp { controls.cbShowAlerts.Checked = true; } controls.cbShowAlerts.Click += delegate { cbShowAlerts_Click(controls.cbShowAlerts, cp); }; expando.Controls.Add(controls.cbShowAlerts); // capbar controls.picCapBar = new PictureBox(); controls.picCapBar.Location = new Point(104, 21 + 2); controls.picCapBar.Size = new Size(130, 12); expando.Controls.Add(controls.picCapBar); // expand button controls.picExpandTown = new PictureBox(); controls.picExpandTown.Cursor = Cursors.Hand; controls.picExpandTown.Image = Resources.icon_down; if (Application.RenderWithVisualStyles) { controls.picExpandTown.Location = new Point(324, 21 + 5); } else { controls.picExpandTown.Location = new Point(324, 21 + 7); } controls.picExpandTown.SizeMode = PictureBoxSizeMode.AutoSize; controls.picExpandTown.MouseClick += delegate(object obj, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { picExpandTown_Click(expando); } }; expando.Controls.Add(controls.picExpandTown); // town status link LinkLabel link = new LinkLabel(); link.ActiveLinkColor = Color.White; link.LinkBehavior = LinkBehavior.HoverUnderline; link.LinkColor = Color.FromArgb(224, 224, 224); link.Text = Language.CurrentAttacks_TownStatus; link.TextAlign = ContentAlignment.TopRight; link.Size = new Size(90, 13); link.VisitedLinkColor = Color.FromArgb(224, 224, 224); if (Application.RenderWithVisualStyles) { link.Location = new Point(235, 21 + 1); } else { link.Location = new Point(235, 21 + 2); } link.LinkClicked += delegate { GameStatus_RevealWidget(WidgetType.TownStatus, cp); }; expando.Controls.Add(link); // store controls for future reference expando.Tag = controls; return(expando); }
// dynamic focus private void CurrentAttacks_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
private void dgvConfig_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusWithoutScroll(dgvConfig); }
// dynamic focus private void ServerStatus_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
// dynamic focus private void Equipment_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }
// avoid focus private void numSupplyCycle_Enter(object sender, EventArgs e) { BegmMisc.FocusWithoutScroll(pnlSupply); }
private void dgvEventList_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusWithoutScroll(dgvEventList); }
// dynamic focus private void RecentEvents_MouseEnter(object sender, EventArgs e) { BegmMisc.FocusTaskPane(this); }