Ejemplo n.º 1
0
        public void MudarTema()
        {
            BrushConverter conv = new BrushConverter();

            System.Windows.Media.Color cor    = new System.Windows.Media.Color();
            SolidColorBrush            brush2 = null;
            SolidColorBrush            brush  = null;

            if (CorTema != null)
            {
                brush  = conv.ConvertFromString(CorTema) as SolidColorBrush;
                brush2 = conv.ConvertFromString(ReduzirTonalidade(CorTema)) as SolidColorBrush;
                cor    = brush.Color;
            }
            if (TextoFonte != null)
            {
                FontFamily fonte = new FontFamily(TextoFonte);
                Application.Current.Resources["fonteFamilia"] = fonte;
            }

            if (TextoTamanho != 0)
            {
                Application.Current.Resources["FonteTamanho"] = TextoTamanho;
            }

            if (CorTema != "" && CorTema != null)
            {
                Application.Current.Resources["PadraoBackGround"] = brush;
                Application.Current.Resources["PadraoColor"]      = cor;
                cor = brush2.Color;
                Application.Current.Resources["PadraoColor2"]      = cor;
                Application.Current.Resources["PadraoBackGround2"] = brush2;
            }

            if (CorTexto != "" && CorTexto != null)
            {
                brush = conv.ConvertFromString(CorTexto) as SolidColorBrush;
                Application.Current.Resources["PadraoTexto"] = brush;
            }
            //App.Current.Resources.Source = new Uri("Resources/DictionaryResources.xaml", UriKind.Relative);


            Uri langDictUri = new Uri("Resources/DictionaryResources.xaml", UriKind.Relative);
            var langDict    = Application.LoadComponent(langDictUri) as ResourceDictionary;

            //Application.Current.Resources["PadraoBackGround"] = Brushes.White;
            Application.Current.Resources.MergedDictionaries.Clear();
            Application.Current.Resources.MergedDictionaries.Add(langDict);

            GravarTemanoArquivo();
        }
Ejemplo n.º 2
0
        private void ReadFromXMLorSetDefault()
        {
            NameValueCollection allAppSettings = ConfigurationManager.AppSettings;

            var    bc           = new BrushConverter();
            string msgException = string.Empty;

            try
            {
                BackColor = (Brush)bc.ConvertFromString(allAppSettings["BackColor"]);
            } catch (Exception)
            {
                BackColor     = (Brush)bc.ConvertFromString(Colors.AliceBlue.ToString());
                msgException += "Цвет фона задан не верно: " + allAppSettings["BackColor"] + Environment.NewLine;
            }
            try
            {
                TextColor = (Brush)bc.ConvertFromString(allAppSettings["TextColor"]);
            }
            catch (Exception)
            {
                TextColor     = (Brush)bc.ConvertFromString(Colors.Black.ToString());
                msgException += "Цвет текста задан не верно: " + allAppSettings["TextColor"] + Environment.NewLine;
            }

            try
            {
                TextSize = int.Parse(allAppSettings["TextSize"]);
            }
            catch (Exception)
            {
                TextSize      = 12;
                msgException += "Размер текста задан не верно: " + allAppSettings["TextSize"] + Environment.NewLine;
            }

            try
            {
                TextFont = new FontFamily(allAppSettings["TextFont"]);
            }
            catch (Exception)
            {
                TextFont = new FontFamily("Segoe UI");
            }


            if (!string.IsNullOrEmpty(msgException))
            {
                MessageBox.Show(msgException);
            }
        }
Ejemplo n.º 3
0
        private void okService(object sender, TextChangedEventArgs e)
        {
            if (serviceBox.Text == "OK")
            {
                serviceBox.Background = Brushes.Green;
                serviceBox.Foreground = converter.ConvertFromString(textColor) as Brush;
            }

            else if (serviceBox.Text != "test")
            {
                serviceBox.Foreground = converter.ConvertFromString(textColor) as Brush;
                serviceBox.Background = Brushes.Red;
            }
        }
