//Color picked event handler void ColorPicked(object sender, Windows.UI.Color color) { //Get the source InkColor instance InkColor pressed = sender as InkColor; //Check if the instance is valid if (pressed != null) { //Iterate over all of the pickers InkColors and update their border color to highlight the active one foreach (InkColor inkcolor in m_colors) { if (inkcolor == pressed) { inkcolor.BorderColor = this.MainBorder.BorderBrush; } else { inkcolor.BorderColor = m_inActiveBrush; } } } //Raise the InkColorPicked event if (InkColorPicked != null) { InkColorPicked(this, color); } }
/// <summary> /// Changes font color of main application banner /// </summary> /// <returns>None</returns> private void ChangeTextBlockFontColor(TextBlock textBlock, Windows.UI.Color color) { var ignored = this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { textBlock.Foreground = new SolidColorBrush(color); }); }
//绘制颜色选择区rectColor private void DrawDoubleLinearGradient() { cvsDoubleLinear.Children.Clear(); int nRect = (int)Height; Windows.UI.Xaml.Shapes.Rectangle[] rectLinearGradient = new Windows.UI.Xaml.Shapes.Rectangle[nRect]; LinearGradientBrush[] linearBrush = new LinearGradientBrush[nRect]; for (int i = 0; i < nRect; ++i) { Windows.UI.Color clr1 = new Windows.UI.Color(), clr2 = new Windows.UI.Color(); clr1.A = clr2.A = 255; clr2.R = clr2.G = clr2.B = (Byte)((nRect - 1 - i) * 255 / (nRect - 1)); clr1.R = (Byte)((nRect - i - 1) * colorPure.R / (nRect - 1)); clr1.G = (Byte)((nRect - i - 1) * colorPure.G / (nRect - 1)); clr1.B = (Byte)((nRect - i - 1) * colorPure.B / (nRect - 1)); GradientStop gradientStop1 = new GradientStop(), gradientStop2 = new GradientStop(); gradientStop1.Offset = 0; gradientStop1.Offset = 1; gradientStop1.Color = clr1; gradientStop2.Color = clr2; linearBrush[i] = new LinearGradientBrush(); linearBrush[i].StartPoint = new Point(0, 0); linearBrush[i].EndPoint = new Point(1, 0); linearBrush[i].GradientStops.Add(gradientStop2); linearBrush[i].GradientStops.Add(gradientStop1); rectLinearGradient[i] = new Windows.UI.Xaml.Shapes.Rectangle(); rectLinearGradient[i].Width = 0.8 * Width; rectLinearGradient[i].Height = 1; rectLinearGradient[i].StrokeThickness = 0; rectLinearGradient[i].Fill = linearBrush[i]; cvsDoubleLinear.Children.Add(rectLinearGradient[i]); Canvas.SetTop(rectLinearGradient[i], i); } }
public VectorInkStroke(Stroke stroke, Wacom.Ink.Geometry.VectorBrush vectorBrush, PipelineData pipelineData) { Id = stroke.Id; PathPointProperties ppp = stroke.Style.PathPointProperties; Color = MediaColor.FromArgb( ppp.Alpha.HasValue ? (byte)(ppp.Alpha * 255.0f) : byte.MinValue, ppp.Red.HasValue ? (byte)(ppp.Red * 255.0f) : byte.MinValue, ppp.Green.HasValue ? (byte)(ppp.Green * 255.0f) : byte.MinValue, ppp.Blue.HasValue ? (byte)(ppp.Blue * 255.0f) : byte.MinValue); Spline = stroke.Spline; Layout = stroke.Layout; VectorBrush = vectorBrush; Polygon = PolygonUtil.ConvertPolygon(pipelineData.Merged.Addition); SimplPoly = pipelineData.Merged.Addition; SensorDataOffset = stroke.SensorDataOffset; SensorDataMappings = stroke.SensorDataMappings; SensorDataId = stroke.SensorDataId; Attributes attribs = new Attributes(Color); if (ppp.Size.HasValue) { attribs.Size = ppp.Size.Value; } Constants = attribs; }
public static void RichEditBoxSetText(RichEditBox richEditBox, String msg, Windows.UI.Color color, bool fReadOnly) { richEditBox.IsReadOnly = false; richEditBox.Document.SetText(Windows.UI.Text.TextSetOptions.None, msg); richEditBox.Foreground = new SolidColorBrush(color); richEditBox.IsReadOnly = fReadOnly; }
private async Task <MethodResponse> ChangeColor(MethodRequest req, object userContext) { var colorReq = Newtonsoft.Json.JsonConvert.DeserializeObject <ChangeColorRequest>(req.DataAsJson); onColor = Windows.UI.Color.FromArgb(255, colorReq.R, colorReq.G, colorReq.B); return(new MethodResponse(new byte[0], 200)); }
private ClassBreaksRenderer CreateClassBreaksRenderer() { // Define the colors that will be used by the unique value renderer. Colors gray = Colors.FromArgb(255, 153, 153, 153); Colors blue1 = Colors.FromArgb(255, 227, 235, 207); Colors blue2 = Colors.FromArgb(255, 150, 194, 191); Colors blue3 = Colors.FromArgb(255, 97, 166, 181); Colors blue4 = Colors.FromArgb(255, 69, 125, 150); Colors blue5 = Colors.FromArgb(255, 41, 84, 120); // Create a gray outline and five fill symbols with different shades of blue. SimpleLineSymbol outlineSimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, gray, 1); SimpleFillSymbol simpleFileSymbol1 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue1, outlineSimpleLineSymbol); SimpleFillSymbol simpleFileSymbol2 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue2, outlineSimpleLineSymbol); SimpleFillSymbol simpleFileSymbol3 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue3, outlineSimpleLineSymbol); SimpleFillSymbol simpleFileSymbol4 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue4, outlineSimpleLineSymbol); SimpleFillSymbol simpleFileSymbol5 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue5, outlineSimpleLineSymbol); // Create a list of five class breaks for different population ranges. List <ClassBreak> listClassBreaks = new List <ClassBreak> { new ClassBreak("-99 to 8560", "-99 to 8560", -99, 8560, simpleFileSymbol1), new ClassBreak("> 8,560 to 18,109", "> 8,560 to 18,109", 8560, 18109, simpleFileSymbol2), new ClassBreak("> 18,109 to 35,501", "> 18,109 to 35,501", 18109, 35501, simpleFileSymbol3), new ClassBreak("> 35,501 to 86,100", "> 35,501 to 86,100", 35501, 86100, simpleFileSymbol4), new ClassBreak("> 86,100 to 10,110,975", "> 86,100 to 10,110,975", 86100, 10110975, simpleFileSymbol5) }; // Create and return the a class break renderer for use with the POP2007 field in the counties sub-layer. return(new ClassBreaksRenderer("POP2007", listClassBreaks)); }
private Color Win10ColorToMediaColor(UISettings uiSettings, UIColorType colorType) { Windows.UI.Color win10Color = uiSettings.GetColorValue(colorType); Color mediaColor = Color.FromArgb(win10Color.A, win10Color.R, win10Color.G, win10Color.B); return(mediaColor); }
private void setTitleBarColor(Windows.UI.Color bgColor, Windows.UI.Color btnHoverColor) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.BackgroundColor = bgColor; titleBar.ButtonBackgroundColor = bgColor; titleBar.ButtonHoverBackgroundColor = btnHoverColor; }
public async void DrawFaceRectangleStream(DetectedFace[] faceResult, InMemoryRandomAccessStream imageStream) { ImageCanvas.Children.Clear(); if (faceResult != null && faceResult.Length > 0) { BitmapDecoder decoder = await BitmapDecoder.CreateAsync(imageStream); double resizeFactorH = ImageCanvas.Height / decoder.PixelHeight; double resizeFactorW = ImageCanvas.Width / decoder.PixelWidth; foreach (var face in faceResult) { FaceRectangle faceRect = face.FaceRectangle; var rectangle1 = new Rectangle(); Windows.UI.Color faceColor = Windows.UI.Color.FromArgb(50, 255, 255, 255); Windows.UI.Color borderColor = Windows.UI.Colors.Blue; rectangle1.Fill = new SolidColorBrush(faceColor); rectangle1.Width = faceRect.Width; rectangle1.Height = faceRect.Height; rectangle1.Stroke = new SolidColorBrush(borderColor); rectangle1.StrokeThickness = 1; rectangle1.RadiusX = 10; rectangle1.RadiusY = 10; ImageCanvas.Children.Add(rectangle1); Canvas.SetLeft(rectangle1, faceRect.Left); Canvas.SetTop(rectangle1, faceRect.Top); } } }
protected override void OnAttached() { var color = (Color)Element.GetValue(RoutingEffects.PickerChangeColor.ColorProperty); this.color = ConvertColor(color); (Control as ComboBox).Foreground = new SolidColorBrush(this.color); }
private void ColorsMenuFlyout_Opening(object sender, object e) { MenuFlyout colorsMenu = sender as MenuFlyout; colorsMenu.Items.Clear(); var colors = typeof(Windows.UI.Colors).GetRuntimeProperties(); foreach (var color in colors) { var item = new MenuFlyoutItem(); item.Text = color.Name; Windows.UI.Color c = (Windows.UI.Color)color.GetValue(null); item.DataContext = string.Format("#{0}{1}{2}", c.R.ToString("x2"), c.G.ToString("x2"), c.B.ToString("x2")); item.Background = new SolidColorBrush(c); item.FontFamily = new FontFamily("Segoe UI"); item.FontSize = 15; item.Height = 40; item.Margin = new Thickness(0, 1, 0, 0); item.Click += ColorMenu_Click; colorsMenu.Items.Add(item); } }
private async Task ChangeColorOfPicture(Color color) { _color = color; var svg = ""; var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Assets/CarPics/car.svg")); using (var inputStream = await file.OpenReadAsync()) using (var classicStream = inputStream.AsStreamForRead()) using (var streamReader = new StreamReader(classicStream)) { svg = await streamReader.ReadToEndAsync(); } var newSvg = Regex.Replace(svg, "white", CreateHexFromColor(color)); var storageFolder = ApplicationData.Current.LocalFolder; var storageFile = await storageFolder.CreateFileAsync($"Image{_num}.svg", CreationCollisionOption.ReplaceExisting); //Write data to the file await FileIO.WriteTextAsync(storageFile, newSvg); var svgImage = await StorageFileToSvgImage(storageFile); svgImage.RasterizePixelHeight = 200; svgImage.RasterizePixelWidth = 500; CarImage.Source = svgImage; CarImage.Width = 100; CarImage.Height = 100; CarImage.Margin = new Thickness(0, -10, 0, 0); await storageFile.DeleteAsync(StorageDeleteOption.Default); }
public MasterDetailPageContentDemoViewModel() { SplitterMode = MasterDetailPageContentSplitterMode.OverlayVisible; EnableSplitter = true; Dictionary <string, Color> colors = new Dictionary <string, Color>(); Random rnd = new Random(); foreach (Message message in DataStorage.Messages) { Color color; if (colors.ContainsKey(message.From)) { color = colors[message.From]; } else { byte[] rgb = new byte[3]; rnd.NextBytes(rgb); color = Color.FromArgb(0xFF, rgb[0], rgb[1], rgb[2]); colors.Add(message.From, color); } Messages.Add(new MessageViewModel(message, color)); } SelectedMessage = Messages[0]; }
//SortedList<string, Conversation> listContact = new SortedList<string, Conversation>(); //联系人列表 #endregion #region Init public MainPage() { this.InitializeComponent(); instance = this; //将应用界面扩展至 Titlebar 区域 CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; //修改标题栏颜色 var titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; Windows.UI.Color color = new Windows.UI.Color(); color.R = 245; color.G = 245; color.B = 245; //titleBar.BackgroundColor = color; titleBar.ButtonBackgroundColor = color; //自定义标题栏控件: //可以将界面中任意控件指定为标题栏,指定后该控件将具有标题栏的行为特性,如拖动窗口、右键弹出窗口操作菜单等。 //Window.Current.SetTitleBar(grid); //CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( //CoreDispatcherPriority.High, //new DispatchedHandler(() => //{ // btnUserImage.Source = LoginPage.instance.userImageSource; // btnSessionList.Focus(FocusState.Pointer); //})); textBoxInput.SendClick += TextBoxInput_SendClick; }
/// <summary> /// This method returns a Border representing the shadow of the box /// </summary> /// <param name="shadowColour">Colour of the shadow</param> /// <param name="cornerRadius">Corner radius of the box</param> /// <param name="boxBorderThickness">Thickness of the box border</param> /// <param name="xDeltaPosition">X Translation of the shadow from the box</param> /// <param name="yDeltaPosition">Y Translation of the shadow from the box</param> /// <param name="boxColourAlpha">Alpha (opacity) of the box colour</param> /// <param name="boxBorderAlpha">Alpha (opacity) of the box border colour</param> /// <returns>Border</returns> private Border CreateShadow(XFColor shadowColour, CornerRadius cornerRadius, double boxBorderThickness, double xDeltaPosition, double yDeltaPosition, double boxColourAlpha, double boxBorderAlpha) { // Create a rectangle representing the shadow //Adjust the shadow color to account for any transparency in the box. XFColor clr = new XFColor(shadowColour.R, shadowColour.G, shadowColour.B, shadowColour.A * boxColourAlpha); XFColor borderClr = new XFColor(shadowColour.R, shadowColour.G, shadowColour.B, shadowColour.A * boxBorderAlpha); UWPColor shdwColour = UWPColor.FromArgb((byte)(255 * (clr.A < 0f ? 0 : clr.A)), (byte)(255 * (clr.R < 0f ? 0 : clr.R)), (byte)(255 * (clr.G < 0f ? 0 : clr.G)), (byte)(255 * (clr.B < 0f ? 0 : clr.B))); UWPColor shadowBorderColour = UWPColor.FromArgb((byte)(255 * (borderClr.A < 0f ? 0 : borderClr.A)), (byte)(255 * (borderClr.R < 0f ? 0 : borderClr.R)), (byte)(255 * (borderClr.G < 0f ? 0 : borderClr.G)), (byte)(255 * (borderClr.B < 0f ? 0 : borderClr.B))); return(new Border { Background = new SolidColorBrush(shdwColour), BorderBrush = new SolidColorBrush(shadowBorderColour), BorderThickness = new UWPThickness(boxBorderThickness), CornerRadius = CornerRadiusConverter.Convert(cornerRadius), RenderTransform = new CompositeTransform { TranslateX = xDeltaPosition, TranslateY = yDeltaPosition } }); }
public static void EnableBGImage() { //#80161616 = 128,22,22,22 //#64161616 = 100,22,22,22 //((SolidColorBrush)App.Current.Resources["UserListFontColor"]).Color = Windows.UI.Colors.White; string path = ApplicationSettingsHelper.ReadSettingsValue(AppConstants.BackgroundImagePath) as string; if (path != null && path != "") { ((ImageBrush)App.Current.Resources["BgImage"]).ImageSource = new BitmapImage(new Uri(path, UriKind.RelativeOrAbsolute)); Windows.UI.Color color = Windows.UI.Color.FromArgb(128, 22, 22, 22); ((SolidColorBrush)App.Current.Resources["TransparentBGImageColor"]).Color = color; color = Windows.UI.Color.FromArgb(100, 22, 22, 22); ((SolidColorBrush)App.Current.Resources["TransparentMainPageBGImageColor"]).Color = color; } else { } if (App.Current.RequestedTheme == ApplicationTheme.Light) { App.Current.Resources["UserListFontColor"] = new SolidColorBrush(Windows.UI.Colors.White); } ChangeAlbumViewTransparency(); }
void UpdateBrushColor(string resourceKey, Windows.UI.Color color) { if (Resources[resourceKey] is Windows.UI.Xaml.Media.SolidColorBrush sb) { sb.Color = color; } }
/// <summary> /// Creates a circular solid colored brush that we can apply to a visual /// </summary> private CompositionEffectBrush CreateCircleBrushWithColor(Windows.UI.Color color) { var colorBrush = _compositor.CreateColorBrush(color); // // Because Windows.UI.Composition does not have a Circle visual, we will // work around by using a circular opacity mask // Create a simple Composite Effect, using DestinationIn (S * DA), // with a color source and a named parameter source. // var effect = new CompositeEffect { Mode = CanvasComposite.DestinationIn, Sources = { new ColorSourceEffect() { Color = color }, new CompositionEffectSourceParameter("mask") } }; var factory = _compositor.CreateEffectFactory(effect); var brush = factory.CreateBrush(); // // Create the mask brush using the circle mask // CompositionSurfaceBrush maskBrush = _compositor.CreateSurfaceBrush(); maskBrush.Surface = _circleMaskSurface.Surface; brush.SetSourceParameter("mask", maskBrush); return(brush); }
private void OnTinct(object sender, RoutedEventArgs e) { MenuFlyoutItem item = sender as MenuFlyoutItem; string tinct = item.Tag as string; Windows.UI.Color color = new Windows.UI.Color(); switch (tinct) { case "黑色": color = Windows.UI.Colors.Black; break; case "蓝色": color = Windows.UI.Colors.Blue; break; case "白色": color = Windows.UI.Colors.White; break; default: break; } redit.Document.Selection.CharacterFormat.BackgroundColor = color; }
void createChatsView(int howMany) { for (int i = 0; i < howMany; i++) { ListBoxItem newItem = new ListBoxItem(); newItem.Content = "aaaaa"; newItem.Name = "item" + i; // newItem.PointerPressed += rectan1.Command; Windows.UI.Xaml.Media.SolidColorBrush colorForChat = new Windows.UI.Xaml.Media.SolidColorBrush(); Windows.UI.Color actualColors = new Windows.UI.Color(); if (i == 0) { actualColors.R = 125; actualColors.G = 255; actualColors.B = 0; } else { actualColors.R = 125; actualColors.G = 0; actualColors.B = 255; } actualColors.A = 255; colorForChat.Color = actualColors; newItem.Background = colorForChat; newItem.AddHandler(PointerReleasedEvent, new PointerEventHandler(toolStripClick), true); chatList.Items.Add(newItem); Debug.WriteLine(newItem.Background); } // ((ListBox)chatList).Items }
public object Convert(object value, Type targetType, object parameter, string language) { Windows.UI.Color rgb = new Windows.UI.Color(); Windows.UI.Color[] colorScheme = new Windows.UI.Color[5]; colorScheme[0] = new Windows.UI.Color(); for(int i = 0; i < colorScheme.Length; i++){ colorScheme[i] = new Windows.UI.Color(); colorScheme[i].A = 200; } colorScheme[0].R = 0; colorScheme[0].G = 75; colorScheme[0].B = 139; colorScheme[1].R = 3; colorScheme[1].G = 159; colorScheme[1].B = 223; colorScheme[2].R = 1; colorScheme[2].G = 91; colorScheme[2].B = 118; colorScheme[3].R = 129; colorScheme[3].G = 168; colorScheme[3].B = 9; colorScheme[4].R = 169; colorScheme[4].G = 218; colorScheme[4].B = 16; return new SolidColorBrush(colorScheme[value.GetHashCode() % 5]); }
private void CreateBars(int[] genArray) { int[] array = genArray; double maxWidth = Canvas.Width; double maxHeight = Canvas.Height; double barWidth = maxWidth / array.Length; double heightIncrement = maxHeight / array.Length; for (int i = 0; i < array.Length; i++) { double barHeight = (array[i] * heightIncrement); var bar = new Rectangle(); Windows.UI.Color barColor = new Windows.UI.Color(); barColor.R = Convert.ToByte((barHeight / maxHeight) * 255); barColor.B = Convert.ToByte(((maxHeight - barHeight) / maxHeight) * 255); barColor.A = 255; Canvas.Children.Add(bar); bar.Name = "Bar" + i; bar.Fill = new SolidColorBrush(barColor); bar.Stroke = new SolidColorBrush(barColor); bar.Margin = new Thickness(i * barWidth, maxHeight - barHeight, 0, 0); bar.Width = barWidth; bar.Height = barHeight; } }
public void SetAppColors(Windows.UI.Color bg, Windows.UI.Color fg) { foreach (var(item, value) in AppColors) { value.SetAppColors(bg, fg); } }
private void DisablePomodoroTask() { done = true; Windows.UI.Color color = new Windows.UI.Color(); color.A = 0; rootBackgroundEnabled = root.Background; root.Background = new SolidColorBrush(color); root.BorderThickness = new Thickness(1); Windows.UI.Color borderColor = new Windows.UI.Color(); borderColor.A = Color.White.A; borderColor.R = Color.White.R; borderColor.G = Color.White.G; borderColor.B = Color.White.B; root.BorderBrush = new SolidColorBrush(borderColor); TimerValueBar.Visibility = Visibility.Collapsed; pomDotForegroundEnabled = PomOne.Foreground; PomOne.Foreground = new SolidColorBrush(borderColor); PomTwo.Foreground = new SolidColorBrush(borderColor); PomThree.Foreground = new SolidColorBrush(borderColor); PomFour.Foreground = new SolidColorBrush(borderColor); DiscriptionTextForegroundEnabled = DiscriptionBlock.Foreground; DiscriptionBlock.Foreground = new SolidColorBrush(borderColor); }
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Windows.UI.Color e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SetSelectionHighlightColor(); }); }
async Task CreateTintEffectBrushAsync(Uri uri) { Xamarin.Forms.Image element = this.Element as Xamarin.Forms.Image; if (Control == null || Element == null || element.Width < 0 || element.Height < 0) { return; } SetupCompositor(); spriteVisual = compositor.CreateSpriteVisual(); spriteVisual.Size = new Vector2((float)element.Width, (float)element.Height); imageSurface = await generator.CreateImageSurfaceAsync(uri, new Windows.Foundation.Size(element.Width, element.Height), ImageSurfaceOptions.DefaultOptimized); CompositionSurfaceBrush surfaceBrush = compositor.CreateSurfaceBrush(imageSurface.Surface); CompositionBrush targetBrush = surfaceBrush; if (this.TintColor == Color.Transparent) { // Don't apply tint effect effectBrush = null; } else { // Set target brush to tint effect brush Windows.UI.Color nativeColor = GetNativeColor(this.TintColor); IGraphicsEffect graphicsEffect = new CompositeEffect { Mode = CanvasComposite.DestinationIn, Sources = { new ColorSourceEffect { Name = "colorSource", Color = nativeColor }, new CompositionEffectSourceParameter("mask") } }; CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] { "colorSource.Color" }); effectBrush = effectFactory.CreateBrush(); effectBrush.SetSourceParameter("mask", surfaceBrush); SetTint(nativeColor); targetBrush = effectBrush; } spriteVisual.Brush = targetBrush; ElementCompositionPreview.SetElementChildVisual(Control, spriteVisual); }
public SolidColorBrush ColorConverter(string hex) { var r = (byte)System.Convert.ToUInt32(hex.Substring(0, 2), 16); var g = (byte)System.Convert.ToUInt32(hex.Substring(2, 2), 16); var b = (byte)System.Convert.ToUInt32(hex.Substring(4, 2), 16); return(new SolidColorBrush(Color.FromArgb(255, r, g, b))); }
/// <summary> /// Invert color /// </summary> /// <param name="defaultColor">Color to inversion</param> /// <returns>Inverted color</returns> public static Windows.UI.Color InvertColor(Windows.UI.Color defaultColor) { return(Windows.UI.Color.FromArgb( defaultColor.A, (byte)(255 - defaultColor.R), (byte)(255 - defaultColor.G), (byte)(255 - defaultColor.B))); }
public static UWPColor ToColor(this Color target) { return(UWPColor.FromArgb( (byte)(255 * target.A), (byte)(255 * target.R), (byte)(255 * target.G), (byte)(255 * target.B))); }
public static NativeColor ToWindows(this Color color) { return(NativeColor.FromArgb( (byte)(color.A * 255), (byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255))); }
//Function used in toggeling the Export button. public void ResetExportButton() { Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0); var color = new Windows.UI.Color(); color.A = 255; color.R = 236; color.B = 236; color.G = 236; Eksporter.Background = new SolidColorBrush(color); }
public object Convert(object value, Type targetType, object parameter, string language) { String color = (String)value; Windows.UI.Color rgb = new Windows.UI.Color(); rgb.R = byte.Parse(color.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); rgb.G = byte.Parse(color.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); rgb.B = byte.Parse(color.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); rgb.A = 255; return new SolidColorBrush(rgb); }
private void Export_Click(object sender, RoutedEventArgs e) { if (MainPage.mainPage.clickedExport) { ResetExportButton(); MainPage.mainPage.clickedExport = false; } else { Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Hand, 1); var color = new Windows.UI.Color(); color.R = 160; color.B = 160; color.G = 160; color.A = 255; Eksporter.Background = new SolidColorBrush(color); MainPage.mainPage.clickedExport = true; } }
private void OnSelectedColorChanged(object sender, EventArgs e) { vinegetteColor = Windows.UI.Color.FromArgb(0xff, PickerButton.SelectedColor.R, PickerButton.SelectedColor.G, PickerButton.SelectedColor.B); UpdatePreviewAsync(); }
private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args ) { Canceled = false; UserChoice = SectionData.CColor.TColor; }
private void EditBilde_Click(object sender, RoutedEventArgs e) { if ((string)EditBilde.Tag == "1") { ResetEditButton(); } else { Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Hand, 1); EditBilde.Tag = "1"; var color = new Windows.UI.Color(); color.R = 160; color.B = 160; color.G = 160; color.A = 255; EditBilde.Background = new SolidColorBrush(color); } }
/// <summary> /// Creates an XColor structure from the specified Windows.UI.Color. /// </summary> public static XColor FromArgb(UwpColor color) { return new XColor(color); }
public void SetColor(Color c) { lastColor = NativeColor.FromArgb ((byte)c.Alpha, (byte)c.Red, (byte)c.Green, (byte)c.Blue); }
XColor(UwpColor color) : this(color.A, color.R, color.G, color.B) { }
/// <summary> /// Creates an XColor structure from the specified alpha value and color. /// </summary> public static XColor FromArgb(int alpha, UwpColor color) { // Cast required to use correct constructor. return new XColor((byte)alpha, color.R, color.G, color.B); }