本文整理汇总了C#中Windows.UI.Xaml.Media.SolidColorBrush类的典型用法代码示例。如果您正苦于以下问题:C# SolidColorBrush类的具体用法?C# SolidColorBrush怎么用?C# SolidColorBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SolidColorBrush类属于Windows.UI.Xaml.Media命名空间,在下文中一共展示了SolidColorBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubredditSideBar
public SubredditSideBar()
{
this.InitializeComponent();
// Get the accent color
Color accentColor = ((SolidColorBrush)App.Current.Resources["SystemControlBackgroundAccentBrush"]).Color;
// Set the title color
Color darkAccent = accentColor;
darkAccent.A = 170;
ui_titleHeaderContainer.Background = new SolidColorBrush(darkAccent);
// Set the button container background
Color darkerAccent = accentColor;
darkerAccent.A = 90;
ui_buttonContainer.Background = new SolidColorBrush(darkerAccent);
// Set the active button background
Color buttonActive = accentColor;
buttonActive.A = 200;
m_buttonActive = new SolidColorBrush(buttonActive);
// Get the button inactive color
Color buttonAccent = accentColor;
buttonAccent.A = 90;
m_buttonInactive = new SolidColorBrush(buttonAccent);
// Set the submit link and text colors
ui_submitPostButton.Background = m_buttonInactive;
ui_searchSubreddit.Background = m_buttonInactive;
}
示例2: PerformFaceAnalysis
private async void PerformFaceAnalysis(StorageFile file)
{
var imageInfo = await FileHelper.GetImageInfoForRendering(file.Path);
NewImageSizeWidth = 300;
NewImageSizeHeight = NewImageSizeWidth*imageInfo.Item2/imageInfo.Item1;
var newSourceFile = await FileHelper.CreateCopyOfSelectedImage(file);
var uriSource = new Uri(newSourceFile.Path);
SelectedFileBitmapImage = new BitmapImage(uriSource);
// start face api detection
var faceApi = new FaceApiHelper();
DetectedFaces = await faceApi.StartFaceDetection(newSourceFile.Path, newSourceFile, imageInfo, "4c138b4d82b947beb2e2926c92d1e514");
// draw rectangles
var color = Color.FromArgb(125, 255, 0, 0);
var bg = new SolidColorBrush(color);
DetectedFacesCanvas = new ObservableCollection<Canvas>();
foreach (var detectedFace in DetectedFaces)
{
var margin = new Thickness(detectedFace.RectLeft, detectedFace.RectTop, 0, 0);
var canvas = new Canvas()
{
Background = bg,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Height = detectedFace.RectHeight,
Width = detectedFace.RectWidth,
Margin = margin
};
DetectedFacesCanvas.Add(canvas);
}
}
示例3: DrawGrid
private void DrawGrid()
{
int index = 0;
SolidColorBrush black = new SolidColorBrush(Colors.Black);
SolidColorBrush white = new SolidColorBrush(Colors.White);
// Set colors of each rectangle based on grid values
for (int r = 0; r < gridWidth; r++)
for (int c = 0; c < gridWidth; c++)
{
Rectangle rect = paintCanvas.Children[index] as Rectangle;
index++;
if (grid[r, c])
{
// On
rect.Fill = white;
rect.Stroke = black;
}
else
{
// Off
rect.Fill = black;
rect.Stroke = white;
}
}
}
示例4: init
void init()
{
Background = new SolidColorBrush(ColorHelper.FromArgb(70, 0, 0, 0));
progressbar = new ProgressBar() { IsIndeterminate =true };
Children.Add(progressbar);
}
示例5: Convert
//public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
//{
// int CURRENT_DEGREE = System.Convert.ToInt32(value);
// RadialGradientBrush gb = parameter as RadialGradientBrush;
// switch (CURRENT_DEGREE)
// {
// case 0:
// //return gb;
// RadialGradientBrush rb = new RadialGradientBrush();
// //rb.GradientStops.Add(new GradientStop() { Color = Colors.Transparent, Offset = 0 });
// return rb;
// case 1:
// foreach (GradientStop s in gb.GradientStops)
// {
// Color c = Colors.Yellow;
// c.A = s.Color.A;
// s.Color = c;
// }
// return gb;
// case 2:
// foreach (GradientStop s in gb.GradientStops)
// {
// Color c = Colors.Orange;
// c.A = s.Color.A;
// s.Color = c;
// }
// return gb;
// case 3:
// foreach (GradientStop s in gb.GradientStops)
// {
// Color c = Colors.Red;
// c.A = s.Color.A;
// s.Color = c;
// }
// return gb;
// default:
// return new RadialGradientBrush();
// }
// throw new NotImplementedException();
//}
public object Convert(object value, Type targetType, object parameter, string language)
{
int CURRENT_DEGREE = System.Convert.ToInt32(value);
// SolidColorBrush gb = parameter as SolidColorBrush;
switch (CURRENT_DEGREE)
{
case 0:
//return gb;
SolidColorBrush rb = new SolidColorBrush(Colors.Transparent);
//rb.GradientStops.Add(new GradientStop() { Color = Colors.Transparent, Offset = 0 });
return rb;
case 1:
return new SolidColorBrush(Colors.Yellow);
case 2:
return new SolidColorBrush(Colors.Orange);
case 3:
return new SolidColorBrush(Colors.Red);
default:
return new SolidColorBrush(Colors.Transparent);
}
}
示例6: ButtonGenerate_Click
private void ButtonGenerate_Click(object sender, RoutedEventArgs e)
{
// Generate points for graph
var points = new List<Point>();
for (var connectivity = 0; connectivity <= 100; connectivity += 1)
{
var possibility = .0;
for (var testNumber = 0; testNumber < TestsCount; testNumber++)
if (CheckBoxType.IsChecked != null && (!CheckBoxType.IsChecked.Value && _schedule.CheckConflict(Convert.ToInt16(SliderSize.Value), connectivity) ||
CheckBoxType.IsChecked.Value && _schedule.CheckNecessary(Convert.ToInt16(SliderSize.Value), connectivity)))
possibility++;
possibility /= TestsCount;
points.Add(new Point((int)(connectivity * CanvasGraph.RenderSize.Width * .01), (int)(CanvasGraph.RenderSize.Height - possibility * CanvasGraph.RenderSize.Height)));
}
// Draw graph
var b = new SolidColorBrush(_colors[_colorIdx++ % _colors.Count]);
for (var i = 0; i < points.Count - 1; i++)
{
var line = new Line
{
Stroke = b,
X1 = points[i].X,
X2 = points[i + 1].X,
Y1 = points[i].Y,
Y2 = points[i + 1].Y,
StrokeThickness = 2
};
CanvasGraph.Children.Add(line);
}
}
示例7: Contact
public Contact(SolidColorBrush foregroundColor, SolidColorBrush backgroundColor, bool imageMirrored = false)
{
this.InitializeComponent();
SetColors(foregroundColor, backgroundColor);
SetFooterImage(imageMirrored);
}
示例8: init
void init()
{
Background = new SolidColorBrush(Colors.Transparent);
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
_transform = new CompositeTransform() { CenterX = DeviceWidth / 2, CenterY = DeviceHeight / 2 };
RenderTransform = _transform;
_backimage = new Image() { Stretch = Stretch.UniformToFill };
Children.Add(_backimage);
//just bytes
//_blackgrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight, Background = new SolidColorBrush(Colors.Black), Opacity = 0.4 };
//Children.Add(_blackgrid);
//just bytes
//_backtext = new CoverTextSlide();
//Children.Add(_backtext);
_pagegrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight };
Children.Add(_pagegrid);
Canvas.SetZIndex(_pagegrid, -10);
//just bytes
//_loadingview = new LoadingView() { Width = 1600, Height = 900 };
//Children.Add(_loadingview);
}
示例9: AppSettings_PropertyChanged
private void AppSettings_PropertyChanged( object sender, global::System.ComponentModel.PropertyChangedEventArgs e )
{
if( e.PropertyName == Parameters.APPEARANCE_CONTENTREADER_NAVBG )
{
BackgroundBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_NAVBG );
}
}
示例10: AuthorFlairKindConverter
static AuthorFlairKindConverter()
{
if (Application.Current.Resources.ContainsKey("SystemColorControlAccentColor"))
bg_op = Application.Current.Resources["SystemColorControlAccentColor"] as SolidColorBrush;
else
bg_op = Utility.GetColorFromHexa("#FFDAA520");
}
示例11: Convert
/// <summary>
/// Convert a hexadecimal color string to a corresponding brush
/// </summary>
/// <param name="value">Value to convert</param>
/// <param name="targetType">Target type requiered</param>
/// <param name="parameter">Converter parameter</param>
/// <param name="language">language information</param>
/// <returns>The corresponding brush</returns>
public object Convert(object value,
Type targetType,
object parameter,
String language)
{
String color = ((String)value).Replace("#",
"");
Brush colorBrush = null;
if (color.Length == 6)
{
if (Brushes.ContainsKey(color))
{
return Brushes[color];
}
colorBrush = new SolidColorBrush(Color.FromArgb(255,
byte.Parse(color.Substring(0,
2),
NumberStyles.HexNumber),
byte.Parse(color.Substring(2,
2),
NumberStyles.HexNumber),
byte.Parse(color.Substring(4,
2),
NumberStyles.HexNumber)));
Brushes[color] = colorBrush;
}
return colorBrush;
}
示例12: Page_LayoutUpdated
private void Page_LayoutUpdated(object sender, object e)
{
if (new RepositorioConfig().ObterTodos().Any())
{
var solidbrush = new SolidColorBrush(
Color.FromArgb(
Convert.ToByte(
new RepositorioConfig().ObterTodos()
.FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
.ColorA),
Convert.ToByte(
new RepositorioConfig().ObterTodos()
.FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
.ColorR),
Convert.ToByte(
new RepositorioConfig().ObterTodos()
.FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
.ColorG),
Convert.ToByte(
new RepositorioConfig().ObterTodos()
.FirstOrDefault(c => c.Componente.Equals(StackPanelMenu.Name.ToString()))
.ColorB)));
StackPanelMenu.Background = solidbrush;
HeaderPanel.Background = solidbrush;
UpdateLayout();
}
}
示例13: MoviePlayer
public MoviePlayer(ref Popup Popup)
{
this.popup = Popup;
this.InitializeComponent();
string youTubeId = "VXPoJAyeF8k";
TestImage.Source = image;
TestImage.Height = 500;
TestImage.Width = 340;
var url = YouTube.GetVideoUriAsync(youTubeId);
var url2 = YouTube.GetVideoUri(youTubeId, YouTubeQuality.Quality1080P, null);
MovieContainer.Source = url.Result.Uri;
MovieContainer.Play();
MovieContainer.Width = baseMovieWidth;
MovieContainer.Height = baseMovieHeight;
LikeActive = new SolidColorBrush();
LikeActive.Color = Colors.ForestGreen;
LikeInactive = new SolidColorBrush();
LikeInactive.Color = Colors.White;
DislikeActive = new SolidColorBrush();
DislikeActive.Color = Colors.Red;
DislikeInactive = new SolidColorBrush();
DislikeInactive.Color = Colors.White;
}
示例14: Convert
public object Convert(object value, Type targetType, object parameter, string language)
{
var state = value.ToString();
SolidColorBrush returnValue = null;
if (state != null)
{
switch (state)
{
case "Nothing":
returnValue = new SolidColorBrush(Functions.FromStringColor("#00FFFFFF"));
break;
case "ChoiceNobodyNormal":
returnValue = new SolidColorBrush(Functions.FromStringColor("#FF7392CB"));
break;
case "ChoiceNobodyCouple":
returnValue = new SolidColorBrush(Functions.FromStringColor("#FFF77979"));
break;
case "ChoiceNobodyOldWeak":
returnValue = new SolidColorBrush(Functions.FromStringColor("#FFB8DD8C"));
break;
case "ChoiceMe":
returnValue = new SolidColorBrush(Functions.FromStringColor("#FFF9B196"));
break;
case "ChoiceOther":
returnValue = new SolidColorBrush(Functions.FromStringColor("#FFD1D1D1"));
break;
}
}
return returnValue;
}
示例15: MapControl
public MapControl()
{
Background = new SolidColorBrush(Colors.White); // DON'T REMOVE! Touch events do not work without a background
Children.Add(_renderTarget);
Children.Add(_bboxRect);
Children.Add(_attributionPanel);
_renderTarget.PaintSurface += _renderTarget_PaintSurface;
Map = new Map();
Loaded += MapControlLoaded;
SizeChanged += MapControlSizeChanged;
CompositionTarget.Rendering += CompositionTarget_Rendering;
_renderer = new MapRenderer();
PointerWheelChanged += MapControl_PointerWheelChanged;
ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
ManipulationDelta += OnManipulationDelta;
ManipulationCompleted += OnManipulationCompleted;
ManipulationInertiaStarting += OnManipulationInertiaStarting;
var orientationSensor = SimpleOrientationSensor.GetDefault();
if (orientationSensor != null)
orientationSensor.OrientationChanged += (sender, args) =>
Task.Run(() => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Refresh))
.ConfigureAwait(false);
}