本文整理汇总了C#中System.Windows.Media.SolidColorBrush类的典型用法代码示例。如果您正苦于以下问题:C# SolidColorBrush类的具体用法?C# SolidColorBrush怎么用?C# SolidColorBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SolidColorBrush类属于System.Windows.Media命名空间,在下文中一共展示了SolidColorBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PkgCreateWin
public PkgCreateWin()
{
InitializeComponent();
EnabledColor = SnapshotBtn.Foreground;
DisabledColor = new SolidColorBrush(System.Windows.Media.Colors.LightGray);
SetUiMode(UiMode.WaitingForFile);
}
示例2: Create
public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh)
{
try
{
Uri inpuri = new Uri(@pictureName, UriKind.Relative);
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = inpuri;
bi.EndInit();
ImageBrush imagebrush = new ImageBrush(bi);
imagebrush.Opacity = 100;
imagebrush.Freeze();
Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) };
Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) };
SolidColorBrush modelbrush = new SolidColorBrush(modelColor);
Model3DGroup cube = new Model3DGroup();
Point3D uppercircle = startPos;
modelbrush.Freeze();
uppercircle.Y = startPos.Y + maxHigh;
cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0)));
cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0)));
cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0));
return cube;
}
catch (Exception ex)
{
throw ex;
}
}
示例3: WatchViewFullscreen
public WatchViewFullscreen()
{
InitializeComponent();
MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseRightButtonUp);
PreviewMouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_PreviewMouseRightButtonDown);
MenuItem mi = new MenuItem();
mi.Header = "Zoom to Fit";
mi.Click += new RoutedEventHandler(mi_Click);
MainContextMenu.Items.Add(mi);
System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle();
Canvas.SetZIndex(backgroundRect, -10);
backgroundRect.IsHitTestVisible = false;
BrushConverter bc = new BrushConverter();
Brush strokeBrush = (Brush)bc.ConvertFrom("#313131");
backgroundRect.Stroke = strokeBrush;
backgroundRect.StrokeThickness = 1;
SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216));
backgroundRect.Fill = backgroundBrush;
inputGrid.Children.Add(backgroundRect);
}
示例4: WorkshopViewModelBase
protected WorkshopViewModelBase()
{
if (IsInDesignModeStatic)
{
Head = "X:123, Y:456, Z:7890";
Neck = "X:123, Y:456, Z:7890";
LeftShoulder = "X:123, Y:456, Z:7890";
RightShoulder = "X:123, Y:456, Z:7890";
Torso = "X:123, Y:456, Z:7890";
LeftElbow = "X:123, Y:456, Z:7890";
RightElbow = "X:123, Y:456, Z:7890";
LeftHand = "X:123, Y:456, Z:7890";
RightHand = "X:123, Y:456, Z:7890";
LeftHand = "X:123, Y:456, Z:7890";
RightHand = "X:123, Y:456, Z:7890";
LeftHip = "X:123, Y:456, Z:7890";
RightHip = "X:123, Y:456, Z:7890";
LeftKnee = "X:123, Y:456, Z:7890";
RightKnee = "X:123, Y:456, Z:7890";
LeftFoot = "X:123, Y:456, Z:7890";
RightFoot = "X:123, Y:456, Z:7890";
}
else
{
Kinect = MyKinect.Instance;
PointerColor = new SolidColorBrush(Color.FromRgb(139, 0, 0));
Messages = new ObservableCollection<string>();
Start = new RelayCommand<RoutedEventArgs>(e => SafeStartKinect());
Stop = new RelayCommand<RoutedEventArgs>(e => SafeStopKinect());
}
}
示例5: PageHeader
public PageHeader()
{
Brush brush = new SolidColorBrush(Colors.DarkGray);
brush.Opacity = 0.60;
this.Background = brush;
Border frameBorder = new Border();
frameBorder.BorderBrush = Brushes.Gray;
frameBorder.BorderThickness = new Thickness(2);
DockPanel panelMain = new DockPanel();
panelMain.Margin = new Thickness(5, 5, 5, 5);
panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
txtText = new TextBlock();
txtText.FontSize = 32;
txtText.Margin = new Thickness(5, 0, 0, 0);
txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
panelMain.Children.Add(txtText);
frameBorder.Child = panelMain;
this.Content = frameBorder;
}
示例6: ActivateStack
public void ActivateStack()
{
SolidColorBrush scb = new SolidColorBrush(Colors.Black);
r_TileRect.Fill = scb;
c_StackCanvas.IsHitTestVisible = true;
c_StackCanvas.IsEnabled = true;
c_StackCanvas.Background = scb;
c_StackCanvas.BeginAnimation(Canvas.HeightProperty, a_Open);
c_StackCanvas.BeginAnimation(Canvas.WidthProperty, a_OpenW);
int posX = xBuff;
int posY = 40;
foreach (StackItem si in si_StackItems)
{
Canvas.SetLeft(si, posX);
Canvas.SetTop(si, posY);
c_StackCanvas.Children.Add(si);
posX += siWidth;
if (posX > 300)
{
posX = xBuff;
posY += siHeight;
}
}
b_isOpened = true;
l_StackPath.IsEnabled = true;
l_StackPath.Visibility = Visibility.Visible;
l_DecoStack.IsEnabled = true;
l_DecoStack.Visibility = Visibility.Visible;
}
示例7: BackgroundSetThroughCode
public void BackgroundSetThroughCode()
{
GridSplitter splitter = new GridSplitter();
Brush b = new SolidColorBrush(Colors.Black);
splitter.Background = b;
Assert.AreEqual(b, splitter.GetValue(GridSplitter.BackgroundProperty), "Setting Background property should set backing dependency property.");
}
示例8: Brique
//Constructeur
public Brique(Grid parent, double posX, double posY, bool cassable)
{
//Création de l'ellipse
this._forme = new Rectangle();
//Ajout au parent
parent.Children.Add(this._forme);
//Taille de la Brique
this._forme.Height = 20;
this._forme.Width = 60;
//Position de la Brique
this._forme.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
this._forme.VerticalAlignment = System.Windows.VerticalAlignment.Top;
this._forme.Margin = new System.Windows.Thickness(posX, posY, 0, 0);
this.Cassable = cassable;
//Couleur de la Brique
//Couleur de fond
Thread.Sleep(1);
Random R = new Random(unchecked((int)DateTime.Now.Ticks));
SolidColorBrush couleurFond = new SolidColorBrush();
byte Red = (byte)(R.Next(253) + 1);
byte Green = (byte)(R.Next(253) + 1);
byte Blue = (byte)(R.Next(253) + 1);
//Noire si incassable
couleurFond.Color = cassable ? Color.FromRgb(Red, Green, Blue) : Color.FromRgb(0, 0, 0);
this._forme.Fill = couleurFond;
//Couleur de bordure
SolidColorBrush couleurBord = new SolidColorBrush();
couleurBord.Color = Color.FromRgb(255, 255, 255);
this._forme.Stroke = couleurBord;
}
示例9: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SolidColorBrush brush = new SolidColorBrush(Colors.Red);
if ((bool)value)
brush = new SolidColorBrush(Colors.Black);
return brush;
}
示例10: ProvideValue
public override object ProvideValue(IServiceProvider serviceProvider)
{
SolidColorBrush brush = new SolidColorBrush(GetColor());
brush.Freeze();
return brush;
}
示例11: CheckPostalCode
private void CheckPostalCode()
{
if (appSettings.PostalCodeSetting == "")
{
PostalCodeSet.Text = "*Required";
SolidColorBrush Brush1 = new SolidColorBrush();
Brush1.Color = Colors.Red;
PostalCodeSet.Foreground = Brush1;
ValidPC.Visibility = System.Windows.Visibility.Collapsed;
IsValidPC.Visibility = System.Windows.Visibility.Collapsed;
}
else if (!IsPostalCode(appSettings.PostalCodeSetting))
{
SolidColorBrush Brush1 = new SolidColorBrush();
Brush1.Color = Colors.Red;
PostalCodeSet.Foreground = Brush1;
PostalCodeSet.Text = appSettings.PostalCodeSetting;
ValidPC.Visibility = System.Windows.Visibility.Visible;
}
else
{
PostalCodeSet.Text = appSettings.PostalCodeSetting;
SolidColorBrush Brush1 = new SolidColorBrush();
Brush1.Color = Colors.Green;
PostalCodeSet.Foreground = Brush1;
ValidPC.Visibility = System.Windows.Visibility.Collapsed;
IsValidPC.Visibility = System.Windows.Visibility.Collapsed;
}
}
示例12: Cabecera
public Cabecera()
{
Background = new SolidColorBrush(Colors.White);
Orientation = Orientation.Vertical;
var nombreJuego = new TextBlock { Text = "Tres en Línea", FontSize = 78, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center};
Children.Add(nombreJuego);
var nuevoJuego = new Button {Content = "Iniciar nuevo Juego", Background = new SolidColorBrush(Colors.Black)};
nuevoJuego.Tap += nuevoJuego_Tap;
Children.Add(nuevoJuego);
Grid resultadoGrid = new Grid{Background = new SolidColorBrush(Colors.White), ShowGridLines = false};
resultadoGrid.ColumnDefinitions.Add(new ColumnDefinition());
resultadoGrid.ColumnDefinitions.Add(new ColumnDefinition{Width = new GridLength(2, GridUnitType.Star)});
resultadoGrid.RowDefinitions.Add(new RowDefinition());
var labelResultado = new TextBlock { Text = "Resultado:", FontSize = 22, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
resultadoGrid.Children.Add(labelResultado);
Grid.SetColumn(labelResultado, 0);
resultado = new TextBlock { Text = "En proceso.", FontSize = 22, Foreground = new SolidColorBrush(Colors.Black), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
resultadoGrid.Children.Add(resultado);
Grid.SetColumn(resultado, 1);
Children.Add(resultadoGrid);
}
示例13: BottomMargin
public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
{
_textView = textView;
_classifier = classifier.GetClassifier(textView.TextBuffer);
_foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));
_backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey));
this.Background = _backgroundBrush;
this.ClipToBounds = true;
_lblEncoding = new TextControl("Encoding");
this.Children.Add(_lblEncoding);
_lblContentType = new TextControl("Content type");
this.Children.Add(_lblContentType);
_lblClassification = new TextControl("Classification");
this.Children.Add(_lblClassification);
_lblSelection = new TextControl("Selection");
this.Children.Add(_lblSelection);
UpdateClassificationLabel();
UpdateContentTypeLabel();
UpdateContentSelectionLabel();
if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
{
_doc.FileActionOccurred += FileChangedOnDisk;
UpdateEncodingLabel(_doc);
}
textView.Caret.PositionChanged += CaretPositionChanged;
}
示例14: for_MouseDown
private void for_MouseDown(object sender, MouseButtonEventArgs e)
{
SolidColorBrush[] brushes = new SolidColorBrush[]
{ Brushes.Green, Brushes.BurlyWood,Brushes.CadetBlue,
Brushes.Gray,Brushes.Chartreuse,Brushes.Chocolate,
Brushes.AliceBlue,Brushes.Coral,Brushes.CornflowerBlue,
Brushes.AntiqueWhite,Brushes.Cornsilk,Brushes.Crimson,
Brushes.Aqua,Brushes.Cyan,Brushes.DarkBlue,Brushes.DarkCyan,
Brushes.Aquamarine,Brushes.DarkGoldenrod,Brushes.DarkGray,
Brushes.Azure,Brushes.DarkGreen,Brushes.DarkKhaki,
Brushes.Beige,Brushes.DarkMagenta,Brushes.DarkOliveGreen,
Brushes.Bisque,Brushes.DarkOrange,Brushes.DarkOrchid,
Brushes.Black,Brushes.DarkRed,Brushes.DarkSalmon,
Brushes.BlanchedAlmond,Brushes.DarkSeaGreen,Brushes.DarkSlateBlue,
Brushes.Blue,Brushes.DarkSlateGray,Brushes.DarkTurquoise,
Brushes.BlueViolet,Brushes.Brown,Brushes.DarkViolet
};
TextBox b = new TextBox() { Text = "Label " + contC };
b.Name = "s" + contador;
b.Background = brushes[new Random().Next(brushes.Length)];
b.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
b.VerticalAlignment = System.Windows.VerticalAlignment.Top;
b.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.TextBox_PreviewMouseLeftButtonDown);
b.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.TextBox_PreviewDown);
this.workSpace.Children.Add(b);
b.Margin = new Thickness(0, 0, 0, 0);
contC++;
}
示例15: GetBrush
internal static Brush GetBrush(this ResourceDictionary dictionary, string brushName, string colorName, Brush defaultBrush)
{
if (dictionary == null)
{
return defaultBrush;
}
var obj = dictionary[brushName];
if (obj is Brush)
{
return (Brush)obj;
}
obj = dictionary[colorName];
if (obj is Color?)
{
var color = (Color?)obj;
if (color.HasValue)
{
var brush = new SolidColorBrush(color.Value);
brush.Freeze();
return brush;
}
}
return defaultBrush;
}