Ejemplo n.º 4
0
        public RecordCollection(List <Bar> barvalues)
        {
            SolidColorBrush myBrush = new SolidColorBrush();
            BrushConverter  conv    = new BrushConverter();

            foreach (Bar barval in barvalues)
            {
                if (barval.BarName == "Debit")
                {
                    myBrush = conv.ConvertFromString("#FF69C774") as SolidColorBrush;
                }
                else if (barval.BarName == "Credit")
                {
                    myBrush = conv.ConvertFromString("#FFFF6969") as SolidColorBrush;
                }
                else if (barval.BarName == "Bank" || barval.BarName == "Customer")
                {
                    myBrush = conv.ConvertFromString("#FFFF9600") as SolidColorBrush;
                }
                else if (barval.BarName == "Product")
                {
                    DataRow results = (from m in MainWindow.dtblColor.AsEnumerable()
                                       where m.Field <string>("Item") == "Product"
                                       select m).FirstOrDefault();
                    myBrush = (results[1].ToString() == "Asset") ? conv.ConvertFromString("#FFFF9600") as SolidColorBrush : conv.ConvertFromString("#FF00C4D9") as SolidColorBrush;
                }
                else if (barval.BarName == "Party Balance")
                {
                    DataRow results = (from m in MainWindow.dtblColor.AsEnumerable()
                                       where m.Field <string>("Item") == "Party Balance"
                                       select m).FirstOrDefault();
                    myBrush = (results[1].ToString() == "Asset") ? conv.ConvertFromString("#FFFF9600") as SolidColorBrush : conv.ConvertFromString("#FFDA0077") as SolidColorBrush;
                }
                else if (barval.BarName == "Supplier")
                {
                    myBrush = conv.ConvertFromString("#FFDA0077") as SolidColorBrush;
                }
                else if (barval.BarName == "Sales")
                {
                    myBrush = conv.ConvertFromString("#FF5AB401") as SolidColorBrush;
                }
                else if (barval.BarName == "Purchase" || barval.BarName == "Pay Roll")
                {
                    myBrush = conv.ConvertFromString("#FF8A00D1") as SolidColorBrush;
                }
                else if (barval.BarName == "Finance")
                {
                    DataRow results = (from m in MainWindow.dtblColor.AsEnumerable()
                                       where m.Field <string>("Item") == "Profit and Loss"
                                       select m).FirstOrDefault();
                    myBrush = (results[1].ToString() == "Loss") ? conv.ConvertFromString("#FFE60101") as SolidColorBrush : conv.ConvertFromString("#FF008BF4") as SolidColorBrush;
                }
                Add(new Record(barval.Value, myBrush, barval.BarName));
            }
        }
Ejemplo n.º 5
0
        private bool SetBuildSetpState(Label step, Setp_state state)
        {
            if (step == null)
            {
                return(false);
            }
            BrushConverter brushConverter = new BrushConverter();

            if (state == Setp_state.Ready)
            {
                step.Background = (Brush)brushConverter.ConvertFromString("#00000000");
                step.Foreground = (Brush)brushConverter.ConvertFromString("#44444444");
            }
            else if (state == Setp_state.Processing)
            {
                step.Background = (Brush)brushConverter.ConvertFromString("#99999999");
                step.Foreground = (Brush)brushConverter.ConvertFromString("#ffffffff");
            }
            else if (state == Setp_state.Succeeded)
            {
                step.Background = (Brush)brushConverter.ConvertFromString("#FF4AA2EA");
                step.Foreground = (Brush)brushConverter.ConvertFromString("#ffffffff");
            }
            else if (state == Setp_state.Failed)
            {
                step.Background = (Brush)brushConverter.ConvertFromString("#ffFF0000");
                step.Foreground = (Brush)brushConverter.ConvertFromString("#ffffffff");
            }
            return(true);
        }
