示例#1
0
        private void ComboBoxAdv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItemAdv  item;
            WindowCollection windows = Application.Current.Windows;

            if (windows.Count > 0)
            {
                ComboBoxAdv combo = sender as ComboBoxAdv;
                if (combo != null)
                {
                    if (combo.SelectedItem != null)
                    {
                        item = combo.SelectedItem as ComboBoxItemAdv;
                        VisualStyles selectedStyle = (VisualStyles)Enum.Parse(typeof(VisualStyles), item.Content.ToString());
                        SfSkinManager.SetVisualStyle(this.SmithChart, selectedStyle);
                        SfSkinManager.SetVisualStyle(this.combo, selectedStyle);
                        SfSkinManager.SetVisualStyle(this.VisualStyleTextblock, selectedStyle);

                        if (selectedStyle == VisualStyles.MaterialDark)
                        {
                            this.grid.Background = Brushes.Black;
                        }
                        else
                        {
                            this.grid.Background = Brushes.White;
                        }
                    }
                }
            }
        }
        public void SetParameters(string className, int part, int state)
        {
            if (theme != IntPtr.Zero)
            {
                last_hresult = VisualStyles.UxThemeCloseThemeData(theme);
            }

            if (!IsSupported)
            {
                throw new InvalidOperationException("Visual Styles are not enabled.");
            }

            this.class_name = className;
            this.part       = part;
            this.state      = state;
            theme           = VisualStyles.UxThemeOpenThemeData(IntPtr.Zero, this.class_name);

            if (IsElementKnownToBeSupported(className, part, state))
            {
                return;
            }
            if (theme == IntPtr.Zero || !VisualStyles.UxThemeIsThemePartDefined(theme, this.part))
            {
                throw new ArgumentException("This element is not supported by the current visual style.");
            }
        }
示例#3
0
        public ToolBarDockHolder AddControl(Control c, DockStyle site, VisualStyles cStyle, Control refControl, DockStyle refSite)
        {
            if (site == DockStyle.Fill)
            {
                site = DockStyle.Top;
            }

            ToolBarDockHolder holder = new ToolBarDockHolder(this, c, site);

            if (refControl != null)
            {
                ToolBarDockHolder refHolder = GetHolder(refControl);
                if (refHolder != null)
                {
                    Point p = refHolder.PreferredDockedLocation;
                    if (refSite == DockStyle.Left)
                    {
                        p.X -= 1;
                    }
                    else if (refSite == DockStyle.Right)
                    {
                        p.X += refHolder.Width + 1;
                    }
                    else if (refSite == DockStyle.Bottom)
                    {
                        p.Y += refHolder.Height + 1;
                    }
                    else
                    {
                        p.Y -= 1;
                    }
                    holder.PreferredDockedLocation = p;
                }
            }


            _holders.Add(holder);
            holder.VisualStyle = cStyle;

            if (site != DockStyle.None)
            {
                holder.DockStyle = site;
                holder.Parent    = holder.PreferredDockedArea;
            }
            else
            {
                holder.Parent            = holder.FloatForm;
                holder.Location          = new Point(0, 0);
                holder.DockStyle         = DockStyle.None;
                holder.FloatForm.Size    = holder.Size;
                holder.FloatForm.Visible = true;
            }

            holder.MouseUp     += new MouseEventHandler(this.ToolBarMouseUp);
            holder.DoubleClick += new EventHandler(this.ToolBarDoubleClick);
            holder.MouseMove   += new MouseEventHandler(this.ToolBarMouseMove);
            holder.MouseDown   += new MouseEventHandler(this.ToolBarMouseDown);

            return(holder);
        }
        /// <summary>
        /// On Visual Style Changed.
        /// </summary>
        /// <remarks></remarks>
        private void OnVisualStyleChanged()
        {
            // Unhooks the event handler for RibbonWindow title bar help button.
            Syncfusion.Windows.Tools.Controls.TitleBar titleBar = VisualUtils.FindDescendant(this, typeof(Syncfusion.Windows.Tools.Controls.TitleBar)) as Syncfusion.Windows.Tools.Controls.TitleBar;
            WindowTitleBarButton HelpButton = null;

            if (titleBar != null)
            {
                HelpButton = titleBar.Template.FindName("HelpButton", titleBar) as WindowTitleBarButton;
            }
            if (HelpButton != null)
            {
                HelpButton.Click -= HelpButton_Click;
            }
            VisualStyles visualStyle = VisualStyles.Default;

            Enum.TryParse(CurrentVisualStyle, out visualStyle);
            string path = "pack://application:,,/Assets/Syncfusion.png";

            if (visualStyle == VisualStyles.Blend || visualStyle == VisualStyles.Office2010Black ||
                visualStyle == VisualStyles.Office2010Blue || visualStyle == VisualStyles.VisualStudio2013)
            {
                path = "pack://application:,,/Assets/SyncfusionWhite.png";
            }
            ImageSourceConverter imgConv     = new ImageSourceConverter();
            ImageSource          imageSource = (ImageSource)imgConv.ConvertFromString(path);

            this.Office2010Icon = imageSource;
            if (visualStyle != VisualStyles.Default)
            {
                SfSkinManager.ApplyStylesOnApplication = true;
                SfSkinManager.SetVisualStyle(this, visualStyle);
                SfSkinManager.ApplyStylesOnApplication = false;
            }
        }
