Esempio n. 1
0
 /// <summary>
 /// Set the Border Type of the control.
 /// </summary>
 /// <param name="control"></param>
 /// <param name="borderType"></param>
 public static void SetBorderType(Control control, BorderType borderType)
 {
     if (control is IBorderTypeProperty)
     {
         ((IBorderTypeProperty)control).BorderType = borderType;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Convert BorderType to FormBorderStyle.
        /// </summary>
        /// <param name="borderType"></param>
        /// <param name="windowType"></param>
        /// <param name="showTitleBar"></param>
        /// <returns></returns>
        public static FormBorderStyle BorderTypeToFormBorderStyle(BorderType borderType, WindowType windowType, bool showTitleBar)
        {
            FormBorderStyle formBorderStyle = FormBorderStyle.None;

            if (showTitleBar && borderType == BorderType.NoBorder)
            {
                borderType = BorderType.Thin;
            }

            if (windowType == WindowType.FitToMdi)
            {
                borderType = BorderType.Thin;
            }

            switch (borderType)
            {
            case BorderType.NoBorder:
                formBorderStyle = FormBorderStyle.None;
                break;

            case BorderType.Thick:
                if (windowType == WindowType.Tool)
                {
                    formBorderStyle = FormBorderStyle.SizableToolWindow;
                }
                else
                {
                    formBorderStyle = FormBorderStyle.Sizable;
                }
                break;

            case BorderType.Thin:
                if (windowType == WindowType.Tool)
                {
                    formBorderStyle = FormBorderStyle.FixedToolWindow;
                }
                else
                {
                    formBorderStyle = FormBorderStyle.FixedSingle;
                }
                break;

            default:
                Debug.Assert(false);
                break;
            }

            return(formBorderStyle);
        }
Esempio n. 3
0
        /// <summary></summary>
        /// <param name="control"></param>
        /// <param name="style"></param>
        public static void SetBorderStyle(Panel panel, BorderType borderType)
        {
            BorderStyle borderStyle = BorderStyle.FixedSingle;

            switch (borderType)
            {
            case BorderType.NoBorder:
                borderStyle = BorderStyle.None;
                break;

            case BorderType.Thick:
                borderStyle = BorderStyle.Fixed3D;
                break;

            case BorderType.Thin:
                borderStyle = BorderStyle.FixedSingle;
                break;
            }

            panel.BorderStyle = borderStyle;
        }