Ejemplo n.º 1
0
        public new DialogResult ShowDialog(IWin32Window owner = null)
        {
            Enabled = true;
            if (TouchUI)
            {
                LookAndFeel.TouchUIMode = DefaultBoolean.True;
            }
            if (owner == null)
            {
                return(base.ShowDialog());
            }
            else
            {
                ISupportLookAndFeel iLookAndFeel = owner as ISupportLookAndFeel;
                if (iLookAndFeel != null)
                {
                    UserLookAndFeel lookAndFeel = iLookAndFeel.LookAndFeel;
                    string          skinName    = lookAndFeel.UseDefaultLookAndFeel ? UserLookAndFeel.Default.SkinName : lookAndFeel.SkinName;
                    if (skinName != LookAndFeel?.SkinName)
                    {
                        LookAndFeel?.SetSkinStyle(skinName);
                    }
                }

                return(base.ShowDialog(owner));
            }
        }
Ejemplo n.º 2
0
        public void ShowForm(IWin32Window owner = null)
        {
            if (_formBase != null && !_formBase.IsDisposed)
            {
                if (_formBase.Visible)
                {
                    _formBase.WindowState = FormWindowState.Normal;
                    _formBase.Activate();
                }
                else
                {
                    _formBase.Show(owner);
                }
                return;
            }
            FormBase box = new FormBase();

            _formBase       = box;
            box.FormClosed += (sender, e) => { FormClosed?.Invoke(DialogResult); };
            //box.ShowIcon = false;
            box.Controls.Add(this);
            box.ClientSize    = new Size(this.Width + 10, this.Height + 10);
            box.Text          = this.title;
            this.Left         = 5;
            this.Top          = 5;
            this.Dock         = DockStyle.Fill;
            box.StartPosition = FormStartPosition.CenterScreen;
            _form             = box;
            if (TouchUI)
            {
                //box.LookAndFeel.TouchUIMode = DefaultBoolean.True;
                LookAndFeel.TouchUIMode = DefaultBoolean.True;
            }
            if (owner == null)
            {
                box.Show();
            }
            else
            {
                ISupportLookAndFeel iLookAndFeel = owner as ISupportLookAndFeel;
                if (iLookAndFeel != null)
                {
                    UserLookAndFeel lookAndFeel = iLookAndFeel.LookAndFeel;
                    string          skinName    = lookAndFeel.UseDefaultLookAndFeel ? UserLookAndFeel.Default.SkinName : lookAndFeel.SkinName;
                    if (skinName != box.LookAndFeel.SkinName)
                    {
                        box.LookAndFeel.SetSkinStyle(skinName);
                    }
                }
                box.Show(owner);
            }
        }
        public SkinCustomizationForm(Skin targetSkin, ISupportLookAndFeel targetControl)
        {
            InitializeComponent();

            this.targetControl     = targetControl;
            this.targetSkin        = targetSkin;
            targetSkinElementNames = ExtractTargetSkinElementNamesHelper();
            this.Text = string.Format("SkinCustomizationForm ('{0}' Skin)", targetSkin.Name);

            PopulateSkinElements();
            PopulateElementAttributes();
            cbElementAttributes.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
        protected override void InitializePaintStyles()
        {
            ISupportLookAndFeel lookAndFeelOwner = owner.GetISupportLookAndFeel();

            if (lookAndFeelOwner != null)
            {
                PaintStyles.Add(new MyLayoutViewSkinPaintStyle(lookAndFeelOwner, View));
                PaintStyles.Add(new LayoutWindowsXPPaintStyle(lookAndFeelOwner));
                PaintStyles.Add(new LayoutViewOffice2003PaintStyle(lookAndFeelOwner, View));
                PaintStyles.Add(new LayoutViewStyle3DPaintStyle(lookAndFeelOwner, View));
                PaintStyles.Add(new LayoutViewUltraFlatPaintStyle(lookAndFeelOwner, View));
                PaintStyles.Add(new LayoutViewFlatPaintStyle(lookAndFeelOwner, View));
            }
            lookAndFeelOwner = null;
        }
        protected override void InitializePaintStyles()
        {
            ISupportLookAndFeel lookAndFeelOwner = owner.GetISupportLookAndFeel();

            if (lookAndFeelOwner != null)
            {
                PaintStyles.Add(new LayoutOffice2003PaintStyle(lookAndFeelOwner));
                PaintStyles.Add(new LayoutWindowsXPPaintStyle(lookAndFeelOwner));
                //
                // TODO: Add your owner PaintStyle instead of PaintStyles.Add(new LayoutSkinPaintStyle(lookAndFeelOwner));
                //
                PaintStyles.Add(new MyLayoutSkinPaintStyle(lookAndFeelOwner));

                PaintStyles.Add(new Style3DPaintStyle(lookAndFeelOwner));
                PaintStyles.Add(new UltraFlatPaintStyle(lookAndFeelOwner));
                PaintStyles.Add(new FlatPaintStyle(lookAndFeelOwner));
            }
            lookAndFeelOwner = null;
        }
Ejemplo n.º 6
0
 public MyLayoutSkinPaintStyle(ISupportLookAndFeel lookAndFeelOwner) : base(lookAndFeelOwner)
 {
     _LayoutControl = lookAndFeelOwner as MyLayoutControl;
 }
Ejemplo n.º 7
0
 public MyLayoutViewSkinPaintStyle(ISupportLookAndFeel owner, LayoutView view) : base(owner, view)
 {
 }
Ejemplo n.º 8
0
 public LayoutSkinPaintStyleEx(ISupportLookAndFeel lookAndFeelOwner)
     : base(lookAndFeelOwner)
 {
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 显示消息窗
        /// </summary>
        /// <param name="state"></param>
        private static DialogResult ShowWindow(object state)
        {
            DialogResult dr = DialogResult.Cancel;

            if (!(state is object[]))
            {
                return(dr);                        //排除异常参数9
            }
            object[]      param        = state as object[];
            string        msg          = param[0] == null ? null : param[0].ToString();
            string        title        = param[1] == null ? "温馨提示" : param[1].ToString();
            MessageIcon   icon         = (MessageIcon)param[2];
            MessageButton btn          = (MessageButton)param[3];
            IWin32Window  owner        = param[4] as IWin32Window;
            bool          flow         = (bool)param[5];
            int           autoCloseSec = (int)param[6];

            ISupportLookAndFeel iLookAndFeel = owner as ISupportLookAndFeel;
            string skinName = null;

            if (iLookAndFeel != null)
            {
                UserLookAndFeel lookAndFeel = iLookAndFeel.LookAndFeel;
                skinName = lookAndFeel.UseDefaultLookAndFeel
                    ? UserLookAndFeel.Default.SkinName
                    : lookAndFeel.SkinName;
            }
            if (flow)
            {
                if (alertctrl == null)
                {
                    alertctrl = new AlertControl();
                    alertctrl.ShowPinButton                                 = true;
                    alertctrl.ShowCloseButton                               = true;
                    alertctrl.ShowToolTips                                  = true;
                    alertctrl.FormShowingEffect                             = AlertFormShowingEffect.SlideHorizontal;
                    alertctrl.FormLocation                                  = AlertFormLocation.BottomRight;
                    alertctrl.FormDisplaySpeed                              = AlertFormDisplaySpeed.Moderate;
                    alertctrl.AppearanceText.Font                           = new Font("微软雅黑", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
                    alertctrl.AppearanceText.Options.UseFont                = true;
                    alertctrl.AppearanceHotTrackedText.Font                 = new Font("微软雅黑", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
                    alertctrl.AppearanceHotTrackedText.Options.UseFont      = true;
                    alertctrl.AppearanceHotTrackedText.ForeColor            = Color.DodgerBlue;
                    alertctrl.AppearanceHotTrackedText.Options.UseForeColor = true;
                    alertctrl.AutoHeight = true;
                    alertctrl.AppearanceCaption.TextOptions.HAlignment = HorzAlignment.Center;
                    alertctrl.AppearanceCaption.TextOptions.VAlignment = VertAlignment.Bottom;
                    alertctrl.AppearanceCaption.Font = new Font("微软雅黑", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
                    alertctrl.AppearanceCaption.Options.UseTextOptions = true;
                }
                alertctrl.AutoFormDelay = autoCloseSec * 1000;

                if (skinName != null && skinName != alertctrl.LookAndFeel.SkinName)
                {
                    alertctrl.LookAndFeel.SetSkinStyle(skinName);
                }

                alertctrl.AlertClick  += AlertClick;
                alertctrl.FormClosing += AlertClosing;
                AlertClick             = null;
                AlertClosing           = null;
                alertctrl.Show(FormMessage.Instance, "[" + title + "]", msg + "\n\n");
                return(DialogResult.OK);
            }
            else
            {
                if (skinName != null && skinName != FormMessage.Instance.LookAndFeel.SkinName)
                {
                    FormMessage.Instance.LookAndFeel.SetSkinStyle(skinName);
                }

                if (BtnClick != null)
                {
                    FormMessage.Instance.BtnOkClick     = BtnClick;
                    FormMessage.Instance.BtnCancelClick = BtnClick;
                }
                else
                {
                    FormMessage.Instance.BtnOkClick     = BtnOkClick;
                    FormMessage.Instance.BtnCancelClick = BtnCancelClick;
                }
                BtnOkClick     = null;
                BtnCancelClick = null;
                BtnClick       = null;

                dr = FormMessage.Instance.ShowDialog(msg, title, icon, btn, owner);
                return(dr);
            }
        }