示例#5
0
 public GoToDlg()
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     VisualStyles.EnableControls(this);
 }
        public void DrawBackground(IDeviceContext dc, Rectangle_ bounds, Rectangle_ clipRectangle)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            last_hresult = VisualStyles.UxThemeDrawThemeBackground(theme, dc, this.part, this.state, bounds, clipRectangle);
        }
        public void DrawParentBackground(IDeviceContext dc, Rectangle_ bounds, Control childControl)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            last_hresult = VisualStyles.UxThemeDrawThemeParentBackground(dc, bounds, childControl);
        }
        public void DrawText(IDeviceContext dc, Rectangle_ bounds, string textToDraw, bool drawDisabled, TextFormatFlags flags)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            last_hresult = VisualStyles.UxThemeDrawThemeText(theme, dc, this.part, this.state, textToDraw, flags, bounds);
        }
示例#9
0
        /// <summary>
        /// On Visual Style Changed.
        /// </summary>
        /// <remarks></remarks>
        private void OnVisualStyleChanged()
        {
            VisualStyles visualStyle = VisualStyles.Default;

            Enum.TryParse(CurrentVisualStyle, out visualStyle);
            if (visualStyle != VisualStyles.Default)
            {
                SfSkinManager.ApplyStylesOnApplication = true;
                SfSkinManager.SetVisualStyle(this, visualStyle);
                SfSkinManager.ApplyStylesOnApplication = false;
            }
        }
示例#10
0
        public bool GetBoolean(BooleanProperty prop)
        {
            if (!Enum.IsDefined(typeof(BooleanProperty), prop))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)prop, typeof(BooleanProperty));
            }

            bool result;

            last_hresult = VisualStyles.UxThemeGetThemeBool(theme, this.part, this.state, prop, out result);
            return(result);
        }
示例#11
0
        public Rectangle_ GetTextExtent(IDeviceContext dc, string textToDraw, TextFormatFlags flags)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            Rectangle_ result;

            last_hresult = VisualStyles.UxThemeGetThemeTextExtent(theme, dc, this.part, this.state, textToDraw, flags, out result);
            return(result);
        }
示例#12
0
        public TextMetrics GetTextMetrics(IDeviceContext dc)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc", "dc cannot be null.");
            }

            TextMetrics result;

            last_hresult = VisualStyles.UxThemeGetThemeTextMetrics(theme, dc, this.part, this.state, out result);
            return(result);
        }
