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++; }
public static Uri Create(string filename, string text, SolidColorBrush backgroundColor, double textSize, Size size) { var background = new Rectangle(); background.Width = size.Width; background.Height = size.Height; background.Fill = backgroundColor; var textBlock = new TextBlock(); textBlock.Width = 500; textBlock.Height = 500; textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Text = text; textBlock.FontSize = textSize; textBlock.Foreground = new SolidColorBrush(Colors.White); textBlock.FontFamily = new FontFamily("Segoe WP"); var tileImage = "/Shared/ShellContent/" + filename; using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) { var bitmap = new WriteableBitmap((int)size.Width, (int)size.Height); bitmap.Render(background, new TranslateTransform()); bitmap.Render(textBlock, new TranslateTransform() { X = 39, Y = 88 }); var stream = store.CreateFile(tileImage); bitmap.Invalidate(); bitmap.SaveJpeg(stream, (int)size.Width, (int)size.Height, 0, 99); stream.Close(); } return new Uri("ms-appdata:///local" + tileImage, UriKind.Absolute); }
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; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { scoreStorage = new ScoreStorage(); HighScores = new ObservableCollection<Score>(scoreStorage.GetScores()); game = new Game(); game.PlayerLost += GameOnPlayerLost; game.PlayerTooFast += GameOnPlayerTooFast; game.PlayerWon += GameOnPlayerWon; game.CountdownTick += GameOnCountdownTick; game.WaitForItStarted += GameOnWaitForItStarted; game.TapDanceStarted += GameOnTapDanceStarted; game.ButtonsCanBeClickedChanged += GameOnButtonsCanBeClickedChanged; patternTimer = new DispatcherTimer(); patternTimer.Tick += PatternTimerOnTick; patternTimer.Interval = buttonLightingTime; Button1Command = new RelayCommand(() => game.ButtonClicked(0), () => game.ButtonsCanBeClicked); Button2Command = new RelayCommand(() => game.ButtonClicked(1), () => game.ButtonsCanBeClicked); Button3Command = new RelayCommand(() => game.ButtonClicked(2), () => game.ButtonsCanBeClicked); Button4Command = new RelayCommand(() => game.ButtonClicked(3), () => game.ButtonsCanBeClicked); StartRetryCommand = new RelayCommand(() => StartNewPattern(game.GetNewPattern()), () => true); Button1BackColor = new SolidColorBrush(Colors.Black); Button2BackColor = new SolidColorBrush(Colors.Black); Button3BackColor = new SolidColorBrush(Colors.Black); Button4BackColor = new SolidColorBrush(Colors.Black); StartRetryText = "Start"; SetNumberButtonsToDefault(); }
public void BackgroundGetThroughCode() { GridSplitter splitter = new GridSplitter(); Brush b = new SolidColorBrush(Colors.Black); splitter.SetValue(GridSplitter.BackgroundProperty, b); Assert.AreEqual(b, splitter.Background, "Getting Background property should pull from the backing dependency property."); }
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); }
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."); }
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; }
public PkgCreateWin() { InitializeComponent(); EnabledColor = SnapshotBtn.Foreground; DisabledColor = new SolidColorBrush(System.Windows.Media.Colors.LightGray); SetUiMode(UiMode.WaitingForFile); }
/// <summary> /// Initializes a new instance of the <see cref="DW.WPFToolkit.Controls.EllipseItemsFactory" /> class. /// </summary> public EllipseItemsFactory() { Color = new SolidColorBrush(Colors.Red); ItemsCount = 10; OpacityShrinking = 0.1; Size = 8; }
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; } }
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; }
public MainWindow() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer(); Random rnd = new Random(); timer.Interval = TimeSpan.FromSeconds(1.0); timer.Tick += (s, e) => { TestTimer++; TestBackground = new SolidColorBrush(Color.FromRgb( (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255))); FocusedElement = Keyboard.FocusedElement == null ? string.Empty : Keyboard.FocusedElement.ToString(); //Debug.WriteLine(string.Format("ActiveContent = {0}", dockManager.ActiveContent)); }; timer.Start(); this.DataContext = this; winFormsHost.Child = new UserControl1(); }
public override object ProvideValue(IServiceProvider serviceProvider) { SolidColorBrush brush = new SolidColorBrush(GetColor()); brush.Freeze(); return brush; }
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; } }
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; }
//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; }
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; }
static MouseHandler() { _brHighlight = new SolidColorBrush(Color.FromArgb(128, 255, 215, 140)); _brHighlight.Freeze(); _brInsert = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0)); _brInsert.Freeze(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyChangingColorText = ((System.Windows.Controls.TextBlock)(target)); return; case 2: this.MySolidColorBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.MyFadingText = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.MyWipedText = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.MyRotatingText = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.MyRotateTransform = ((System.Windows.Media.RotateTransform)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\MainWindow.xaml" ((PrefomanceViewer.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden #line 8 "..\..\MainWindow.xaml" ((PrefomanceViewer.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.BackGroundColor = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.MainPanel = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Converts SolidColorBrush to Drawing.Color /// </summary> /// <param name="oBrush"></param> /// <returns></returns> private System.Drawing.Color GetColor(System.Windows.Media.SolidColorBrush oBrush) { return(System.Drawing.Color.FromArgb(oBrush.Color.A, oBrush.Color.R, oBrush.Color.G, oBrush.Color.B)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Animations = ((System.Windows.Controls.TabControl)(target)); return; case 2: this.KeyFrames = ((System.Windows.Controls.TabControl)(target)); return; case 3: this.MyPath = ((System.Windows.Shapes.Path)(target)); return; case 4: this.MyBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 5: this.MyMatrixTransform = ((System.Windows.Media.MatrixTransform)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\..\Controls\KinectHoverButton.xaml" ((LightBuzz.Vitruvius.Controls.KinectHoverButton)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.Mask = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.Effect = ((System.Windows.Media.LinearGradientBrush)(target)); return; case 4: this.Icon = ((System.Windows.Controls.Image)(target)); return; case 5: this.Text = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public TrackLineShape(System.Windows.Media.SolidColorBrush brush)// = System.Windows.Media.Brushes.Red { _brush = brush; _trackLine = new Polyline(); _trackLine.Stroke = brush; this.Children.Add(_trackLine); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.spContr = ((LEDX.Components.UiController)(target)); #line 7 "..\..\..\Components\UIController.xaml" this.spContr.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.spContr_PreviewMouseDown); #line default #line hidden #line 7 "..\..\..\Components\UIController.xaml" this.spContr.Loaded += new System.Windows.RoutedEventHandler(this.spContr_Loaded); #line default #line hidden #line 7 "..\..\..\Components\UIController.xaml" this.spContr.IsVisibleChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.SpContr_IsVisibleChanged); #line default #line hidden return; case 2: this.rView = ((System.Windows.Shapes.Rectangle)(target)); return; case 3: this.AnimColorBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 4: this.sBrd = ((System.Windows.Media.Animation.Storyboard)(target)); return; case 5: this.clAni = ((System.Windows.Media.Animation.ColorAnimationUsingKeyFrames)(target)); return; case 6: this.btAdd = ((System.Windows.Controls.Button)(target)); return; case 7: this.tgbSel = ((System.Windows.Controls.Primitives.ToggleButton)(target)); return; case 8: this.imUnch = ((System.Windows.Controls.Image)(target)); return; case 9: this.imСh = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }
public XGeometryButton() { Data = new PathGeometry { Figures = new PathFigureCollection { new PathFigure { StartPoint = new System.Windows.Point(0, 0), Segments = new PathSegmentCollection { new LineSegment { Point = new System.Windows.Point(1, 1) } } }, new PathFigure { StartPoint = new System.Windows.Point(0, 1), Segments = new PathSegmentCollection { new LineSegment { Point = new System.Windows.Point(1, 0) } } } } }; HoverBackground = new System.Windows.Media.SolidColorBrush(Colors.IndianRed); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 4 "..\..\Ballon.xaml" ((WpfAppliTh.WindowBallon)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.LayoutRoot = ((System.Windows.Controls.StackPanel)(target)); return; case 3: this.myEllipse = ((System.Windows.Shapes.Ellipse)(target)); return; case 4: this.MyAnimatedBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 5: this.myScaleTransform = ((System.Windows.Media.ScaleTransform)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Prints "ERROR: " + msg in red to debug console /// </summary> /// <param name="msg">String of your error message text</param> public static void Error(String msg) { SolidColorBrush red = new SolidColorBrush(Colors.Red); //DebugWindow.addtoDebugTextBox(msg); Debug.WriteLine("ERROR: " + msg); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.button1 = ((System.Windows.Controls.Button)(target)); #line 6 "..\..\Window1.xaml" this.button1.MouseEnter += new System.Windows.Input.MouseEventHandler(this.button1_MouseEnter); #line default #line hidden #line 6 "..\..\Window1.xaml" this.button1.MouseLeave += new System.Windows.Input.MouseEventHandler(this.button1_MouseLeave); #line default #line hidden return; case 2: this.B1 = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.button2 = ((System.Windows.Controls.Button)(target)); return; case 4: this.scb = ((System.Windows.Media.SolidColorBrush)(target)); return; } this._contentLoaded = true; }
public bool DrawString( System.Windows.Media.DrawingContext graphics, System.Windows.Media.FontFamily fontFamily, System.Windows.FontStyle fontStyle, System.Windows.FontWeight fontWeight, double fontSize, string strText, System.Windows.Point ptDraw, System.Globalization.CultureInfo ci) { Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci); for (int i = 1; i <= m_nThickness; ++i) { SolidColorBrush solidbrush = new SolidColorBrush(m_clrOutline); Pen pen = new Pen(solidbrush, i); pen.LineJoin = PenLineJoin.Round; if (m_bClrText) { SolidColorBrush brush = new SolidColorBrush(m_clrText); graphics.DrawGeometry(brush, pen, path); } else graphics.DrawGeometry(m_brushText, pen, path); } return true; }
private void AllProductProvinceGroupings_Loaded(LoadOperation<ProductProvinceGrouping> result) { List<int> alreadySetProducts = new List<int>(); if (Utils.LoadOperation_Error_Handled(result.Error, "SmartMap")) foreach (ProductProvinceGrouping ppg in result.Entities) alreadySetProducts.Add(ppg.ProductMapID); List<string> productNames = new List<string>(); foreach (ProductMap pm in DBUtils.GetAllProducts()) { if (productNames.Contains(pm.CD_BrandDIName) || pm.CD_BrandDIName == null || pm.CD_BrandDIName.Trim() == "") continue; productNames.Add(pm.CD_BrandDIName); SolidColorBrush foreground = new SolidColorBrush(Colors.Black); if (alreadySetProducts.Contains(pm.ProductMapID)) foreground = new SolidColorBrush(Colors.Gray); if (_selectedProductMapIds != null && _selectedProductMapIds.Contains(pm.ProductMapID)) SelectedProductsList.Items.Add(new ListBoxItem() { Content = pm.CD_BrandDIName, Tag = pm.ProductMapID, Foreground = foreground }); else ProductsList.Items.Add(new ListBoxItem() { Content = pm.CD_BrandDIName, Tag = pm.ProductMapID, Foreground = foreground }); } if (ProductsLoading != null) ProductsLoading.Visibility = System.Windows.Visibility.Collapsed; else _hideLoading = true; }
/// <internalonly /> protected internal override ProceduralAnimation CreateEffectAnimation(AnimationEffectDirection direction) { SolidColorBrush brush; FrameworkElement target = GetTarget(); Border border = target as Border; Panel panel = target as Panel; Control control = target as Control; if ((border == null) && (panel == null) && (control == null)) { throw new InvalidOperationException("The target of the effect must be a Panel, Border or Control."); } brush = new SolidColorBrush(_highlightColor); if (border != null) { border.Background = brush; } else if (panel != null) { panel.Background = brush; } else if (control != null) { control.Background = brush; } HighlightAnimation animation = new HighlightAnimation(Duration, brush, _highlightColor); animation.AutoReverse = AutoReverse; animation.Interpolation = GetEffectiveInterpolation(); return animation; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.rectangle1 = ((System.Windows.Shapes.Rectangle)(target)); return; case 2: this.color1 = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.button1 = ((System.Windows.Controls.Button)(target)); #line 11 "..\..\Window1.xaml" this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click); #line default #line hidden return; case 4: this.button2 = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\Window1.xaml" this.button2.Click += new System.Windows.RoutedEventHandler(this.button2_Click); #line default #line hidden return; } this._contentLoaded = true; }
internal DragDropManager(FrameworkElement owner) { _owner = owner; Visibility = Visibility.Collapsed; SetValue(RowSpanProperty, 1000); SetValue(ColumnSpanProperty, 1000); Background = Brushes.Transparent; _indicatorBorderBrush = new SolidColorBrush(Color.FromArgb(192, _clr.R, _clr.G, _clr.B)); _indicatorBorderBrush.Freeze(); _indicatorBackgroundBrush = new SolidColorBrush(Color.FromArgb(64, _clr.R, _clr.G, _clr.B)); _indicatorBackgroundBrush.Freeze(); _source = CreateIndicator(); _target = CreateIndicator(); MouseMove += delegate(object s, MouseEventArgs e) { base.Cursor = ((this._target.Width > 0.0) ? Cursors.Hand : null); this.OnDragging(e); }; MouseLeftButtonUp += delegate(object s, MouseButtonEventArgs e) { this.IsOpen = false; this.OnDropped(e); }; LostMouseCapture += delegate { this.IsOpen = false; }; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.g = ((System.Windows.Controls.Grid)(target)); return; case 2: this.brd = ((System.Windows.Controls.Border)(target)); return; case 3: this.bg = ((System.Windows.Media.SolidColorBrush)(target)); return; case 4: this.empty = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.scr = ((System.Windows.Controls.ScrollViewer)(target)); return; case 6: this.panel = ((System.Windows.Controls.StackPanel)(target)); return; } this._contentLoaded = true; }
private void LoadRecipeTypes(Data.Discipline discipline = null) { Action <KeyValuePair <string, Data.RecipeType> > addRecipeType = delegate(KeyValuePair <string, Data.RecipeType> pair) { System.Windows.Media.SolidColorBrush fontBrush = new System.Windows.Media.SolidColorBrush(Colors.Black); ComboBoxItem cbi = new ComboBoxItem(); cbi.Foreground = fontBrush; Data.RecipeType ot = pair.Value; cbi.Content = Config.GetLocalizedName(ot); this.cbRecipeTypes.Items.Add(cbi); }; cbRecipeTypes.Items.Clear(); cbRecipeTypes.Items.Add(Properties.Resources.ComboBoxRecipeTypeFirstEntry); if (discipline != null) { foreach (KeyValuePair <string, Data.RecipeType> pair in discipline.RecipeTypes.OrderBy <KeyValuePair <string, Data.RecipeType>, string>(p => Config.GetLocalizedName(p.Value))) { addRecipeType(pair); } } else { foreach (KeyValuePair <string, Data.RecipeType> pair in Data.RecipeType.RecipeTypes.OrderBy <KeyValuePair <string, Data.RecipeType>, string>(p => Config.GetLocalizedName(p.Value))) { addRecipeType(pair); } } this.cbRecipeTypes.SelectedIndex = 0; }
public static Brush ToMapsui(this System.Windows.Media.SolidColorBrush brush) { var c = brush.Color.ToMapsui(); var b = new Brush(c); return(b); }
public void FillPath(Color color, GraphicsPath path) { var geometry = ((GraphicsPathHandler)path.Handler).Control; var brush = new swm.SolidColorBrush(Generator.Convert(color)); Control.DrawGeometry(brush, null, geometry); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.fWin = ((Animation.views.forward)(target)); #line 10 "..\..\..\views\forward.xaml" this.fWin.Loaded += new System.Windows.RoutedEventHandler(this.fWin_Loaded); #line default #line hidden return; case 2: this.ForwardGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ForwardArrowPath = ((System.Windows.Shapes.Path)(target)); return; case 4: this.mBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 5: this.ForwardArrow = ((System.Windows.Media.MatrixTransform)(target)); return; } this._contentLoaded = true; }
public static System.Windows.Media.Brush ToWpf(this Altaxo.Graph.Gdi.BrushX brushx) { System.Windows.Media.Color c = ToWpf(brushx.Color); var result = new System.Windows.Media.SolidColorBrush(c); return(result); }
private void BGColor_Click(object sender, RoutedEventArgs e) { Color BG_color = GetDialog(); Brush currentsolidBush = new System.Windows.Media.SolidColorBrush(BG_color); Text_in.Background = currentsolidBush; }
/// <summary> /// This method translates Avalon SD.Brushes into /// WindowsForms color objects /// </summary> private static SD.Color TranslateSolidOrGradientBrush(SWM.Brush brush, out bool defined) { SWM.Color brushColor; SD.Color wfColor = SD.Color.Empty; defined = false; SWM.SolidColorBrush solidColorBrush = brush as SWM.SolidColorBrush; if (solidColorBrush != null) { brushColor = solidColorBrush.Color; defined = true; wfColor = Convert.ToSystemDrawingColor(brushColor); } else { SWM.GradientBrush gradientBrush = brush as SWM.GradientBrush; if (gradientBrush != null) { SWM.GradientStopCollection grads = gradientBrush.GradientStops; if (grads != null) { SWM.GradientStop firstStop = grads[0]; if (firstStop != null) { brushColor = firstStop.Color; defined = true; wfColor = Convert.ToSystemDrawingColor(brushColor); } } } } return(wfColor); }
public LightBoxAdorner(UIElement adornedElement, UIElement element) : base(adornedElement) { var col = System.Windows.Media.Color.FromArgb(100, 0, 0, 0); var brush = new System.Windows.Media.SolidColorBrush(col); var root = new ItemsControl(); // ココで各種テンプレートなどの設定 var template = LightBox.GetTemplate(element); if (template != null) { root.Template = template; } var itemsPanel = LightBox.GetItemsPanel(element); if (itemsPanel != null) { root.ItemsPanel = itemsPanel; } var itemContainerStyle = LightBox.GetItemContainerStyle(element); if (itemContainerStyle != null) { root.ItemContainerStyle = itemContainerStyle; } this.AddVisualChild(root); this._root = root; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MWindow = ((序嵌于任务栏.MainWindow)(target)); return; case 2: this.wndBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.menuClose = ((System.Windows.Controls.MenuItem)(target)); #line 33 "..\..\MainWindow.xaml" this.menuClose.Click += new System.Windows.RoutedEventHandler(this.menuClose_Click_1); #line default #line hidden return; case 4: #line 38 "..\..\MainWindow.xaml" ((System.Windows.Controls.Image)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseLeftButtonDown_1); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.window = ((LoveScreen.Windows.TopImage)(target)); return; case 2: #line 58 "..\..\..\Windows\TopImage.xaml" ((System.Windows.Controls.Image)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseDown); #line default #line hidden return; case 3: this.border = ((System.Windows.Controls.Border)(target)); return; case 4: this.solidColorBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; } this._contentLoaded = true; }
protected override void DrawVisualThumbnail(DrawingContext drawingContext, out string title, ref BitmapSource icon) { var aeroColor = (Color) Application.Current.Resources["AeroColor"]; var aeroBrush = new SolidColorBrush(aeroColor); var aeroPen = new Pen(aeroBrush, 7); var largeIcon = (BitmapSource) Application.Current.Resources["TextClipboardItemIcon"]; var fontFamily = (FontFamily) Application.Current.Resources["CuprumFont"]; var typeface = new Typeface(fontFamily, FontStyles.Normal, FontWeights.Light, FontStretches.Normal); const int textOffset = VisualThumbnailMargin + 51 + VisualThumbnailMargin / 2; var text = new FormattedText(Text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, 15, aeroBrush); text.TextAlignment = TextAlignment.Left; text.MaxTextWidth = VisualThumbnailWidth - textOffset - VisualThumbnailMargin; text.MaxTextHeight = VisualThumbnailHeight - VisualThumbnailMargin * 2; drawingContext.DrawRectangle(Brushes.White, aeroPen, new Rect(-1, -1, VisualThumbnailWidth + 2, VisualThumbnailHeight + 2)); drawingContext.DrawImage(largeIcon, new Rect(VisualThumbnailMargin, VisualThumbnailMargin, 51, 66)); drawingContext.DrawText(text, new Point(textOffset, VisualThumbnailMargin)); title = Text; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var brush = new SolidColorBrush(); var balanceState = value as BalanceState; if(balanceState!=null) brush.Color = Color.FromRgb(balanceState.ColourRBG[0], balanceState.ColourRBG[1], balanceState.ColourRBG[2]); else brush.Color = Color.FromRgb(0, 0, 0); //switch (balanceState) //{ // case BalanceStateEnum.OK: // brush.Color = Color.FromRgb(0, 200, 0); // break; // case BalanceStateEnum.BelowThreshold: // brush.Color = Color.FromRgb(255, 150, 0); // break; // case BalanceStateEnum.Negative: // brush.Color = Color.FromRgb(255, 0, 0); // break; // default: // brush.Color = Color.FromRgb(0, 0, 0); // break; //} return brush; }
void ChangeColor(TreeNode TNode, System.Windows.Media.SolidColorBrush GroupBrush, System.Windows.Media.SolidColorBrush ItemBrush) { if (TNode.IsGroup) { TNode.ColorBrush = GroupBrush; } else { TNode.ColorBrush = ItemBrush; } if (TNode.Owner != null) { if (TNode.IsGroup) { TNode.Owner.Foreground = GroupBrush; } else { TNode.Owner.Foreground = ItemBrush; } } else { } foreach (var childnode in TNode.Children) { ChangeColor(childnode, GroupBrush, ItemBrush); } }
public void CreateALine() { // Create a Line Line redLine = new Line(); redLine.X1 = 50; redLine.Y1 = 50; redLine.X2 = 200; redLine.Y2 = 200; // Create a red Brush SolidColorBrush redBrush = new SolidColorBrush(); redBrush.Color = Colors.Red; // Set Line's width and color redLine.StrokeThickness = 4; redLine.Stroke = redBrush; // Add line to the Grid. LayoutRoot.Children.Add(redLine); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.lWin = ((Animation.views.left)(target)); return; case 2: this.leftGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.LeftArrowPath = ((System.Windows.Shapes.Path)(target)); return; case 4: this.mBrush = ((System.Windows.Media.SolidColorBrush)(target)); return; case 5: this.LeftArrow = ((System.Windows.Media.MatrixTransform)(target)); return; } this._contentLoaded = true; }
public Paper() { // paper properties Background = new SolidColorBrush(Colors.White); Cursor = Cursors.IBeam; // setup caret caret = new Rectangle(); caret.Fill = new SolidColorBrush(Colors.Black); caret.Height = 12; caret.Width = 1; caret.Margin = new Thickness(-1, 0, 0, 0); // setup caret timer caretTimer = new DispatcherTimer(); caretTimer.Interval = TimeSpan.FromSeconds(0.5); caretTimer.Tick += delegate { caret.Visibility = (caret.Visibility == Visibility.Visible || !ShowCaret) ? Visibility.Collapsed : Visibility.Visible; }; caretTimer.Start(); // setup highlighting indicies HighlightedBlocks = new List<Character>(); HighlightFromIndex = new Index(0, 0); HighlightToIndex = new Index(0, 0); // events MouseLeftButtonDown += Paper_MouseLeftButtonDown; MouseLeftButtonUp += Paper_MouseLeftButtonUp; }
public static Sm.Brush ToMediaBrush(this Wg.Fill input) { Sm.Brush brush = null; switch (input.FillType) { default: brush = new Sm.SolidColorBrush(input.Background.ToMediaColor()); break; case Wg.Fill.FillTypes.LinearGradient: brush = ((Wg.GradientLinear)input).ToMediaBrush(); break; case Wg.Fill.FillTypes.RadialGradient: brush = ((Wg.GradientRadial)input).ToMediaBrush(); break; case Wg.Fill.FillTypes.Pattern: brush = new Sm.SolidColorBrush(input.Background.ToMediaColor()); break; case Wg.Fill.FillTypes.Bitmap: brush = new Sm.SolidColorBrush(input.Background.ToMediaColor()); break; } return(brush); }
/// <summary> /// Set brush to solid color /// </summary> /// <param name="SolidColorBrush">Media solid color brush</param> public void SetBrush ( SysMedia.SolidColorBrush SolidColorBrush ) { NonStroking = Color.FromArgb(SolidColorBrush.Color.R, SolidColorBrush.Color.G, SolidColorBrush.Color.B); BrushOpacity = SolidColorBrush.Color.A / 255.0 * SolidColorBrush.Opacity; }
public void FillEllipse(Color color, int x, int y, int width, int height) { PushGuideLines(x, y, width, height); var brush = new swm.SolidColorBrush(Generator.Convert(color)); Control.DrawEllipse(brush, null, new sw.Point(x + width / 2.0, y + height / 2.0), width / 2.0, height / 2.0); Control.Pop(); }
public void DrawText(Font font, Color color, int x, int y, string text) { var fontHandler = font.Handler as FontHandler; var brush = new swm.SolidColorBrush(Generator.Convert(color)); var formattedText = new swm.FormattedText(text, CultureInfo.CurrentUICulture, sw.FlowDirection.LeftToRight, fontHandler.Typeface, fontHandler.PixelSize, brush); Control.DrawText(formattedText, new sw.Point(x, y)); }
public SizeF MeasureString(Font font, string text) { var fontHandler = font.Handler as FontHandler; var brush = new swm.SolidColorBrush(swm.Colors.White); var formattedText = new swm.FormattedText(text, CultureInfo.CurrentUICulture, sw.FlowDirection.LeftToRight, fontHandler.Typeface, fontHandler.PixelSize, brush); return(new SizeF((float)formattedText.WidthIncludingTrailingWhitespace, (float)formattedText.Height)); }
public void FillRectangle(Color color, int x, int y, int width, int height) { PushGuideLines(x, y, width, height); var brush = new swm.SolidColorBrush(Generator.Convert(color)); Control.DrawRectangle(brush, null, new sw.Rect(x, y, width, height)); Control.Pop(); }
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); }
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()); } }