示例#1
0
 public void DrawItems(IColorScheme scheme, Graphics g, int scroll)
 {
     for (int index = 0; index < m_items.Count; index++)
     {
         DrawItem(scheme, g, index, scroll);
     }
 }
示例#2
0
        public LineDrawer(IColorScheme scheme)
        {
            SolidBrush outlineBrush  = null;
            SolidBrush selectedBrush = null;

            try
            {
                outlineBrush    = new SolidBrush(Color.FromArgb(128, scheme.Connectors));
                Outline         = new Pen(outlineBrush, 2);
                selectedBrush   = new SolidBrush(scheme.SelectedConnectors);
                SelectedOutline = new Pen(selectedBrush, 2);
            }
            catch
            {
                if (outlineBrush != null)
                {
                    outlineBrush.Dispose();
                }
                if (Outline != null)
                {
                    Outline.Dispose();
                }
                if (selectedBrush != null)
                {
                    selectedBrush.Dispose();
                }
                if (SelectedOutline != null)
                {
                    SelectedOutline.Dispose();
                }
                throw;
            }
        }
示例#3
0
 public ColorManager(IColorScheme colorScheme, IEnumerable <DataPropertyDescriptor> propertyDescriptors,
                     ClusterRole.Transform transform)
 {
     ColorScheme         = colorScheme;
     PropertyDescriptors = ImmutableList.ValueOf(propertyDescriptors);
     Transform           = transform;
 }
示例#4
0
 public Motorcycle(string make, string model, IColorScheme colorScheme)
     : this()
 {
     Make = make;
     Model = model;
     ColorScheme = colorScheme;
 }
示例#5
0
文件: Car.cs 项目: wade/Speedioc
 public Car(string make, string model, IColorScheme colorScheme)
     : this()
 {
     Make = make;
     Model = model;
     ColorScheme = colorScheme;
 }
示例#6
0
        public static Color BestMatch(Color input, IColorScheme colorScheme)
        {
            Color[] colors =
            {
                colorScheme.Black,
                colorScheme.Blue,
                colorScheme.Cyan,
                colorScheme.Green,
                colorScheme.Magenta,
                colorScheme.White,
                colorScheme.Red,
                colorScheme.Yellow,
                colorScheme.BrightBlack,
                colorScheme.BrightBlue,
                colorScheme.BrightCyan,
                colorScheme.BrightGreen,
                colorScheme.BrightMagenta,
                colorScheme.BrightWhite,
                colorScheme.BrightRed,
                colorScheme.BrightYellow
            };
            byte    a = input.A;
            byte    r = input.R;
            byte    g = input.G;
            byte    b = input.B;
            Vector4 aways;
            int     bestAway  = 2949000;
            Color   bestMatch = Color.Black;

            foreach (Color color in colors)
            {
                aways = new Vector4(a - color.A, r - color.R, g - color.G, b - color.B);
                if (aways.X < 0)
                {
                    aways.X *= -1;
                }
                if (aways.Y < 0)
                {
                    aways.Y *= -1;
                }
                if (aways.Z < 0)
                {
                    aways.Z *= -1;
                }
                if (aways.W < 0)
                {
                    aways.W *= -1;
                }
                int awaysSum = (int)(aways.X + aways.Y + aways.Z + aways.W);
                if (awaysSum < bestAway)
                {
                    bestAway  = awaysSum;
                    bestMatch = color;
                }
            }

            return(bestMatch);
        }
示例#7
0
 public void Configure(IColorScheme scheme)
 {
     using (ErrorCheckerSelectorDialog dialog = new ErrorCheckerSelectorDialog())
     {
         dialog.Scheme = scheme;
         dialog.Init(m_config, m_pluginsConfig);
         dialog.ShowDialog();
     }
 }
示例#8
0
            public void Draw(Graphics g, VisibilityFilter filter, RectangleF area, IColorScheme scheme)
            {
                float indent        = CalculateIndent(area);
                var   iconRectangle = CalculateIconRectangle(area);

                DrawMinimizeIcon(g, MinimizedIconRectangle(area, indent), filter, scheme);
                DrawTree(g, iconRectangle, filter, scheme);
                DrawIcon(g, iconRectangle);
            }
示例#9
0
 /// <summary>
 /// Sets up the Table to work with the specified layer.
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void Initialize(IRasterLayer layer)
 {
     _originalLayer  = layer;
     _newLayer       = layer.Copy();
     _symbolizer     = layer.Symbolizer;
     _newScheme      = _symbolizer.Scheme;
     _originalScheme = (IColorScheme)_symbolizer.Scheme.Clone();
     _raster         = layer.DataSet;
     GetSettings();
 }
示例#10
0
 public ContextMenu(IColorScheme scheme, MouseController <TNode> mouseController, Func <Point, Point> toGraphSpace, Func <bool> conversationReal)
 {
     m_mouseController = mouseController;
     ToGraphSpace      = toGraphSpace;
     ConversationReal  = conversationReal;
     m_menu            = new ContextMenuStrip();
     m_menu.RenderMode = ToolStripRenderMode.Professional;
     m_menu.Renderer   = scheme.ContextMenu;
     m_menu.Opening   += (a, b) => b.Cancel = UpdateContextMenu();
 }
示例#11
0
 public Visualizer(
     IColorScheme colorScheme,
     IFontScheme fontScheme,
     Color backgroundColor,
     Size imageSize)
 {
     this.colorScheme = colorScheme;
     this.fontScheme  = fontScheme;
     BackgroundColor  = backgroundColor;
     Size             = imageSize;
 }
示例#12
0
 public override ConfigureResult2 Edit(IColorScheme scheme, IConversationNodeData node, AudioGenerationParameters audioContext, Func <ParameterType, ParameterEditorSetupData, IParameterEditor> config, ILocalizationEngine localizer, IAudioParameterEditorCallbacks audioProvider, AutoCompleteSuggestionsDelegate autoCompleteSuggestions)
 {
     if (node.Parameters.Any())
     {
         return(NodeEditor.Edit(scheme, node, audioContext, config, localizer, audioProvider, autoCompleteSuggestions));
     }
     else
     {
         return(ConfigureResult2.NotApplicable);
     }
 }
示例#13
0
        private void DrawItem(IColorScheme scheme, Graphics g, int index, int scroll)
        {
            var  item    = m_items[index];
            bool check   = item.Checked;
            var  itemBox = ItemBox(index, scroll);

            DefaultBooleanEditor.DrawCheckBox(g, itemBox, check, m_held == item, m_hovered == item);
            var textSize = g.MeasureString(m_stringSelector(item.Element), Font);

            g.DrawString(m_stringSelector(item.Element), Font, scheme.ForegroundBrush, SPACING + BOX_SIZE + SPACING, itemBox.Y + (BOX_SIZE - textSize.Height) / 2);
        }
示例#14
0
 internal void Draw(IColorScheme scheme, Graphics g, float y, float width, bool selected)
 {
     using (Brush background = new SolidBrush(selected ? scheme.SelectedConversationListItemSecondaryBackground : scheme.Background))
     {
         using (Brush text = new SolidBrush(scheme.Foreground))
         {
             g.FillRectangle(background, new RectangleF(0, y, width, HEIGHT));
             g.DrawRectangle(scheme.ControlBorder, new RectangleF(0, y, width, HEIGHT));
             g.DrawString(m_data.Message, SystemFonts.DefaultFont, text, new PointF(4, y + 5));
         }
     }
 }
示例#15
0
        }                            //The area isn't calculated automatically

        public void Draw(Graphics g, bool selected, IColorScheme scheme)
        {
            if (selected)
            {
                using (var brush = new SolidBrush(scheme.GroupBackgroundSelected))
                    g.FillRectangle(brush, m_area);
            }
            else
            {
                using (var brush = new SolidBrush(scheme.GroupBackgroundUnselected))
                    g.FillRectangle(brush, m_area);
            }
            g.DrawRectangle(scheme.ForegroundPen, m_area);
        }
示例#16
0
        /// <summary>
        /// Applies the changes that have been specified in this control.
        /// </summary>
        protected virtual void OnApplyChanges()
        {
            _originalLayer.Symbolizer = _newLayer.Symbolizer.Copy();
            _originalScheme           = _newLayer.Symbolizer.Scheme.Copy();
            if (_originalLayer.Symbolizer.ShadedRelief.IsUsed)
            {
                if (_originalLayer.Symbolizer.ShadedRelief.HasChanged || _originalLayer.Symbolizer.HillShade == null)
                {
                    _originalLayer.Symbolizer.CreateHillShade(mwProgressBar1);
                }
            }

            _originalLayer.WriteBitmap(mwProgressBar1);
            ChangesApplied?.Invoke(_originalLayer, EventArgs.Empty);
        }
示例#17
0
        public SettingsDialog(ISettingsViewModel vm, CushWindow owningWindow, DialogSettings settings)
            : base(owningWindow, settings)
        {
            DataContext = vm;
            InitializeComponent();
            _originalScheme = new ColorScheme(this.ColorScheme);

            if (vm.ConfigFileHasPassword)
                InitializePassword();

            //Apply.IsEnabled = false;

            var cvs = CollectionViewSource.GetDefaultView(FontCombo.ItemsSource);
            cvs.SortDescriptions.Clear();
            cvs.SortDescriptions.Add(new SortDescription("Source", ListSortDirection.Ascending));
            cvs.Refresh();
        }
示例#18
0
        private void LoadColorScheme()
        {
            switch (ColorSchemeName)
            {
            case ColorSchemes.Cmder:
                Colors = new CmderColorScheme();
                break;

            case ColorSchemes.Monochrome:
                Colors = new MonochromeColorScheme();
                break;

            case ColorSchemes.Default:
            default:
                Colors = new DefaultColorScheme();
                break;
            }
        }
示例#19
0
文件: ExcelTheme.cs 项目: Daoting/dt
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.Xls.ExcelTheme" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="colorScheme">The color scheme.</param>
 /// <param name="fontScheme">The font scheme.</param>
 public ExcelTheme(string name, IColorScheme colorScheme, IFontScheme fontScheme)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentNullException("name");
     }
     if (colorScheme == null)
     {
         throw new ArgumentNullException("colorScheme");
     }
     if (fontScheme == null)
     {
         throw new ArgumentNullException("fontScheme");
     }
     this.Name        = name;
     this.ColorScheme = colorScheme;
     this.FontScheme  = fontScheme;
 }
示例#20
0
        internal static UnknownParameterEditor Make(IColorScheme scheme, ParameterEditorSetupData data, SimpleUndoPair removeParameter, Action remove)
        {
            UnknownParameterEditor x = null;

            try
            {
                x        = new UnknownParameterEditor();
                x.Scheme = scheme;
                x.Setup(data);
                x.m_removeParameter = removeParameter;
                x.Remove           += remove;
                var result = x;
                x = null;
                return(result);
            }
            finally
            {
                if (x != null)
                {
                    x.Dispose();
                }
            }
        }