示例#13
0
        public Region GetBackgroundRegion(IDeviceContext dc, Rectangle_ bounds)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            Region result;

            last_hresult = VisualStyles.UxThemeGetThemeBackgroundRegion(theme, dc, this.part, this.state, bounds, out result);
            return(result);
        }
示例#14
0
        public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle_ backgroundRectangle, IntPtr hRgn, Point_ pt, HitTestOptions options)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            HitTestCode result;

            last_hresult = VisualStyles.UxThemeHitTestThemeBackground(theme, dc, this.part, this.state, options, backgroundRectangle, hRgn, pt, out result);
            return(result);
        }
示例#15
0
        public Rectangle_ DrawEdge(IDeviceContext dc, Rectangle_ bounds, Edges edges, EdgeStyle style, EdgeEffects effects)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }

            Rectangle_ result;

            last_hresult = VisualStyles.UxThemeDrawThemeEdge(theme, dc, this.part, this.state, bounds, edges, style, effects, out result);
            return(result);
        }
示例#16
0
        public string GetString(StringProperty prop)
        {
            if (!Enum.IsDefined(typeof(StringProperty), prop))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)prop, typeof(StringProperty));
            }

            string result;

            last_hresult = VisualStyles.UxThemeGetThemeString(theme, this.part, this.state, prop, out result);
            return(result);
        }
示例#17
0
        public Point_ GetPoint(PointProperty prop)
        {
            if (!Enum.IsDefined(typeof(PointProperty), prop))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)prop, typeof(PointProperty));
            }

            Point_ result;

            last_hresult = VisualStyles.UxThemeGetThemePosition(theme, this.part, this.state, prop, out result);
            return(result);
        }
示例#18
0
            public VisualSettings(VisualStyles style)
            {
                if (style == VisualStyles.Android)
                {
                    TrackBorderThickness = 0;
                    TrackCornerRadius    = 100;
                    TrackHeightRequest   = 14;
                    TrackWidthRequest    = 20;

                    ThumbBorderThickness = 0;
                    ThumbCornerRadius    = 100;
                    ThumbHeightRequest   = 20;
                    ThumbWidthRequest    = 20;

                    ThumbPadding = new Thickness(-10, 0, -10, 0);
                }
                else if (style == VisualStyles.iOS)
                {
                    TrackBorderThickness = 2;
                    TrackCornerRadius    = 100;
                    TrackHeightRequest   = 30;
                    TrackWidthRequest    = 50;

                    ThumbBorderThickness = 0;
                    ThumbCornerRadius    = 100;
                    ThumbHeightRequest   = 26;
                    ThumbWidthRequest    = 26;

                    ThumbPadding = new Thickness(2, 0, 2, 0);
                }
                else if (style == VisualStyles.UWP)
                {
                    TrackBorderThickness = 2;
                    TrackCornerRadius    = 100;
                    TrackHeightRequest   = 20;
                    TrackWidthRequest    = 44;

                    ThumbBorderThickness = 2.5;
                    ThumbCornerRadius    = 100;
                    ThumbHeightRequest   = 15;
                    ThumbWidthRequest    = 15;

                    ThumbPadding = new Thickness(2, 0, 2, 0);
                }

                ThumbHorizontalNegativeLeftPadding  = ThumbPadding.Left < 0 ? Math.Abs(ThumbPadding.Left) : 0;
                ThumbHorizontalNegativeRightPadding = ThumbPadding.Right < 0 ? Math.Abs(ThumbPadding.Right) : 0;
                ThumbHorizontalNegativePadding      = Math.Abs(ThumbHorizontalNegativeRightPadding + ThumbHorizontalNegativeLeftPadding);
            }
示例#19
0
        public Size_ GetPartSize(IDeviceContext dc, ThemeSizeType type)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }
            if (!Enum.IsDefined(typeof(ThemeSizeType), type))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)type, typeof(ThemeSizeType));
            }

            Size_ result;

            last_hresult = VisualStyles.UxThemeGetThemePartSize(theme, dc, this.part, this.state, type, out result);
            return(result);
        }