Ejemplo n.º 6
0
        private void ReadNodeStyles(IPropertySetModule <NodeStyle> module)
        {
            var count = myReader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                var style = new NodeStyle(myReader.ReadString());
                style.BorderColor = (Brush)myBrushConverter.ConvertFromString(myReader.ReadString());
                style.FillColor   = (Brush)myBrushConverter.ConvertFromString(myReader.ReadString());
                style.Shape       = myReader.ReadString();
                style.Style       = myReader.ReadString();
                module.Add(style);
            }
        }
Ejemplo n.º 7
0
        private void ReadFromRegistry()
        {
            var    bc = new BrushConverter();
            string messageException = string.Empty;

            try
            {
                BackColor = (Brush)bc.ConvertFromString(myKey.GetValue("BackColor").ToString());
            }
            catch (Exception)
            {
                BackColor         = (Brush)bc.ConvertFromString(Colors.AliceBlue.ToString());
                messageException += "Цвет фона задан не верно: " + myKey.GetValue("BackColor") + Environment.NewLine;
            }

            try
            {
                TextColor = (Brush)bc.ConvertFromString(myKey.GetValue("TextColor").ToString());
            }
            catch (Exception)
            {
                TextColor         = (Brush)bc.ConvertFromString(Colors.Black.ToString());
                messageException += "Цвет текста задан не верно: " + myKey.GetValue("TextColor") + Environment.NewLine;
            }

            try
            {
                TextSize = Convert.ToInt32(myKey.GetValue("TextSize"));
            }
            catch (Exception)
            {
                TextSize          = 12;
                messageException += "Размер текста задан не верно: " + myKey.GetValue("TextSize") + Environment.NewLine;
            }

            try
            {
                TextFont = new FontFamily(myKey.GetValue("TextFont").ToString());
            }
            catch (Exception)
            {
                TextFont = new FontFamily("Segoe UI");
            }

            if (!string.IsNullOrEmpty(messageException))
            {
                MessageBox.Show(messageException);
            }
        }
Ejemplo n.º 8
0
        public Theme(string mainBrush, string hightlightBrush, string backgroundBrush)
        {
            var brushConverter = new BrushConverter();

            MainBrush                  = (Brush)brushConverter.ConvertFromString(mainBrush);
            MainBrush40Percent         = (Brush)brushConverter.ConvertFromString(mainBrush);
            MainBrush40Percent.Opacity = 0.4;

            HighlightBrush                  = (Brush)brushConverter.ConvertFromString(hightlightBrush);
            HighlightBrush40Percent         = (Brush)brushConverter.ConvertFromString(hightlightBrush);
            HighlightBrush40Percent.Opacity = 0.4;

            Background         = (Brush)brushConverter.ConvertFromString(backgroundBrush);
            Background.Opacity = 0.8;
        }
        private void MakeDarkTheme()
        {
            var converter = new BrushConverter();

            if (App.Settings.settings.dark_mode)
            {
                Background = (Brush)converter.ConvertFromString("#FF171717");
                (browseBTN.Content as System.Windows.Controls.Border).BorderBrush = (Brush)converter.ConvertFromString("#FFFFFFFF");
            }
            else
            {
                Background = (Brush)converter.ConvertFromString("#FFFFFFFF");
                (browseBTN.Content as System.Windows.Controls.Border).BorderBrush = (Brush)converter.ConvertFromString("#FF171717");
            }
        }
Ejemplo n.º 10
0
        private void TogglePlotUpdateIndicator()
        {
            const string blueBrush = "#FF0000FF";
            const string limeBrush = "#FF00FF00";
            var          converter = new BrushConverter();

            if (Convert.ToString(labelPlotUpdate.Background) == blueBrush)
            {
                labelPlotUpdate.Background = (Brush)converter.ConvertFromString(limeBrush);
            }
            else
            {
                labelPlotUpdate.Background = (Brush)converter.ConvertFromString(blueBrush);
            }
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     try
     {
         return(brushConverter.ConvertFromString((string)value));
     }
     catch (FormatException)
     {
         try
         {
             return(brushConverter.ConvertFromString("#" + (string)value));
         }
         catch (FormatException) { return(Brushes.Transparent); }
     }
 }
        //private void RunSetup1()
        //{
        //    // create Powershell runspace
        //    var runSpace = RunspaceFactory.CreateRunspace();
        //    // open it
        //    runSpace.Open();

        //    //var script = @"Get-ChildItem c:\ -recurse | Out-String -stream";
        //    //var script = @"Get-Process | Where-Object {$_.MainWindowTitle -ne ''} |Select-Object MainWindowTitle | Out-String -stream";
        //    var script = "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force";
        //    script+="\r\n.\\epmliveSilentInstaller.ps1 -deployGAC -deployCOM -deployTimer -deployPFE -deploySolutions -inUsername 'administrator' -comUsername 'administrator' -inPassword '9DpsF%3C.&f' -webAppName 'http://*****:*****@"cd SilentInstaller_6.3.3.8
        //    //Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
        //    //    .\epmliveSilentInstaller.ps1 -deployGAC -deployCOM -deployTimer -deployPFE -deploySolutions -inUsername '*****@*****.**' -comUsername 'social\administrator' -inPassword '9DpsF%3C.&f' -webAppName 'http://sp2016:29929/'";

        //    DispatcherISyncInvoke dis = new DispatcherISyncInvoke(this.Dispatcher);

        //    pipelineExecutor = new PipelineExecutor(runSpace, dis, script);
        //    pipelineExecutor.OnDataReady += new PipelineExecutor.DataReadyDelegate(pipelineExecutor_OnDataReady);
        //    pipelineExecutor.OnDataEnd += new PipelineExecutor.DataEndDelegate(pipelineExecutor_OnDataEnd);
        //    pipelineExecutor.OnErrorReady += new PipelineExecutor.ErrorReadyDelegate(pipelineExecutor_OnErrorReady);
        //    pipelineExecutor.Start();

        //    //pipelineExecutor = new PipelineExecutor(runSpace, dis, script);
        //    //pipelineExecutor.Start();



        //}

        private void btnOutput_Click(object sender, RoutedEventArgs e)
        {
            var label          = (Button)sender;
            var brushConverter = new BrushConverter();
            var defaultBrush   = brushConverter.ConvertFromString("#FFFFFF") as Brush;

            //outputTasks.Visibility = _collapsed;
            outputVerbose.Visibility  = _collapsed;
            outputErrors.Visibility   = _collapsed;
            outputWarnings.Visibility = _collapsed;

            //lblOutputHide.FontWeight = FontWeights.Normal;
            //borderOutputHide.BorderBrush = defaultBrush;
            lblOutputVerbose.FontWeight      = FontWeights.Normal;
            borderOutputVerbose.BorderBrush  = defaultBrush;
            lblOutputErrors.FontWeight       = FontWeights.Normal;
            borderOutputErrors.BorderBrush   = defaultBrush;
            lblOutputWarnings.FontWeight     = FontWeights.Normal;
            borderOutputWarnings.BorderBrush = defaultBrush;

            switch (label.Name)
            {
            case "btnOutputVerbose":
                lblOutputVerbose.FontWeight     = FontWeights.Bold;
                borderOutputVerbose.BorderBrush = brushConverter.ConvertFromString("#666666") as Brush;
                outputVerbose.Visibility        = _visible;
                break;

            case "btnOutputErrors":
                lblOutputErrors.FontWeight     = FontWeights.Bold;
                borderOutputErrors.BorderBrush = brushConverter.ConvertFromString("#d30000") as Brush;
                outputErrors.Visibility        = _visible;
                break;

            case "btnOutputWarnings":
                lblOutputWarnings.FontWeight     = FontWeights.Bold;
                borderOutputWarnings.BorderBrush = brushConverter.ConvertFromString("#d3a400") as Brush;
                outputWarnings.Visibility        = _visible;
                break;

            case "btnOutputHide":
            default:
                // lblOutputHide.FontWeight = FontWeights.Bold;
                //borderOutputHide.BorderBrush = brushConverter.ConvertFromString("#666666") as Brush;
                //outputTasks.Visibility = _visible;
                break;
            }
        }
