예제 #1
0
        TreeNode MapFormStyleToTreeNode(FormStyle formStyle, string propertyName)
        {
            TreeNode node = new TreeNode(propertyName);

            node.Tag = formStyle;
            node.Nodes.Add(MapSerializableImageToTreeNode(formStyle.NormalState, FormStyleProperty.NormalState));
            node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.CloseButton, FormStyleProperty.CloseButton));
            node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.MaximizeButton, FormStyleProperty.MaximizeButton));
            node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.MinimizeButton, FormStyleProperty.MinimizeButton));
            node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.RestoreButton, FormStyleProperty.RestoreButton));
            node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.HelpButton, FormStyleProperty.HelpButton));
            return(node);
        }
        internal static void DeleteStyle(FormStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException("style");
            }

            if (globalStyleLibrary == null)
            {
                return;
            }

            globalStyleLibrary.Styles.Remove(style);
            OnStyleChanged();
        }
        FormStyle CreateFormStyle()
        {
            FormStyle style = new FormStyle();

            style.NormalState.Image          = Properties.Resources.Border;
            style.NormalState.SizeMode       = ImageSizeMode.Stretched;
            style.NormalState.StretchMargins = new Padding(3, 23, 3, 3);

            style.CloseButton.Size                = Properties.Resources.Close.Size;
            style.CloseButton.Margin              = new Padding(1, 5, 5, 0);
            style.CloseButton.NormalState.Image   = Properties.Resources.Close;
            style.CloseButton.DisabledState.Image = Properties.Resources.CloseDisabled;
            style.CloseButton.ActiveState.Image   = Properties.Resources.ClosePressed;
            style.CloseButton.HoverState.Image    = Properties.Resources.CloseHot;

            style.MaximizeButton.Size                = Properties.Resources.Maximize.Size;
            style.MaximizeButton.Margin              = new Padding(1, 5, 1, 0);
            style.MaximizeButton.NormalState.Image   = Properties.Resources.Maximize;
            style.MaximizeButton.DisabledState.Image = Properties.Resources.MaximizeDisabled;
            style.MaximizeButton.ActiveState.Image   = Properties.Resources.MaximizePressed;
            style.MaximizeButton.HoverState.Image    = Properties.Resources.MaximizeHot;

            style.MinimizeButton.Size                = Properties.Resources.Minimize.Size;
            style.MinimizeButton.Margin              = new Padding(1, 5, 1, 0);
            style.MinimizeButton.NormalState.Image   = Properties.Resources.Minimize;
            style.MinimizeButton.DisabledState.Image = Properties.Resources.MinimizeDisabled;
            style.MinimizeButton.ActiveState.Image   = Properties.Resources.MinimizePressed;
            style.MinimizeButton.HoverState.Image    = Properties.Resources.MinimizeHot;

            style.RestoreButton.Size                = Properties.Resources.Restore.Size;
            style.RestoreButton.Margin              = new Padding(1, 5, 1, 0);
            style.RestoreButton.NormalState.Image   = Properties.Resources.Restore;
            style.RestoreButton.DisabledState.Image = Properties.Resources.RestoreDisabled;
            style.RestoreButton.ActiveState.Image   = Properties.Resources.RestorePressed;
            style.RestoreButton.HoverState.Image    = Properties.Resources.RestoreHot;

            style.TitleColor       = Color.White;
            style.TitleShadowColor = Color.DimGray;
            style.TitleFont        = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);

            style.ClientAreaPadding = new Padding(3, 23, 3, 3);
            style.IconPadding       = new Padding(3, 3, 0, 0);

            this.NonClientAreaDoubleBuffering = true;

            return(style);
        }
예제 #4
0
        FormStyle CreateFormStyle()
        {
            FormStyle style = new FormStyle();
            style.NormalState.Image = Properties.Resources.Border;
            style.NormalState.SizeMode = ImageSizeMode.Stretched;
            style.NormalState.StretchMargins = new Padding(3, 23, 3, 3);

            style.CloseButton.Size = Properties.Resources.Close.Size;
            style.CloseButton.Margin = new Padding(1,5,5,0);
            style.CloseButton.NormalState.Image = Properties.Resources.Close;
            style.CloseButton.DisabledState.Image = Properties.Resources.CloseDisabled;
            style.CloseButton.ActiveState.Image = Properties.Resources.ClosePressed;
            style.CloseButton.HoverState.Image = Properties.Resources.CloseHot;

            style.MaximizeButton.Size = Properties.Resources.Maximize.Size;
            style.MaximizeButton.Margin = new Padding(1, 5, 1, 0);
            style.MaximizeButton.NormalState.Image = Properties.Resources.Maximize;
            style.MaximizeButton.DisabledState.Image = Properties.Resources.MaximizeDisabled;
            style.MaximizeButton.ActiveState.Image = Properties.Resources.MaximizePressed;
            style.MaximizeButton.HoverState.Image = Properties.Resources.MaximizeHot;

            style.MinimizeButton.Size = Properties.Resources.Minimize.Size;
            style.MinimizeButton.Margin = new Padding(1, 5, 1, 0);
            style.MinimizeButton.NormalState.Image = Properties.Resources.Minimize;
            style.MinimizeButton.DisabledState.Image = Properties.Resources.MinimizeDisabled;
            style.MinimizeButton.ActiveState.Image = Properties.Resources.MinimizePressed;
            style.MinimizeButton.HoverState.Image = Properties.Resources.MinimizeHot;

            style.RestoreButton.Size = Properties.Resources.Restore.Size;
            style.RestoreButton.Margin = new Padding(1, 5, 1, 0);
            style.RestoreButton.NormalState.Image = Properties.Resources.Restore;
            style.RestoreButton.DisabledState.Image = Properties.Resources.RestoreDisabled;
            style.RestoreButton.ActiveState.Image = Properties.Resources.RestorePressed;
            style.RestoreButton.HoverState.Image = Properties.Resources.RestoreHot;

            style.TitleColor = Color.White;
            style.TitleShadowColor = Color.DimGray;
            style.TitleFont = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);

            style.ClientAreaPadding = new Padding(3, 23, 3, 3);
            style.IconPadding = new Padding(3, 3, 0, 0);

            this.NonClientAreaDoubleBuffering = true;

            return style;
        }
        internal static FormStyle AddNewStyle()
        {
            FormStyle style = new FormStyle();

            if (globalStyleLibrary == null)
            {
                globalStyleLibrary = new FormStyleLibrary();
            }

            List <string> styleNames = new List <string>(FormStyleManager.GetStyleNames());

            style.Name = "FormStyle";
            for (int i = 1; styleNames.Contains(style.Name); i++)
            {
                style.Name = String.Format("FormStyle{0}", i);
            }

            globalStyleLibrary.Styles.Add(style);
            OnStyleChanged();

            return(style);
        }
        private void UpdateActiveFormStyle()
        {
            FormStyle style = null;

            if (UseFormStyleManager)
            {
                // try to load specified style
                if (!String.IsNullOrEmpty(FormStyleName))
                {
                    style = FormStyleManager.GetStyle(FormStyleName);
                }

                // if it wasn't found try to load default style
                if (style == null)
                {
                    style = FormStyleManager.GetDefaultStyle();
                }
            }
            else
            {
                style = FormStyle;
            }
            ActiveFormStyle = style;
        }
 TreeNode MapFormStyleToTreeNode(FormStyle formStyle, string propertyName)
 {
     TreeNode node = new TreeNode(propertyName);
     node.Tag = formStyle;
     node.Nodes.Add(MapSerializableImageToTreeNode(formStyle.NormalState, FormStyleProperty.NormalState));
     node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.CloseButton, FormStyleProperty.CloseButton));
     node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.MaximizeButton, FormStyleProperty.MaximizeButton));
     node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.MinimizeButton, FormStyleProperty.MinimizeButton));
     node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.RestoreButton, FormStyleProperty.RestoreButton));
     node.Nodes.Add(MapFormButtonStyleToTreeNode(formStyle.HelpButton, FormStyleProperty.HelpButton));
     return node;
 }
예제 #8
0
        private void toolAddStyle_Click(object sender, EventArgs e)
        {
            FormStyle style = FormStyleManager.AddNewStyle();

            toolStyleList.SelectedItem = style.Name;
        }
예제 #9
0
        internal static void DeleteStyle(FormStyle style)
        {
            if (style == null)
                throw new ArgumentNullException("style");

            if (globalStyleLibrary == null)
                return;

            globalStyleLibrary.Styles.Remove(style);
            OnStyleChanged();
        }
예제 #10
0
        internal static FormStyle AddNewStyle()
        {
            FormStyle style = new FormStyle();

            if (globalStyleLibrary == null)
                globalStyleLibrary = new FormStyleLibrary();

            List<string> styleNames = new List<string>(FormStyleManager.GetStyleNames());
            style.Name = "FormStyle";
            for (int i = 1; styleNames.Contains(style.Name); i++)
                style.Name = String.Format("FormStyle{0}", i);

            globalStyleLibrary.Styles.Add(style);
            OnStyleChanged();

            return style;
        }