示例#20
0
        public Padding GetMargins(IDeviceContext dc, MarginProperty prop)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }
            if (!Enum.IsDefined(typeof(MarginProperty), prop))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)prop, typeof(MarginProperty));
            }

            Padding result;

            last_hresult = VisualStyles.UxThemeGetThemeMargins(theme, dc, this.part, this.state, prop, out result);
            return(result);
        }
示例#21
0
        /// <summary>
        /// Define cor padrão, baseado no look and feel das telas do SAP
        /// </summary>
        /// <param name="pView">View da Grid</param>
        public static void SetColors(this GridView pView)
        {
            pView.Appearance.Reset();

            pView.Appearance.FocusedCell.BackColor = VisualStyles.focusedEditorColor;
            pView.Appearance.FocusedCell.ForeColor = Color.Black;

            pView.Appearance.FocusedRow.BackColor = VisualStyles.selectedRow;
            pView.Appearance.FocusedRow.ForeColor = Color.Black;

            pView.Appearance.SelectedRow.BackColor = VisualStyles.selectedRow;
            pView.Appearance.SelectedRow.ForeColor = Color.Black;

            pView.Appearance.HideSelectionRow.BackColor = VisualStyles.selectedRow;
            pView.Appearance.HideSelectionRow.ForeColor = Color.Black;

            pView.ShowingEditor += (sender, args) => VisualStyles.SetStyle(pView.ActiveEditor);
        }
示例#22
0
        public static bool IsElementDefined(VisualStyleElement element)
        {
            if (!IsSupported)
            {
                throw new InvalidOperationException("Visual Styles are not enabled.");
            }

            if (IsElementKnownToBeSupported(element.ClassName, element.Part, element.State))
            {
                return(true);
            }

            IntPtr theme = VisualStyles.UxThemeOpenThemeData(IntPtr.Zero, element.ClassName);

            if (theme == IntPtr.Zero)
            {
                return(false);
            }
            bool retval = VisualStyles.UxThemeIsThemePartDefined(theme, element.Part);

            VisualStyles.UxThemeCloseThemeData(theme);

            return(retval);
        }
示例#23
0
        public int ArtistGeneratePoints(int chance, Artist artist, ArtistStats statType, MusicalStyles musicalStyle, VisualStyles visualStyle)
        {
            int generated = GetPoints(chance, artist, statType, musicalStyle, visualStyle);

            if (generated <= 0)
            {
                if (statType == ArtistStats.VISUALS)
                {
                    if (artist.PityVisuals < artist.GetVisuals() * 2)
                    {
                        artist.PityVisuals = artist.GetVisuals() * 2;
                    }
                    else
                    {
                        artist.PityVisuals += artist.GetVisuals();
                    }
                    // Debug.WriteLine("Visuals Points: " + generated + " - Pity Visuals: " + artist.PityVisuals);
                }
                else if (statType == ArtistStats.VOCALS)
                {
                    if (artist.PityVocals < artist.GetVocals() * 2)
                    {
                        artist.PityVocals = artist.GetVocals() * 2;
                    }
                    else
                    {
                        artist.PityVocals += artist.GetVocals();
                    }
                    // Debug.WriteLine("Vocals Points: " + generated + " - Pity Vocals: " + artist.PityVocals);
                }
                else if (statType == ArtistStats.DANCE)
                {
                    if (artist.PityDance < artist.GetDance() * 2)
                    {
                        artist.PityDance = artist.GetDance() * 2;
                    }
                    else
                    {
                        artist.PityDance += artist.GetDance();
                    }
                    // Debug.WriteLine("Dance Points: " + generated + " - Pity Dance: " + artist.PityDance);
                }
                else if (statType == ArtistStats.PERSONALITY)
                {
                    if (artist.PityPersonality < artist.GetPersonality() * 2)
                    {
                        artist.PityPersonality = artist.GetPersonality() * 2;
                    }
                    else
                    {
                        artist.PityPersonality += artist.GetPersonality();
                    }
                    // Debug.WriteLine("Personality Points: " + generated + " - Pity Personality: " + artist.PityPersonality);
                }
            }
            else
            {
                if (statType == ArtistStats.VISUALS)
                {
                    artist.PityVisuals = 0;
                    // Debug.WriteLine("Visuals Points: " + generated + " - Pity Visuals: " + artist.PityVisuals);
                }
                else if (statType == ArtistStats.VOCALS)
                {
                    artist.PityVocals = 0;
                    // Debug.WriteLine("Vocals Points: " + generated + " - Pity Vocals: " + artist.PityVocals);
                }

                else if (statType == ArtistStats.DANCE)
                {
                    artist.PityDance = 0;
                    // Debug.WriteLine("Dance Points: " + generated + " - Pity Dance: " + artist.PityDance);
                }

                else if (statType == ArtistStats.PERSONALITY)
                {
                    artist.PityPersonality = 0;
                    // Debug.WriteLine("Personality Points: " + generated + " - Pity Personality: " + artist.PityPersonality);
                }
            }

            return(generated);
        }