示例#21
0
 public static void SetColorScheme(string colorScheme)
 {
     try { ColorScheme = GetColorScheme(colorScheme); } catch (InvalidOperationException) {
         MessageBox.Show("Color scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     try {
         if (StyleScheme == null)
         {
             StyleScheme = GetStyleScheme(Properties.Settings.Default.StyleScheme);
         }
     } catch {
         MessageBox.Show("Style scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     Background    = ColorScheme.Background;
     Carret        = ColorScheme.Carret;
     LineNumber    = ColorScheme.LineNumber;
     ServiceLine   = ColorScheme.ServiceLine;
     Selection     = ColorScheme.Selection;
     Default       = new TextStyle(new SolidBrush(ColorScheme.Text), null, FontStyle.Regular);
     SameWord      = new TextStyle(new SolidBrush(ColorScheme.SameWordText), new SolidBrush(ColorScheme.SameWord), StyleScheme.SameWord);
     Comment       = new TextStyle(new SolidBrush(ColorScheme.Comment), null, StyleScheme.Comment);
     Keyword0      = new TextStyle(new SolidBrush(ColorScheme.Keyword), null, StyleScheme.Keyword);
     Keyword1      = new TextStyle(new SolidBrush(ColorScheme.Keyword1), null, StyleScheme.Keyword1);
     Keyword2      = new TextStyle(new SolidBrush(ColorScheme.Keyword2), null, StyleScheme.Keyword2);
     Keyword3      = new TextStyle(new SolidBrush(ColorScheme.Keyword3), null, StyleScheme.Keyword3);
     Keyword4      = new TextStyle(new SolidBrush(ColorScheme.Keyword4), null, StyleScheme.Keyword4);
     Number        = new TextStyle(new SolidBrush(ColorScheme.Number), null, StyleScheme.Number);
     Time          = new TextStyle(new SolidBrush(ColorScheme.Time), null, StyleScheme.Time);
     Special       = new TextStyle(new SolidBrush(ColorScheme.Special), null, StyleScheme.Special);
     Command       = new TextStyle(new SolidBrush(ColorScheme.Command), null, StyleScheme.Command);
     Path          = new TextStyle(new SolidBrush(ColorScheme.Path), null, StyleScheme.Path);
     SearchResult  = new TargetStyle(ColorScheme.SearchResultBack, ColorScheme.SearchResultFrame);
     ReplaceResult = new TargetStyle(ColorScheme.ReplaceResultBack, ColorScheme.ReplaceResultFrame);
 }
示例#22
0
 public DefaultIntegerEditor(IColorScheme scheme) : this()
 {
     Scheme = scheme;
 }
示例#23
0
        private void OnOkClick(object sender, RoutedEventArgs e)
        {
            if (_passwordChanged)
            {
                //_configFile.SetPassword(PasswordBox.SecurePassword, PasswordValidator.CreateNewSalt());
                //_configFile.Save();
                _passwordChanged = false;
            }

            _originalScheme = new ColorScheme(this.ColorScheme);
            Close();
        }
示例#24
0
 public DefaultBooleanEditor(IColorScheme scheme) : this()
 {
     Scheme = scheme;
 }
示例#25
0
            public override void DrawTree(Graphics g, RectangleF iconRectangle, VisibilityFilter filter, IColorScheme scheme)
            {
                var start = iconRectangle.Center();

                float treeBranchX = start.X - ItemHeight + 6; //The x coordinate of the point where this node's connector line joins the parents branch line

                g.DrawLine(scheme.TreePen, start, new PointF(treeBranchX, start.Y));

                Func <Item, int> itemsBefore = (child) => Children(filter).TakeWhile(i => i != child).Select(c => c.AllItems(filter).Count()).Sum();

                //Draw vertical line
                if (Children(filter).Any())
                {
                    int itemsBeforeLastChild = itemsBefore(Children(filter).Last());
                    g.DrawLine(scheme.TreePen, start, new PointF(start.X, start.Y + ItemHeight * (itemsBeforeLastChild + 1) + 1));
                }
            }
 /// <summary>
 /// Applies the changes that have been specified in this control
 /// </summary>
 protected virtual void OnApplyChanges()
 {
     // SetSettings(); When applying a scheme settings are set, so don't bother here.
     _originalLayer.Symbolizer = _newLayer.Symbolizer.Copy();
     _originalScheme = _newLayer.Symbolizer.Scheme.Copy();
     //_originalLayer.Symbolizer.Scheme.Categories.UpdateItemParentPointers();
     if (_originalLayer.Symbolizer.ShadedRelief.IsUsed)
     {
         if (_originalLayer.Symbolizer.ShadedRelief.HasChanged || _originalLayer.Symbolizer.HillShade == null)
             _originalLayer.Symbolizer.CreateHillShade(mwProgressBar1);
     }
     _originalLayer.WriteBitmap(mwProgressBar1);
     if (ChangesApplied != null) ChangesApplied(_originalLayer, new EventArgs());
 }
 public SquarifiedTreeMapRenderer(IColorScheme colorScheme)
 {
     _colorScheme = colorScheme;
 }
示例#28
0
 public static void Register(IColorScheme colorScheme)
 {
     _colorSchemes.Add(colorScheme.Name.ToLower(), colorScheme);
 }
示例#29
0
 public static void SetColorScheme(string colorScheme)
 {
     try { ColorScheme = GetColorScheme(colorScheme); } catch (InvalidOperationException) {
         MessageBox.Show("Color scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     try {
         if (StyleScheme == null) StyleScheme = GetStyleScheme(Properties.Settings.Default.StyleScheme);
     } catch {
         MessageBox.Show("Style scheme not found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     Background = ColorScheme.Background;
     Carret = ColorScheme.Carret;
     LineNumber = ColorScheme.LineNumber;
     ServiceLine = ColorScheme.ServiceLine;
     Selection = ColorScheme.Selection;
     Default = new TextStyle(new SolidBrush(ColorScheme.Text), null, FontStyle.Regular);
     SameWord = new TextStyle(new SolidBrush(ColorScheme.SameWordText), new SolidBrush(ColorScheme.SameWord), StyleScheme.SameWord);
     Comment = new TextStyle(new SolidBrush(ColorScheme.Comment), null, StyleScheme.Comment);
     Keyword0 = new TextStyle(new SolidBrush(ColorScheme.Keyword), null, StyleScheme.Keyword);
     Keyword1 = new TextStyle(new SolidBrush(ColorScheme.Keyword1), null, StyleScheme.Keyword1);
     Keyword2 = new TextStyle(new SolidBrush(ColorScheme.Keyword2), null, StyleScheme.Keyword2);
     Keyword3 = new TextStyle(new SolidBrush(ColorScheme.Keyword3), null, StyleScheme.Keyword3);
     Keyword4 = new TextStyle(new SolidBrush(ColorScheme.Keyword4), null, StyleScheme.Keyword4);
     Number = new TextStyle(new SolidBrush(ColorScheme.Number), null, StyleScheme.Number);
     Time = new TextStyle(new SolidBrush(ColorScheme.Time), null, StyleScheme.Time);
     Special = new TextStyle(new SolidBrush(ColorScheme.Special), null, StyleScheme.Special);
     Command = new TextStyle(new SolidBrush(ColorScheme.Command), null, StyleScheme.Command);
     Path = new TextStyle(new SolidBrush(ColorScheme.Path), null, StyleScheme.Path);
     SearchResult = new TargetStyle(ColorScheme.SearchResultBack, ColorScheme.SearchResultFrame);
     ReplaceResult = new TargetStyle(ColorScheme.ReplaceResultBack, ColorScheme.ReplaceResultFrame);
 }
示例#30
0
 private static void SetupColors(IColorScheme value, TControl b)
 {
     b.TextBoxColors.BorderPen = value.ControlBorder;
     b.SelectedBackgroundColor = value.SelectedConversationListItemPrimaryBackground;
     b.Renderer = value.ContextMenu;
 }
 public static IColorScheme ForAlias(this IColorScheme palette, IAliasMapping aliasMapping)
 {
     return(new AliasColorScheme(palette, aliasMapping));
 }
示例#32
0
 protected override void DrawMinimizeIcon(Graphics g, RectangleF minimizeIconRectangle, VisibilityFilter filter, IColorScheme scheme)
 {
     if (m_subItems.Any(a => a.AllItems(filter).Any()))
     {
         g.FillRectangle(scheme.BackgroundBrush, minimizeIconRectangle);
         g.DrawRectangle(scheme.ForegroundPen, minimizeIconRectangle);
         g.DrawLine(scheme.ForegroundPen, new PointF(minimizeIconRectangle.Left + 2, minimizeIconRectangle.Y + minimizeIconRectangle.Height / 2), new PointF(minimizeIconRectangle.Right - 2, minimizeIconRectangle.Y + minimizeIconRectangle.Height / 2));
         if (Minimized.Value)
         {
             g.DrawLine(scheme.ForegroundPen, new PointF(minimizeIconRectangle.Left + minimizeIconRectangle.Width / 2, minimizeIconRectangle.Top + 2), new PointF(minimizeIconRectangle.Right - minimizeIconRectangle.Width / 2, minimizeIconRectangle.Bottom - 2));
         }
     }
 }
示例#33
0
 public DefaultSetEditor(IColorScheme scheme) : this()
 {
     Scheme = scheme;
 }
示例#34
0
 public IParameterEditor Make(IColorScheme scheme)
 {
     return(new DefaultSetEditor(scheme));
 }
示例#35
0
 /// <summary>
 ///     Takes an <see cref="IColorSchemeExtensionContainer " /> and populates the <see cref="ColorSchemeManager" />
 ///     with the Accents, Themes, and default scheme.
 /// </summary>
 public static void PopulateSchemes(IColorSchemeExtensionContainer container)
 {
     _container = container;
     CurrentScheme = container.DefaultScheme;
     _baseTheme = container.BaseTheme;
 }
示例#36
0
 public static void SetManagedColorScheme(IColorScheme scheme)
 {
     ThrowHelper.IfNullThenThrow(() => scheme);
     SetManagedColorScheme(scheme.Theme, scheme.Accent);
 }
示例#37
0
 private static void OnColorSchemeChanged(IColorScheme oldScheme)
 {
     OnManagedResourcesChanged(null,
         new ChangedEventArgs<IKeyedResourceContainer>(oldScheme?.Accent, CurrentScheme.Accent));
     OnManagedResourcesChanged(null,
         new ChangedEventArgs<IKeyedResourceContainer>(oldScheme?.Theme, CurrentScheme.Theme));
 }
 /// <summary>
 /// Sets up the Table to work with the specified layer
 /// </summary>
 /// <param name="layer"></param>
 public void Initialize(IRasterLayer layer)
 {
     _originalLayer = layer;
     _newLayer = layer.Copy();
     _symbolizer = layer.Symbolizer;
     _newScheme = _symbolizer.Scheme;
     _originalScheme = (IColorScheme)_symbolizer.Scheme.Clone();
     _raster = layer.DataSet;
     GetSettings();
 }
示例#39
0
 public ColorScheme(IColorScheme colorScheme)
     : this(colorScheme.DisplayName, colorScheme.Base, colorScheme.Theme, colorScheme.Accent)
 {
     ThrowHelper.IfNullThenThrow(() => colorScheme);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ColorCategoryCollection"/> class.
 /// </summary>
 /// <param name="scheme">The scheme to use ofr this collection.</param>
 public ColorCategoryCollection(IColorScheme scheme)
     : this()
 {
     _scheme = scheme;
 }
 public IParameterEditor Make(IColorScheme scheme)
 {
     return(new DefaultDynamicEnumEditor(scheme));
 }