示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parent">Parent control</param>
        /// <param name="type">Type</param>
        public ControlPanel(Control parent, int type)
        {
            this.parent = parent;
            this.type   = type;
            bord        = parent as ISetBorders;
            MouseDown  += new MouseEventHandler(onMouseDownEventHandler);
            MouseUp    += new MouseEventHandler(onMouseUpEventHandler);
            MouseMove  += new MouseEventHandler(onMouseMoveEventHandler);
            switch (type)
            {
            case 0:
                Cursor = Cursors.SizeNWSE;
                break;

            case 1:
                Cursor = Cursors.SizeNESW;
                break;

            case 2:
                Cursor = Cursors.SizeNWSE;
                break;

            case 3:
                Cursor = Cursors.SizeNESW;
                break;

            default:
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Removes panels
        /// </summary>
        /// <param name="control">Parent control</param>
        public static void RemovePanels(Control control)
        {
            Control p = control.Parent;

            if (p == null)
            {
                return;
            }
            ISetBorders s = control as ISetBorders;

            for (int i = 0; i < 4; i++)
            {
                Control c = s[i];
                if (!p.Controls.Contains(c))
                {
                    continue;
                }
                try
                {
                    if (c != null)
                    {
                        if (!c.IsDisposed)
                        {
                            p.Controls.Remove(c);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
示例#3
0
        /// <summary>
        /// Moves control
        /// </summary>
        /// <param name="c">The control</param>
        /// <param name="dx">The X - shift</param>
        /// <param name="dy">The Y - shift</param>
        new public static void Move(Control c, int dx, int dy)
        {
            c.Left += dx;
            c.Top  += dy;
            ISetBorders s = c as ISetBorders;

            for (int i = 0; i < 4; i++)
            {
                s[i].Left += dx;
                s[i].Top  += dy;
            }
        }
示例#4
0
 /// <summary>
 /// Deactivates all controls
 /// </summary>
 /// <param name="control">Parent control</param>
 public static void DeactivateAll(Control control)
 {
     foreach (Control c in control.Controls)
     {
         if (!(c is ISetBorders))
         {
             continue;
         }
         ISetBorders s = c as ISetBorders;
         if (s == null)
         {
             continue;
         }
         s.Deactivate();
     }
 }
示例#5
0
 /// <summary>
 /// Gets active text box
 /// </summary>
 /// <param name="control">Parent control</param>
 /// <returns>The active text box</returns>
 public static TextBox GetActiveTextBox(Control control)
 {
     foreach (Control c in control.Controls)
     {
         if (!(c is TextBox) & !(c is ISetBorders))
         {
             continue;
         }
         ISetBorders s = c as ISetBorders;
         if (s.IsActive)
         {
             return(c as TextBox);
         }
     }
     return(null);
 }
示例#6
0
        /// <summary>
        /// Deactivates other controls
        /// </summary>
        /// <param name="control">Active ontrol</param>
        public static void DeactivateOther(Control control)
        {
            Control p = control.Parent;

            foreach (Control c in p.Controls)
            {
                if (c == control)
                {
                    continue;
                }
                if (!(c is ISetBorders))
                {
                    continue;
                }
                ISetBorders s = c as ISetBorders;
                if (s == null)
                {
                    continue;
                }
                s.Deactivate();
            }
        }