示例#24
0
		public override void UpDownBaseDrawButton (Graphics g, Rectangle bounds, bool top, VisualStyles.PushButtonState state)
		{
			ControlPaint.DrawScrollButton (g, bounds, top ? ScrollButton.Up : ScrollButton.Down, state == VisualStyles.PushButtonState.Pressed ? ButtonState.Pushed : ButtonState.Normal);
		}
 public static IDisposable EnableVisualStyles(bool enable = true) => VisualStyles.EnableVisualStyles(enable);
示例#26
0
 public bool IsBackgroundPartiallyTransparent()
 {
     return(VisualStyles.UxThemeIsThemeBackgroundPartiallyTransparent(theme, this.part, this.state));
 }
示例#27
0
文件: Theme.cs 项目: Profit0004/mono
		public abstract void UpDownBaseDrawButton (Graphics g, Rectangle bounds, bool top, VisualStyles.PushButtonState state);
示例#28
0
 public ToolBarDockHolder AddControl(Control c, VisualStyles cStyle)
 {
     return(AddControl(c, DockStyle.Top, cStyle, null, DockStyle.Right));
 }
示例#29
0
        /*
         * Recursive function that RNGs an artist using their stat to generate points
         * Keeps RNG range through a cumulative variable
         * If successful roll on [0, culVariable), degrade culVariable by pointStep * difficulty chance
         */
        public int GetPoints(int chance, Artist artist, ArtistStats statType, MusicalStyles musicalStyle, VisualStyles visualStyle)
        {
            int result = 0;

            if (statType == ArtistStats.VISUALS)
            {
                if (artist.PityVisuals == 0)
                {
                    result = random.Next(0, (int)artist.GetVisuals());
                }
                else
                {
                    result = random.Next(0, (int)artist.PityVisuals);
                }

                if (visualStyle == VisualStyles.Cutesy)
                {
                    if (artist.VisualArchetype == VisualArchetypes.Adorable || artist.VisualArchetype == VisualArchetypes.Enchanting)
                    {
                        result += 5;
                    }
                }
                else if (visualStyle == VisualStyles.Girl_Crush)
                {
                    if (artist.VisualArchetype == VisualArchetypes.Bewitching || artist.VisualArchetype == VisualArchetypes.Elegant)
                    {
                        result += 5;
                    }
                }
                else if (visualStyle == VisualStyles.Retro)
                {
                    if (artist.VisualArchetype == VisualArchetypes.Adorable || artist.VisualArchetype == VisualArchetypes.Gorgeous)
                    {
                        result += 5;
                    }
                }
                else if (visualStyle == VisualStyles.Party)
                {
                    if (artist.VisualArchetype == VisualArchetypes.Bewitching || artist.VisualArchetype == VisualArchetypes.Fatale)
                    {
                        result += 5;
                    }
                }
                else if (visualStyle == VisualStyles.Provocative)
                {
                    if (artist.VisualArchetype == VisualArchetypes.Elegant || artist.VisualArchetype == VisualArchetypes.Fatale)
                    {
                        result += 5;
                    }
                }
                else
                {
                    if (artist.VisualArchetype == VisualArchetypes.Enchanting || artist.VisualArchetype == VisualArchetypes.Gorgeous)
                    {
                        result += 5;
                    }
                }

                if (result >= chance)
                {
                    artist.PityVisuals = 0;
                    return(1 + GetPoints(Convert.ToInt32(chance * pointStep), artist, statType, musicalStyle, visualStyle));
                }
                else
                {
                    return(0);
                }
            }
            else if (statType == ArtistStats.VOCALS)
            {
                if (artist.PityVocals == 0)
                {
                    result = random.Next(0, (int)artist.GetVocals());
                }
                else
                {
                    result = random.Next(0, (int)artist.PityVocals);
                }

                // Bonus based on Talent/100 and type of musical style (XFactor/100) * (Songwriting || Arrangement)

                int talent = random.Next(0, 101);
                int type   = random.Next(0, 2);

                if (musicalStyle == MusicalStyles.Ballad || musicalStyle == MusicalStyles.Bubblegum ||
                    musicalStyle == MusicalStyles.Disco_Pop || musicalStyle == MusicalStyles.RnB || musicalStyle == MusicalStyles.Soul)
                {
                    if (talent > artist.XFactor)
                    {
                        result += Convert.ToInt32((artist.XFactor / 100.0f) * artist.Songwriting);
                    }
                }
                else if (musicalStyle == MusicalStyles.Bebop || musicalStyle == MusicalStyles.Blues || musicalStyle == MusicalStyles.Dubstep ||
                         musicalStyle == MusicalStyles.Electronica || musicalStyle == MusicalStyles.Funk || musicalStyle == MusicalStyles.Jazz ||
                         musicalStyle == MusicalStyles.Swing || musicalStyle == MusicalStyles.Trap)
                {
                    if (talent > artist.XFactor)
                    {
                        result += Convert.ToInt32((artist.XFactor / 100.0f) * artist.Arrangement);
                    }
                }
                else
                {
                    if (type == 0)
                    {
                        if (talent > artist.XFactor)
                        {
                            result += Convert.ToInt32((artist.XFactor / 100.0f) * artist.Songwriting);
                        }
                    }
                    else
                    {
                        if (talent > artist.XFactor)
                        {
                            result += Convert.ToInt32((artist.XFactor / 100.0f) * artist.Arrangement);
                        }
                    }
                }

                if (result >= chance)
                {
                    artist.PityVocals = 0;
                    return(1 + GetPoints(Convert.ToInt32(chance * pointStep), artist, statType, musicalStyle, visualStyle));
                }
                else
                {
                    return(0);
                }
            }
            else if (statType == ArtistStats.DANCE)
            {
                if (artist.PityDance == 0)
                {
                    result = random.Next(0, (int)artist.GetDance());
                }
                else
                {
                    result = random.Next(0, (int)artist.PityDance);
                }

                int talent = random.Next(0, 101);

                if (talent > artist.XFactor)
                {
                    result += Convert.ToInt32((artist.XFactor / 100.0f) * artist.Choreography);
                }

                if (result >= chance)
                {
                    artist.PityDance = 0;
                    return(1 + GetPoints(Convert.ToInt32(chance * pointStep), artist, statType, musicalStyle, visualStyle));
                }
                else
                {
                    return(0);
                }
            }
            else if (statType == ArtistStats.PERSONALITY)
            {
                if (artist.PityPersonality == 0)
                {
                    result = random.Next(0, (int)artist.GetPersonality());
                }
                else
                {
                    result = random.Next(0, (int)artist.PityPersonality);
                }
                if (result >= chance)
                {
                    artist.PityPersonality = 0;
                    return(1 + GetPoints(Convert.ToInt32(chance * pointStep), artist, statType, musicalStyle, visualStyle));
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }