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; }
private void UpdateBrush( string Choice ) { switch ( Choice ) { case Parameters.APPEARANCE_CONTENTREADER_CLOCK_ARCOLOR: ARBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_CLOCK_ARCOLOR ); NotifyChanged( "ARBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_CLOCK_HHCOLOR: HHBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_CLOCK_HHCOLOR ); NotifyChanged( "HHBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_CLOCK_MHCOLOR: MHBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_CLOCK_MHCOLOR ); NotifyChanged( "MHBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_CLOCK_SCOLOR: SBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_CLOCK_SCOLOR ); NotifyChanged( "SBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_ES_SCOLOR: ESSBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_ES_SCOLOR ); NotifyChanged( "ESSBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_ES_DCOLOR: ESDBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_ES_DCOLOR ); NotifyChanged( "ESDBrush" ); break; case Parameters.APPEARANCE_CONTENTREADER_ES_BG: ESBGBrush = new SolidColorBrush( Properties.APPEARANCE_CONTENTREADER_ES_BG ); NotifyChanged( "ESBGBrush" ); break; } }
public Persona() { byte[] colorComponents = new byte[3]; _colorRamdomizer.NextBytes(colorComponents); ColorFavorito = new SolidColorBrush( Color.FromArgb(255, colorComponents[0], colorComponents[1], colorComponents[2]) ); }
public TopSlideElement() { init(); Background = new SolidColorBrush(Colors.Transparent); //Opacity = 0.6; ManipulationMode = ManipulationModes.All; }
private async void DeleteFile(object sender, RoutedEventArgs e) { var file = await ApplicationData.Current.LocalFolder.GetFileAsync(_fileName); await file.DeleteAsync(); IsEnabled = false; Background = new SolidColorBrush(Colors.DarkGray); }
public Avalon(GeometryFactory Segments, Activation Attach, Activation Detach, ManipulationDeltaEventHandler Router,byte definition , bool Real = false) { if (!Real) { this.definition = definition; Data = Segments.Pattern(); ManipulationMode = Windows.UI.Xaml.Input.ManipulationModes.All; RenderTransform = new CompositeTransform(); RenderTransformOrigin = new Windows.Foundation.Point(0.5, 0.5); Fill = new SolidColorBrush(new Color { A = 0, R = 0, G = 0, B = 0 }); this.Attach = Attach; this.Detach = Detach; this.Router = Router; Tapped += Avalon_Tapped; Holding += Avalon_Holding; Loaded += Avalon_Loaded; Unloaded += Avalon_Unloaded; ManipulationDelta += Avalon_ManipulationDelta; this.Real = new Avalon(Segments, Attach, Detach, null, definition,true); this.Real.RenderTransform = RenderTransform; this.Real.RenderTransformOrigin = RenderTransformOrigin; this.Real.Data = Segments.Pattern(); this.Real.Fill = new SolidColorBrush(Colors.RosyBrown); Canvas.SetZIndex(this, 2); Canvas.SetZIndex(this.Real, 0); Avalon_Holding(null, null); } }
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; }
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); }
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); } }
public Contact(SolidColorBrush foregroundColor, SolidColorBrush backgroundColor, bool imageMirrored = false) { this.InitializeComponent(); SetColors(foregroundColor, backgroundColor); SetFooterImage(imageMirrored); }
/// <summary> /// Method fills field backgroud with color correlated to the value of the field /// </summary> private void FillBackground() { Color newBackgroundColor = FieldBackgroundColor.GetColorForFieldBackground(fieldValue); UIX.Media.SolidColorBrush brush = new UIX.Media.SolidColorBrush(newBackgroundColor); background.Fill = brush; }
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 }
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); }
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 ); } }
static AuthorFlairKindConverter() { if (Application.Current.Resources.ContainsKey("SystemColorControlAccentColor")) bg_op = Application.Current.Resources["SystemColorControlAccentColor"] as SolidColorBrush; else bg_op = Utility.GetColorFromHexa("#FFDAA520"); }
/// <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; }
public void Reset() { Children.Clear(); InvalidateArrange(); content = null; contentsCenter = new Rect(0, 0, 1, 1); contentGravity = ContentGravity.Resize; Clip = null; InvOriginTransform = new TranslateTransform(); ClipGeometry = new RectangleGeometry(); ClipGeometry.Transform = InvOriginTransform; RenderTransform = new TranslateTransform(); _position = new Point(0, 0); _origin = new Point(0, 0); _size = new Size(0, 0); _hidden = false; originSet = false; _createdTransforms = false; LayerOpacity = 1.0; backgroundBrush = TransparentBrush; backgroundColor.R = 0; backgroundColor.G = 0; backgroundColor.B = 0; backgroundColor.A = 0; Set("anchorPoint", new Point(0.5, 0.5)); _masksToBounds = false; this.Background = TransparentBrush; }
public MapViewerControl() { this.InitializeComponent(); MarkerVisibility = Visibility.Visible; MarkerFill = new SolidColorBrush(Color.FromArgb(70, 255, 0, 0)); MarkerStroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)); MarkerScale = 1d; if (DesignMode.DesignModeEnabled) return; var dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher; DataContextChanged += (sender, args) => { if (ViewModel == null || _isLoaded) return; _isLoaded = true; ServiceLocator.Current.AsyncImageLoaderService.LoadImageAsync(ViewModel.Entity.Image.Id) .ContinueWith(async imageTask => { await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { E_Image_Map.ImageOpened += (s1, a1) => { MapImageLoadedEvent?.Invoke(this, null); }; E_Image_Map.Source = imageTask.Result; }); }); }; }
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; } } }
public SolidColorBrush backcolor(string s) { SolidColorBrush sbc = new SolidColorBrush(); switch(s) { case "Red": sbc = new SolidColorBrush(Colors.Red); break; case "Green": sbc = new SolidColorBrush(Colors.Green); break; case "Yellow": sbc = new SolidColorBrush(Colors.Yellow); break; case "Aqua": sbc = new SolidColorBrush(Colors.Aqua); break; case "Bisque": sbc = new SolidColorBrush(Colors.Bisque); break; case "Blue": sbc = new SolidColorBrush(Colors.Blue); break; default: sbc = new SolidColorBrush(Colors.White); break; } return sbc; }
void init() { Background = new SolidColorBrush(Colors.Transparent); VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top; HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; _transform = new CompositeTransform(); _c_transform = new CompositeTransform(); RenderTransform = _transform; //scroll _scroll = new ScrollViewer() { HorizontalScrollMode = ScrollMode.Enabled, VerticalScrollMode = ScrollMode.Enabled, HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden }; Children.Add(_scroll); //content _content = new Grid() { HorizontalAlignment = HorizontalAlignment.Left, ManipulationMode = ManipulationModes.All }; _content.RenderTransform = _c_transform; _image = new Image() { Stretch = Stretch.UniformToFill }; _border = new Border() { CornerRadius = new Windows.UI.Xaml.CornerRadius(10) }; _content.Children.Add(_image); _content.Children.Add(_border); _scroll.Content = _content; }
public IStackItem() { initcontrols(); initproperties(); inititemanimations(); Background = new SolidColorBrush(Windows.UI.Colors.Transparent); }
public void calculateModulo(int val) { seed = val; brushList.Clear(); int moddedNumber = 0; for (int i = 1; i < (seed/2)+1; i++) { brushList.Add(new List<SolidColorBrush>()); for (int j = 1; j < seed; j++) { SolidColorBrush b = new SolidColorBrush(); moddedNumber = (i * j) % seed; //convert from old to new range //NewValue = (((OldValue - OldMin) * (NewMax - NewMin)) / (OldMax - OldMin)) + NewMin long newValue = (((moddedNumber) * (byteMax)) / seed + (byteMax / 4)); //convert newValue to byte array byte[] bytes = BitConverter.GetBytes(newValue); //first byte is transparency, so we only use //the range of bytes 1-3 to generate the color b.Color = (Color.FromArgb(BitConverter.GetBytes(byteMax)[0], bytes[1], bytes[2], bytes[3])); brushList.ElementAt(i - 1).Add(b); } } }
void init() { Background = new SolidColorBrush(ColorHelper.FromArgb(70, 0, 0, 0)); progressbar = new ProgressBar() { IsIndeterminate =true }; Children.Add(progressbar); }
/// <summary> /// Kurucu Metod - Constructor /// </summary> public Column(bool isWhite) { this.InitializeComponent(); this.DataContext = this; if (isWhite) TRIANGLE_FILL_COLOR = this.WHITE_TRIANGLE_COLOR; else TRIANGLE_FILL_COLOR = this.BLACK_TRIANGLE_COLOR; this.Loaded += (s, e) => { List<Chip> chipList = this.ChipStack.ToList<Chip>(); foreach (Chip chip in chipList) { chip.Height = this.ActualWidth * 0.8; chip.Width = this.ActualWidth * 0.8; } this.isLoaded = true; this.RenderChips(); this.Draw(); }; this.Tapped += Column_TappedForSelection; }
public PointStateExample() { InitializeComponent(); var r = new Random(); Values = new ChartValues<ObservableValue> { new ObservableValue(r.Next(10, 400)), new ObservableValue(r.Next(10, 400)), new ObservableValue(r.Next(10, 400)), new ObservableValue(r.Next(10, 400)), new ObservableValue(r.Next(10, 400)), new ObservableValue(r.Next(10, 400)) }; //Lets define a custom mapper, to set fill and stroke //according to chart values... Mapper = Mappers.Xy<ObservableValue>() .X((item, index) => index) .Y(item => item.Value) .Fill(item => item.Value > 200 ? DangerBrush : null) .Stroke(item => item.Value > 200 ? DangerBrush : null); Formatter = x => x + " ms"; OkBrush = new SolidColorBrush(Color.FromArgb(255, 254, 192, 7)); DangerBrush = new SolidColorBrush(Color.FromArgb(255, 238, 83, 80)); DataContext = this; }
private bool WriteColor() { SetRGB(colorPicker.SelectedColor); bool result = currentColor == colorPicker.SelectedColor; currentColor = colorPicker.SelectedColor; return result; }
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); } }
void UpdateAppearance(ShellAppearance appearance) { var tabBarBackgroundColor = ShellRenderer.DefaultBackgroundColor; var tabBarForegroundColor = ShellRenderer.DefaultForegroundColor; var titleColor = ShellRenderer.DefaultTitleColor; if (appearance != null) { var a = (IShellAppearanceElement)appearance; tabBarBackgroundColor = a.EffectiveTabBarBackgroundColor.ToWindowsColor(); tabBarForegroundColor = a.EffectiveTabBarForegroundColor.ToWindowsColor(); if (!appearance.TitleColor.IsDefault) { titleColor = appearance.TitleColor.ToWindowsColor(); } } _BottomBarArea.Background = _HeaderArea.Background = new UwpSolidColorBrush(tabBarBackgroundColor); _Title.Foreground = new UwpSolidColorBrush(titleColor); var tabbarForeground = new UwpSolidColorBrush(tabBarForegroundColor); foreach (var button in _BottomBar.Children.OfType <AppBarButton>()) { button.Foreground = tabbarForeground; } if (SectionRenderer is IAppearanceObserver iao) { iao.OnAppearanceChanged(appearance); } }
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; }
//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); } }
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(); } }
private void CreateGrid() { // Remove all previously-existing rectangles paintCanvas.Children.Clear(); grid = new bool[gridWidth, gridWidth]; int rectSize = (int)paintCanvas.Width / gridWidth; SolidColorBrush black = new SolidColorBrush(Colors.Black); SolidColorBrush white = new SolidColorBrush(Colors.White); // Turn entire grid on and create rectangles to represent it for (int r = 0; r < gridWidth; r++) for (int c = 0; c < gridWidth; c++) { grid[r, c] = true; Rectangle rect = new Rectangle(); rect.Fill = white; rect.Width = rectSize + 1; rect.Height = rect.Width + 1; rect.Stroke = black; int x = c * rectSize; int y = r * rectSize; Canvas.SetTop(rect, y); Canvas.SetLeft(rect, x); // Add the new rectangle to the canvas' children paintCanvas.Children.Add(rect); } }
protected override void UpdateBackgroundColor() { base.UpdateBackgroundColor(); if (GetValue(BackgroundProperty) == null && Children.Count == 0) { // Forces the layout to take up actual space if it's otherwise empty Background = new WSolidColorBrush(Colors.Transparent); } }
public static swm.Brush ToWpfBrush(this Color value, swm.Brush brush = null) { var solidBrush = brush as swm.SolidColorBrush; if (solidBrush == null #if TODO_XAML || solidBrush.IsSealed #endif ) { solidBrush = new swm.SolidColorBrush(); } solidBrush.Color = value.ToWpf(); return(solidBrush); }
public object Convert(object value, Type targetType, object parameter, string language) { WSolidColorBrush brush = null; var element = value as FrameworkElement; if (element != null) { while (brush == null && element != null) { DependencyProperty property = GetBackgroundProperty(element); if (property != null) { value = element.GetValue(property); brush = value as WSolidColorBrush; if (brush != null && brush.Color == Colors.Transparent) { brush = null; } } element = VisualTreeHelper.GetParent(element) as FrameworkElement; } } brush = value as WSolidColorBrush; if (brush != null) { Color color = brush.ToFormsColor(); double delta = Shift; if (color.Luminosity > .6) { delta = -Shift; } color = color.AddLuminosity(delta); return(new WSolidColorBrush(color.ToWindowsColor())); } return(null); }
public object Convert(object value, Type targetType, object parameter, string culture) { if (targetType != typeof(Windows.UI.Xaml.Media.Brush)) { //throw new NotSupportedException("BrushTransparencyConverter is unable to convert to type " + targetType); } Windows.UI.Xaml.Media.SolidColorBrush brush = value as Windows.UI.Xaml.Media.SolidColorBrush; if (brush != null) { double alpha; if (!Double.TryParse(parameter as String, out alpha)) { alpha = 0.5; } Windows.UI.Color c = brush.Color; c.A = (byte)(Byte.MaxValue * alpha); brush.Color = c; } return(value); }
public static Windows.UI.Xaml.Media.Brush GetViewIllustratorForce() { Windows.UI.Xaml.Media.Brush brush = null; brush = new Windows.UI.Xaml.Media.SolidColorBrush() { Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Opacity = OperatingData.AcrylicOpacity }; //switch (OperatingData._Theme) //{ // case KXTDataStruct._Interface_Theme._Green_: // brush = new Windows.UI.Xaml.Media.SolidColorBrush() // { // Color = Color.FromArgb(0x7F, 0xAF, 0xF0, 0x00), // Opacity = OperatingData.AcrylicOpacity // }; // break; // case KXTDataStruct._Interface_Theme._Red_: // brush = new Windows.UI.Xaml.Media.SolidColorBrush() // { // Color = Color.FromArgb(0xFF, 0xF0, 0xA9, 0xFF), // Opacity = OperatingData.AcrylicOpacity // }; // break; // case KXTDataStruct._Interface_Theme._White_: // brush = new Windows.UI.Xaml.Media.SolidColorBrush() // { // Color = Color.FromArgb(0xFF, 0xCC, 0xCC, 0xCC), // Opacity = OperatingData.AcrylicOpacity // }; // break; // case KXTDataStruct._Interface_Theme._Default_: // brush = new Windows.UI.Xaml.Media.SolidColorBrush() // { // Color = Color.FromArgb(0xFF, 0x66, 0xCC, 0xFF), // Opacity = OperatingData.AcrylicOpacity // }; // break; //} return(brush); }
private void setAnswer(object sender, PointerRoutedEventArgs e) { Windows.UI.Xaml.Media.SolidColorBrush colorForChat = new Windows.UI.Xaml.Media.SolidColorBrush(); Windows.UI.Xaml.Media.SolidColorBrush colorForChat2 = new Windows.UI.Xaml.Media.SolidColorBrush(); Windows.UI.Color actualColors = new Windows.UI.Color(); // Windows.UI.Color actualColors2 = new Windows.UI.Color(); if (((Windows.UI.Xaml.Media.SolidColorBrush)((Button)sender).Background).Color.G != 254) { actualColors.R = 0; actualColors.G = 254; actualColors.B = 0; actualColors.A = 255; } else { actualColors.R = 255; actualColors.G = 255; actualColors.B = 255; actualColors.A = 255; } colorForChat.Color = actualColors; ((Button)sender).Background = colorForChat; actualColors.R = 255; actualColors.G = 255; actualColors.B = 255; actualColors.A = 255; colorForChat2.Color = actualColors; if (((Button)sender).Name.Substring(1, 2) == "no") { int idForYes = ((int.Parse(((Button)sender).Name[0].ToString())) * 4); // Debug.WriteLine(((int.Parse(((Button)sender).Name[0].ToString())) * 4 )); ((Button)requestSpace.Children[idForYes]).Background = colorForChat2; } else { int idForYes = ((int.Parse(((Button)sender).Name[0].ToString())) * 4 + 1); ((Button)requestSpace.Children[idForYes]).Background = colorForChat2; } }
public static Windows.UI.Xaml.Media.Brush GetViewBackground() { Windows.UI.Xaml.Media.Brush brush = null; if (OperatingData.AcrylicModel) { switch (OperatingData._Theme) { case _Interface_Theme._Green_: brush = new Windows.UI.Xaml.Media.AcrylicBrush() { BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop, TintOpacity = OperatingData.AcrylicOpacity, TintColor = Color.FromArgb(0x7F, 0xAF, 0xF0, 0x00), FallbackColor = Color.FromArgb(0x7F, 0xAF, 0xF0, 0x00) }; break; case _Interface_Theme._Red_: brush = new Windows.UI.Xaml.Media.AcrylicBrush() { BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop, TintOpacity = OperatingData.AcrylicOpacity, TintColor = Color.FromArgb(0xFF, 0xF0, 0xA9, 0xFF), FallbackColor = Color.FromArgb(0xFF, 0xF0, 0xA9, 0xFF) }; break; case _Interface_Theme._White_: brush = new Windows.UI.Xaml.Media.AcrylicBrush() { BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop, TintOpacity = OperatingData.AcrylicOpacity, TintColor = Color.FromArgb(0xFF, 0xCC, 0xCC, 0xCC), FallbackColor = Color.FromArgb(0xFF, 0xCC, 0xCC, 0xCC) }; break; case _Interface_Theme._Default_: brush = new Windows.UI.Xaml.Media.AcrylicBrush() { BackgroundSource = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop, TintOpacity = OperatingData.AcrylicOpacity, TintColor = Color.FromArgb(0xFF, 0x66, 0xCC, 0xFF), FallbackColor = Color.FromArgb(0xFF, 0x66, 0xCC, 0xFF) }; break; } } else { switch (OperatingData._Theme) { case _Interface_Theme._Green_: brush = new Windows.UI.Xaml.Media.SolidColorBrush() { Color = Color.FromArgb(0x7F, 0xAF, 0xF0, 0x00), Opacity = OperatingData.AcrylicOpacity }; break; case _Interface_Theme._Red_: brush = new Windows.UI.Xaml.Media.SolidColorBrush() { Color = Color.FromArgb(0xFF, 0xF0, 0xA9, 0xFF), Opacity = OperatingData.AcrylicOpacity }; break; case _Interface_Theme._White_: brush = new Windows.UI.Xaml.Media.SolidColorBrush() { Color = Color.FromArgb(0xFF, 0xCC, 0xCC, 0xCC), Opacity = OperatingData.AcrylicOpacity }; break; case _Interface_Theme._Default_: brush = new Windows.UI.Xaml.Media.SolidColorBrush() { Color = Color.FromArgb(0xFF, 0x66, 0xCC, 0xFF), Opacity = OperatingData.AcrylicOpacity }; break; } } return(brush); }
void getRequestForYou(int howMany) { if (howMany == 0) { howMany = howManyRequests; } for (int i = 0; i < howMany; i++) { TextBlock text = new TextBlock(); if (howMany == 1) { text.Text = requestG; } else { text.Text = "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"; } text.Width = 0.45 * widthScreen; text.Height = 0.1 * heightScreen; text.Padding = new Thickness(0, 0, 0, 0); text.TextWrapping = TextWrapping.Wrap; text.Margin = new Thickness(0, 0, 0, 0); text.AddHandler(PointerReleasedEvent, new PointerEventHandler(checkDetails), true); Button newButton = new Button(); newButton.Content = "YES"; newButton.Name = i + "yes"; // newButton.IsChecked = true; newButton.Width = 0.2 * widthScreen; newButton.Height = 0.1 * heightScreen; // newButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(changeValue), true); Thickness margin = newButton.Margin; Button newButton2 = new Button(); newButton2.Content = "NO"; newButton2.Name = i + "no"; // newButton.IsChecked = true; newButton2.Width = 0.2 * widthScreen; newButton2.Height = 0.1 * heightScreen; // newButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(changeValue), true); Border theLine = new Border(); theLine.Width = 1.1 * widthScreen; theLine.Height = 0.1 * heightScreen; theLine.BorderThickness = new Thickness(1); Windows.UI.Xaml.Media.SolidColorBrush colorForChat = new Windows.UI.Xaml.Media.SolidColorBrush(); Windows.UI.Xaml.Media.SolidColorBrush colorForChat2 = new Windows.UI.Xaml.Media.SolidColorBrush(); Windows.UI.Color actualColors = new Windows.UI.Color(); actualColors.R = 0; actualColors.G = 0; actualColors.B = 0; actualColors.A = 255; colorForChat.Color = actualColors; theLine.BorderBrush = colorForChat; margin.Left = widthScreen * 0.75; // margin.Top = -(scrollView.Height/2)+ ((i+ totalRequests )* (0.25 * heightScreen)); margin.Top = ((i + totalRequests) * (0.15 * heightScreen)); newButton.Margin = margin; margin.Left = 0.05 * widthScreen; newButton2.Margin = margin; margin.Left = -0.125 * widthScreen; text.Margin = margin; margin.Left = -0.2 * widthScreen; // theLine.Margin = new Thickness(0, 0.15 * heightScreen, 0,0); theLine.Margin = margin; // buttons.Add(newButton); // this.Controls.Add(newButton); requestSpace.Children.Add(newButton); requestSpace.Children.Add(newButton2); requestSpace.Children.Add(text); requestSpace.Children.Add(theLine); // Debug.WriteLine("size " + ((Button)requestSpace.Children[0]).Width); if (passedParameter == "0") { newButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(setAnswer), true); newButton2.AddHandler(PointerReleasedEvent, new PointerEventHandler(setAnswer), true); } else { newButton.IsEnabled = false; newButton2.IsEnabled = false; } // requestSpace.Children[0].lo // this.cont actualColors.R = 255; actualColors.G = 255; actualColors.B = 255; actualColors.A = 255; colorForChat.Color = actualColors; newButton.Background = colorForChat; newButton2.Background = colorForChat; newButton.VerticalAlignment = VerticalAlignment.Top; newButton2.VerticalAlignment = VerticalAlignment.Top; text.VerticalAlignment = VerticalAlignment.Top; theLine.VerticalAlignment = VerticalAlignment.Top; requestText.Background = colorForChat; actualColors.R = 0; actualColors.G = 0; actualColors.B = 0; actualColors.A = 255; colorForChat2.Color = actualColors; theLine.BorderBrush = colorForChat2; requestSpace.Height += (0.2 * heightScreen); } totalRequests += howMany; scrollView.ScrollToVerticalOffset(requestSpace.Height); }
public object ConvertToNative(Brush brush, object context) { winMedia.Brush winBrush = null; // SolidColorBrush if (brush is SolidColorBrush) { SolidColorBrush xamBrush = brush as SolidColorBrush; winBrush = new winMedia.SolidColorBrush { Color = ConvertColor(xamBrush.Color) }; } // LinearGradientBrush else if (brush is LinearGradientBrush) { LinearGradientBrush xamBrush = brush as LinearGradientBrush; winBrush = new winMedia.LinearGradientBrush { StartPoint = ConvertPoint(xamBrush.StartPoint), EndPoint = ConvertPoint(xamBrush.EndPoint), SpreadMethod = ConvertGradientSpread(xamBrush.SpreadMethod) }; foreach (GradientStop xamGradientStop in xamBrush.GradientStops) { winMedia.GradientStop winGradientStop = new winMedia.GradientStop { Color = ConvertColor(xamGradientStop.Color), Offset = xamGradientStop.Offset }; (winBrush as winMedia.LinearGradientBrush).GradientStops.Add(winGradientStop); } } else if (brush is ImageBrush) { ImageBrush xamBrush = brush as ImageBrush; winBrush = new winMedia.ImageBrush { Stretch = (winMedia.Stretch)(int) xamBrush.Stretch, AlignmentX = (winMedia.AlignmentX)(int) xamBrush.AlignmentX, AlignmentY = (winMedia.AlignmentY)(int) xamBrush.AlignmentY, }; ImageSource xamImageSource = (brush as ImageBrush).ImageSource; if (xamImageSource != null) { IImageSourceHandler handler = null; if (xamImageSource.GetType() == typeof(FileImageSource)) { handler = new FileImageSourceHandler(); } else if (xamImageSource.GetType() == typeof(StreamImageSource)) { handler = new StreamImageSourceHandler(); } else if (xamImageSource.GetType() == typeof(UriImageSource)) { handler = new UriImageSourceHandler(); } if (handler != null) { Task <winMedia.ImageSource> winImageSourceTask = handler.LoadImageAsync(xamImageSource); winImageSourceTask.ContinueWith((task) => { winFound.IAsyncAction asyncAction = winBrush.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { (winBrush as winMedia.ImageBrush).ImageSource = task.Result; }); }); } } } if (winBrush != null) { winBrush.Transform = brush.Transform?.GetNativeObject() as winMedia.MatrixTransform; // TODO: RelativeTransform and Opacity } return(winBrush); }
static void SetLogger(LogType type, string text, params object[] args) { var solidColor = new XMedia.SolidColorBrush(); switch (type) { case LogType.NORMAL: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; text = text.Insert(0, "System: "); break; case LogType.ERROR: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; text = text.Insert(0, "Error: "); break; case LogType.DUMP: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; case LogType.INIT: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; case LogType.MISC: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; case LogType.CMD: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; case LogType.DEBUG: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; default: solidColor.Color = Colors.Green; CurrentBlock.Foreground = solidColor; break; } StringBuilder logText = new StringBuilder(); if (type.Equals(LogType.INIT) | type.Equals(LogType.DEFAULT)) { logText.AppendFormat(text, args); } else if (type.Equals(LogType.DUMP) || type.Equals(LogType.CMD)) { logText.AppendFormat(text, args); } else { logText.AppendFormat("[" + DateTime.Now.ToString() + "] " + text, args); } CurrentBlock.Text += logText.ToString() + "\n"; }