Ejemplo n.º 13
0
 //TODO: load RP from txtfile
 public static void AddDefault()
 {
     new RP("F18-FDG", "FDG", (Brush)converter.ConvertFromString("#579BFF"));
     new RP("F18-PSMA", "PSMA", (Brush)converter.ConvertFromString("#FF57C4"), 90f);
     new RP("C11-Acetate", "ACT", (Brush)converter.ConvertFromString("#FF5757"));
     new RP("C11-PIB", "PIB", (Brush)converter.ConvertFromString("#71FF57"));
     new RP("F18-FLDOPA", "DOPA", (Brush)converter.ConvertFromString("#57FFF9"));
     new RP("Ga68-Dotatate", "DOT", (Brush)converter.ConvertFromString("#FFFC57"));
     new RP("C11-Methaio-nine", "METH", (Brush)converter.ConvertFromString("#FFBA57"));
     new RP("Ga68-PSMA", "PSMA", (Brush)converter.ConvertFromString("#FF57C4"));
     new RP("Others", "OTHR", (Brush)converter.ConvertFromString("#858585"));
 }
        public static Brush ParseColor(string code)
        {
            string parse;

            if (UnturnedColors.TryGetValue(code, out string ucolor))
            {
                parse = ucolor;
            }
            else if (UnityColors.TryGetValue(code, out string uncolor))
            {
                parse = uncolor;
            }
            else
            {
                parse = code;
            }

            try
            {
                return(converter.ConvertFromString(parse) as Brush);
            }
            catch
            {
                return(Brushes.Transparent);
            }
        }
Ejemplo n.º 15
0
        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                // get brush from runtime property info
                if (value is PropertyInfo)
                {
                    // create converter
                    BrushConverter converter = new BrushConverter();

                    // convert neme to brush
                    Brush selectedBrush = (Brush)converter.ConvertFromString(((PropertyInfo)value).Name.ToString());

                    // get brush
                    return(selectedBrush);
                }
                else
                {
                    // return black
                    return(Brushes.Black);
                }
            }
            catch (Exception e)
            {
                // display
                //Console.WriteLine("Exception caught converting property info: {0}", e.Message);

                // return black
                return(Brushes.Black);
            }
        }
Ejemplo n.º 16
0
        private static Inline BuildFont(ElementToken token, Hint hint)
        {
            var span = new Span();

            if (token.Attributes.TryGetValue("size", out var size))
            {
                var fc = new FontSizeConverter();
                var sz = (double)fc.ConvertFromString(size);
                span.FontSize = sz;
            }

            if (token.Attributes.TryGetValue("face", out var face))
            {
                span.FontFamily = new FontFamily(face);
            }

            if (token.Attributes.TryGetValue("color", out var color))
            {
                var bc = new BrushConverter();
                var br = (Brush)bc.ConvertFromString(color);
                span.Foreground = br;
            }

            return(span.Fill(token, hint));
        }
Ejemplo n.º 17
0
        private MsgBox()
        {
            this.Topmost = true;

            this.Width  = Screen.PrimaryScreen.Bounds.Width * 0.625;
            this.Height = this.Width * ((double)2 / 3);

            ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Resources\Images";

            widthBtn  = 256;
            heightBtn = 64;

            if (Screen.PrimaryScreen.Bounds.Width * 0.625 < 832)
            {
                widthBtn = (int)Math.Round(Screen.PrimaryScreen.Bounds.Width * 0.625 - 24 - 40) / 3;
            }

            gridHeight = (this.Height - this.Height * 0.15 - 12);

            if (gridHeight * 0.2 < 88)
            {
                heightBtn = (int)Math.Round(gridHeight * 0.2 - 24);
            }

            BrushConverter bc = new BrushConverter();

            erreurColor        = new SolidColorBrush(Colors.DarkRed);
            avertissementColor = (Brush)bc.ConvertFromString("#FF9800");
            validationColor    = new SolidColorBrush(Colors.DarkGreen);

            InitializeComponent();
        }
