/// <summary> /// Resizes the form. /// </summary> /// <param name="direction">The direction.</param> private void ResizeForm(ZeroitMetroForm.ResizeDirection direction) { int num = -1; switch (direction) { case ZeroitMetroForm.ResizeDirection.Left: { num = 10; break; } case ZeroitMetroForm.ResizeDirection.TopLeft: { num = 13; break; } case ZeroitMetroForm.ResizeDirection.Top: { num = 12; break; } case ZeroitMetroForm.ResizeDirection.TopRight: { num = 14; break; } case ZeroitMetroForm.ResizeDirection.Right: { num = 11; break; } case ZeroitMetroForm.ResizeDirection.BottomRight: { num = 17; break; } case ZeroitMetroForm.ResizeDirection.Bottom: { num = 15; break; } case ZeroitMetroForm.ResizeDirection.BottomLeft: { num = 16; break; } } if (num != -1) { ZeroitMetroForm.ReleaseCapture(); ZeroitMetroForm.SendMessage(this.Handle, 161, num, 0); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.BackColorChanged" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param> protected override void OnBackColorChanged(EventArgs e) { if (this.FindForm() is ZeroitMetroForm) { if (this._AutoStyle) { ZeroitMetroForm metroForm = (ZeroitMetroForm)this.FindForm(); this.Style = metroForm.Style; this._Style = metroForm.Style; this.Invalidate(); } } else if (this._AutoStyle) { //Color backColor = this.Parent.BackColor; Color backColor = BackColor; if (backColor == Color.White) { this._Style = Design.Style.Light; } else if (backColor == Color.FromArgb(40, 40, 40)) { this._Style = Design.Style.Dark; } this.Style = this._Style; this.Invalidate(); } base.OnBackColorChanged(e); }
/// <summary> /// Creates the form handlers. /// </summary> /// <param name="action">if set to <c>true</c> [action].</param> private void CreateFormHandlers(bool action) { try { if (this.FindForm() is ZeroitMetroForm) { ZeroitMetroForm metroForm = (ZeroitMetroForm)this.FindForm(); if (!action) { ZeroitMetroControlBox metroControlBox = this; metroForm.FormStyleChanged -= new EventHandler <ZeroitMetroForm.MetroFormEventArgs>(metroControlBox.FormStyle_Changed); } else { ZeroitMetroControlBox metroControlBox1 = this; metroForm.FormStyleChanged += new EventHandler <ZeroitMetroForm.MetroFormEventArgs>(metroControlBox1.FormStyle_Changed); } } } catch (Exception exception) { ProjectData.SetProjectError(exception); ProjectData.ClearProjectError(); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.BackColorChanged" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param> protected override void OnBackColorChanged(EventArgs e) { if (this.FindForm() is ZeroitMetroForm) { if (this._AutoStyle) { ZeroitMetroForm metroForm = (ZeroitMetroForm)this.FindForm(); this.Style = metroForm.Style; this._Style = metroForm.Style; this.Invalidate(); } } base.OnBackColorChanged(e); }
/// <summary> /// Refreshes the areas. /// </summary> public void RefreshAreas() { System.Drawing.Size areaSize; int width = 0; int height = 0; this._Areas.Clear(); int count = checked (this._AreaCollection.Count - 1); for (int i = 0; i <= count; i = checked (i + 1)) { if (this._AreaCollection[i].AreaSize.Height > height) { areaSize = this._AreaCollection[i].AreaSize; height = areaSize.Height; } areaSize = this._AreaCollection[i].AreaSize; int num = areaSize.Width; System.Drawing.Size size = this._AreaCollection[i].AreaSize; Rectangle rectangle = new Rectangle(width, 0, num, size.Height); this._Areas.Add(rectangle); areaSize = this._AreaCollection[i].AreaSize; width = checked (width + areaSize.Width); } areaSize = new System.Drawing.Size(width, height); this.Size = areaSize; this.Invalidate(); if (this.Parent is ZeroitMetroForm) { ZeroitMetroForm parent = (ZeroitMetroForm)this.Parent; if (parent.MainControlBox == this) { parent.RelocateMainControlBox(); } } }