/// <summary> /// Called when the control that the designer is managing has painted its surface so the designer can paint any additional adornments on top of the control. /// </summary> /// <param name="pe">A <see cref="System.Windows.Forms.PaintEventArgs"/> that provides data for the event.</param> protected override void OnPaintAdornments(PaintEventArgs pe) { if (this.Control is GoogleTalkForm && this.DrawGrid == true) { GoogleTalkForm control = (GoogleTalkForm)this.Control; Rectangle rect = control.BodyRectangle; rect.X++; rect.Width++; rect.Height++; ControlPaint.DrawGrid(pe.Graphics, rect, this.GridSize, control.BackColor); } else { base.OnPaintAdornments(pe); } }
private bool isControlLocationValid(Control control) { Point pointTopLeft; Point pointBottomRight; if (this.Control is GoogleTalkForm) { GoogleTalkForm form = (GoogleTalkForm)this.Control; pointTopLeft = control.Location; pointBottomRight = control.Location; pointBottomRight.X += control.Width; pointBottomRight.Y += control.Height; if (form.BodyRectangle.Contains(pointTopLeft) == false) { return(false); } if (form.BodyRectangle.Contains(pointBottomRight) == false) { return(false); } if (form.IsResizable == true) { if (form.ResizableRectangle.Contains(pointTopLeft) == true) { return(false); } if (form.ResizableRectangle.Contains(pointBottomRight) == true) { return(false); } } return(true); } else { return(true); } }