Ejemplo n.º 18
0
        public void GenresLoaded(object sender, RoutedEventArgs e)
        {
            var   converter = new BrushConverter();
            Brush colour    = (Brush)converter.ConvertFromString(Settings.Default.genrecolour);

            UpdateGenreColours(colour);
        }
        public CellBorderConverter()
        {
            var converter = new BrushConverter();

            inQueueBrush    = new SolidColorBrush(Colors.SteelBlue);
            notInQueueBrush = (SolidColorBrush)converter.ConvertFromString("#FF2C2323");
        }
Ejemplo n.º 20
0
        private void TextBoxTextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox box   = sender as TextBox;
            var     brush = (Brush)converter.ConvertFromString("#000000");

            box.Foreground = brush;
        }
Ejemplo n.º 21
0
        public MainWindow()
        {
            InitializeComponent();
            BrushConverter brushConverter = new BrushConverter();

            def = (brushConverter.ConvertFromString("#FFABADB3") as SolidColorBrush);
        }
Ejemplo n.º 22
0
        public void RadioButton1_Checked(object sender, RoutedEventArgs e)
        {
            var converter = new BrushConverter();
            var azaz1     = (Brush)converter.ConvertFromString("#191970");

            Background = azaz1;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// The ToBrush
        /// </summary>
        /// <param name="htmlColor">The htmlColor<see cref="string" /></param>
        /// <returns>The <see cref="Brush" /></returns>
        public static Brush ToBrush(this string htmlColor)
        {
            var brushConverter = new BrushConverter();
            var brush          = (Brush)brushConverter.ConvertFromString(htmlColor);

            return(brush);
        }
Ejemplo n.º 24
0
        private void PauseFigure()
        {
            System.Windows.Shapes.Path playPath = new System.Windows.Shapes.Path();
            playPath.Data           = Geometry.Parse("F1 M 352.001,191.751L 352.001,207.585");
            playPath.Width          = 8;
            playPath.Height         = 10;
            playPath.Stretch        = Stretch.Fill;
            playPath.StrokeLineJoin = PenLineJoin.Round;
            BrushConverter brushCv = new BrushConverter();

            playPath.Fill = (Brush)brushCv.ConvertFromString("#FF000000");

            System.Windows.Shapes.Path playPath2 = new System.Windows.Shapes.Path();
            playPath2.Data           = Geometry.Parse("F1 M 352.001,191.751L 352.001,207.585");
            playPath2.Width          = 8;
            playPath2.Height         = 10;
            playPath2.Stretch        = Stretch.Fill;
            playPath2.StrokeLineJoin = PenLineJoin.Round;
            BrushConverter brushCv2 = new BrushConverter();

            playPath2.Fill = (Brush)brushCv2.ConvertFromString("#FF000000");

            StackPanel sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;
            sp.Children.Add(playPath);
            sp.Children.Add(playPath2);

            ButtonPlayPause.Content = sp;
        }
Ejemplo n.º 25
0
        private void ellipse_DragEnter(object sender, DragEventArgs e)
        {
            Ellipse ellipse = sender as Ellipse;

            if (ellipse != null)
            {
                // Save the current Fill brush so that you can revert back to this value in DragLeave.
                _previousFill = ellipse.Fill;

                //Console.WriteLine((e.Data.GetData(typeof(Ellipse)) as Ellipse).Fill.ToString());
                // If the DataObject contains string data, extract it.
                if (e.Data.GetDataPresent(DataFormats.StringFormat))
                {
                    string dataString = (string)e.Data.GetData(DataFormats.StringFormat);

                    // If the string can be converted into a Brush, convert it.
                    BrushConverter converter = new BrushConverter();
                    if (converter.IsValid(dataString))
                    {
                        Brush newFill = (Brush)converter.ConvertFromString(dataString);
                        ellipse.Fill = newFill;
                    }
                }
            }
        }
Ejemplo n.º 26
0
        public List<Figures> CreateCube()
        {
            List<Figures> figures = new List<Figures>();
            var dottedLine = new DoubleCollection() { 3 };
            var Line = new DoubleCollection() { 100 };
            BrushConverter brush = new BrushConverter();
            Brush colorBrush;

            colorBrush = brush.ConvertFromString("#DCE1E4") as Brush;

            figures.Add(CreateLine(100, 305, 70, 70, "D1", new Thickness(70, 10, 0, 0), Line, colorBrush, "D1C1", 0)); // D1 C1
            figures.Add(CreateLine(100, 100, -2, 190, "D", new Thickness(85, 190, 0, 0), dottedLine, colorBrush, "D1D", 1)); // D1 D
            figures.Add(CreateLine(305, 100, -50, -50, "C", new Thickness(290, -50, 0, 0), dottedLine, colorBrush, "D1DC", 2)); //DC
            figures.Add(CreateLine(305, 305, -245, -50, "C1", new Thickness(290, -300, 0, 0), Line, colorBrush, "CC1", 3)); // C C1
            figures.Add(CreateLine(100, 30, -50, 10, "A", new Thickness(0, 0, 0, 0), dottedLine, colorBrush, "DA", 4)); // DA
            figures.Add(CreateLine(240, 305, -40, -100, "B", new Thickness(240, -50, 0, 0), Line, colorBrush, "BC", 5)); // BC
            figures.Add(CreateLine(30, 240, -40, -40, "B", new Thickness(240, -50, 0, 0), Line, colorBrush, "AB", 6)); // AB
            figures.Add(CreateLine(30, 30, -40, -245, "A1", new Thickness(0, -300, 0, 0), Line, colorBrush, "AA1", 7)); // A A1
            figures.Add(CreateLine(30, 100, -245, -295, "A1", new Thickness(0, -300, 0, 0), Line, colorBrush, "A1D1", 8)); // A1 D1
            figures.Add(CreateLine(30, 240, -245, -245, "B1", new Thickness(210, -300, 0, 0), Line, colorBrush, "A1B1", 9)); // A1 B1
            figures.Add(CreateLine(240, 240, -245, -40, "B1", new Thickness(210, -300, 0, 0), Line, colorBrush, "BB1", 10)); // B B1
            figures.Add(CreateLine(240, 305, -245, -295, "B1", new Thickness(210, -300, 0, 0), Line, colorBrush, "B1C1", 11)); // B1 C1


            return figures;
        }
Ejemplo n.º 27
0
        public static TextRange Color(this TextRange range, string color)
        {
            BrushConverter bc = new BrushConverter();

            range.ApplyPropertyValue(TextElement.ForegroundProperty, bc.ConvertFromString(color));
            return(range);
        }
Ejemplo n.º 28
0
        private void btnHexToRGB_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var hexColor      = tbHexColor.Text.Trim();
                var hexColorRed   = hexColor.Substring(0, 2);
                var hexColorGreen = hexColor.Substring(2, 2);
                var hexColorBlue  = hexColor.Substring(4, 2);

                var redColor   = Convert.ToInt32(hexColorRed, 16);
                var greenColor = Convert.ToInt32(hexColorGreen, 16);
                var blueColor  = Convert.ToInt32(hexColorBlue, 16);

                tbRed.Text   = redColor.ToString();
                tbGreen.Text = greenColor.ToString();
                tbBlue.Text  = blueColor.ToString();

                BrushConverter brushConverter = new BrushConverter();

                borderColor.BorderBrush = (Brush)brushConverter.ConvertFromString("#" + hexColor);
            }
            catch (Exception)
            {
                MessageBox.Show("请输入正确的值");
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 将读取到的配置转换为brush类型
        /// </summary>
        /// <param name="fir"></param>
        /// <param name="sec"></param>
        /// <returns></returns>
        public Brush read_brush(string fir, string sec)
        {
            BrushConverter brush = new BrushConverter();
            Brush          color = (Brush)brush.ConvertFromString(read(fir, sec));

            return(color);
        }
Ejemplo n.º 30
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BrushConverter brushConverter = new BrushConverter();
            Brush          brush          = (Brush)brushConverter.ConvertFromString(value.ToString());

            return(brush);
        }