private void drawPoint(Point p, Canvas testCanvas) { //create shape System.Diagnostics.Debug.WriteLine("Creating shape"); Shape userShape; Shape shape = new Ellipse(); shape.SetValue(Canvas.LeftProperty, p.X); shape.SetValue(Canvas.TopProperty, p.Y); //shape.HorizontalAlignment = HorizontalAlignment.Left; //shape.VerticalAlignment = VerticalAlignment.Center; shape.Width = 4; shape.Height = 4; shape.Stroke = new SolidColorBrush(Colors.Black); shape.StrokeThickness = 3.0; GradientBrush gb = new LinearGradientBrush(); gb.GradientStops = new GradientStopCollection(); GradientStop g1 = new GradientStop(); g1.Color = Colors.Red; gb.GradientStops.Add(g1); g1 = new GradientStop(); g1.Color = Colors.Blue; g1.Offset = 2; gb.GradientStops.Add(g1); shape.Fill = gb; shape.Visibility = System.Windows.Visibility.Visible; shape.Opacity = 0.5; testCanvas.Children.Add(shape); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 11 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 2: this.r1 = ((System.Windows.Shapes.Rectangle)(target)); return; case 3: this.rot1 = ((System.Windows.Media.RotateTransform)(target)); return; case 4: this.e1 = ((System.Windows.Shapes.Ellipse)(target)); return; case 5: this.r2 = ((System.Windows.Shapes.Rectangle)(target)); return; case 6: this.g1 = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
public static System.Windows.Media.Brush ToBrush(this StyleColor sc) { if (sc.FillType == ColorFillType.Solid) { return(new System.Windows.Media.SolidColorBrush(StyleColorExtension.FromArgb(sc.ARGB))); } else if (sc.FillType == ColorFillType.Gradient) { var lineb = new System.Windows.Media.LinearGradientBrush(); var newFrames = sc.Frames; if (newFrames == null || newFrames.Count == 0) { newFrames = new Dictionary <double, int>(); newFrames[0] = -1; newFrames[1] = -16777216; } foreach (var keypair in newFrames) { var gradientStop = new System.Windows.Media.GradientStop( StyleColorExtension.FromArgb(keypair.Value), keypair.Key); lineb.GradientStops.Add(gradientStop); } var aRotateTransform = new System.Windows.Media.RotateTransform(); aRotateTransform.CenterX = 0.5; aRotateTransform.CenterY = 0.5; aRotateTransform.Angle = sc.Angle; lineb.RelativeTransform = aRotateTransform; return(lineb); } return(null); }
/// <summary>Creates a gradient brush with the given colors flowing in the specified direction.</summary> /// <param name="direction">The direction of the gradient.</param> /// <param name="start">The starting color.</param> /// <param name="end">The ending color.</param> public static LinearGradientBrush ToGradient(this Direction direction, Color start, Color end) { // Create the brush. var brush = new LinearGradientBrush(); switch (direction) { case Direction.Down: case Direction.Up: brush.StartPoint = new Point(0.5, 0); brush.EndPoint = new Point(0.5, 1); break; case Direction.Right: case Direction.Left: brush.StartPoint = new Point(0, 0.5); brush.EndPoint = new Point(1, 0.5); break; } // Configure colors. var gradientStart = new GradientStop { Color = start }; var gradientEnd = new GradientStop { Color = end }; gradientStart.Offset = direction == Direction.Up || direction == Direction.Left ? 1 : 0; gradientEnd.Offset = direction == Direction.Down || direction == Direction.Right ? 1 : 0; // Insert colors. brush.GradientStops.Add(gradientStart); brush.GradientStops.Add(gradientEnd); // Finish up. return brush; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var isKeyboardFocusWithin = (bool)value; if (isKeyboardFocusWithin) { LinearGradientBrush linGrBrush = new LinearGradientBrush(); linGrBrush.StartPoint = new Point(0.5, 0); linGrBrush.EndPoint = new Point(0.5, 1); GradientStop firstGrStop = new GradientStop(); firstGrStop.Color = Color.FromArgb(255, 253, 211, 168); GradientStop secondGrStop = new GradientStop(); secondGrStop.Color = Color.FromArgb(255, 252, 231, 159); linGrBrush.GradientStops.Add(firstGrStop); linGrBrush.GradientStops.Add(secondGrStop); return linGrBrush; } else { return new SolidColorBrush(Colors.LightGray); } }
/// <summary> /// Retrieves the color that most closely represents what would be found on the scale offset. /// </summary> /// <param name="ramp">The color scale the return value is derived from.</param> /// <param name="offset">The offset on the color scale for which a color is to be found..</param> /// <param name="maxR">The maximum R-channel value.</param> /// <param name="maxG">The maximum G-channel value.</param> /// <param name="maxB">The maximum B-channel value.</param> /// <param name="alphaEnabled">Whether or not value-matching for the alpha channel is enabled.</param> /// <returns>The color closest to the specified offset on the specified color scale.</returns> public static Color MatchOffsetToColor(this GradientStopCollection ramp, double offset, int maxR, int maxG, int maxB, bool alphaEnabled) { double startBoundaryOffset = 0.0; double finishBoundaryOffset = 1.0; GradientStop startBoundary = new GradientStop(); GradientStop finishBoundary = new GradientStop(); foreach (GradientStop boundary in ramp) { if (boundary.Offset <= offset && boundary.Offset > startBoundaryOffset) { startBoundary = boundary; } if (boundary.Offset > offset && boundary.Offset <= finishBoundaryOffset) { finishBoundary = boundary; break; } } var color = Color.FromScRgb( (alphaEnabled) ? CalculateChannelValue(startBoundary, finishBoundary, "ScA", offset, 255) : (float)1.0, CalculateChannelValue(startBoundary, finishBoundary, "ScR", offset, maxR), CalculateChannelValue(startBoundary, finishBoundary, "ScG", offset, maxG), CalculateChannelValue(startBoundary, finishBoundary, "ScB", offset, maxB) ); return color; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Glicious;component/SettingsPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.Glicious = ((System.Windows.Controls.TextBlock)(this.FindName("Glicious"))); this.PgTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PgTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.grad2start = ((System.Windows.Media.GradientStop)(this.FindName("grad2start"))); this.grad2stop = ((System.Windows.Media.GradientStop)(this.FindName("grad2stop"))); this.veganBox = ((System.Windows.Controls.CheckBox)(this.FindName("veganBox"))); this.ovolactoBox = ((System.Windows.Controls.CheckBox)(this.FindName("ovolactoBox"))); this.gfBox = ((System.Windows.Controls.CheckBox)(this.FindName("gfBox"))); this.passoverBox = ((System.Windows.Controls.CheckBox)(this.FindName("passoverBox"))); this.image1 = ((System.Windows.Controls.Image)(this.FindName("image1"))); this.textBlock1 = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1"))); this.gradStart = ((System.Windows.Media.GradientStop)(this.FindName("gradStart"))); this.gradStop = ((System.Windows.Media.GradientStop)(this.FindName("gradStop"))); this.appBar = ((Microsoft.Phone.Shell.ApplicationBar)(this.FindName("appBar"))); this.save = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("save"))); this.settings = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("settings"))); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture){ int valor = (int)value; LinearGradientBrush brocha = new LinearGradientBrush(); GradientStop color1 = new GradientStop(); GradientStop color2 = new GradientStop(); brocha.StartPoint.Offset(-0.041,-0.005); brocha.EndPoint.Offset(0.782,1.123); color1.Offset = 0; if(valor == 0){ color1.Color = Colors.IndianRed; }else { color1.Color = Colors.LightBlue; } color2.Offset = 0.645; brocha.GradientStops.Add(color1); brocha.GradientStops.Add(color2); return brocha; }
public static Brush LinearGradientColorBrush(string status) { LinearGradientBrush tempBrush = new LinearGradientBrush(); tempBrush.StartPoint = new Point(0, 0); tempBrush.EndPoint = new Point(10, 10); tempBrush.Opacity = .5; tempBrush.MappingMode = BrushMappingMode.Absolute; tempBrush.SpreadMethod = GradientSpreadMethod.Repeat; GradientStop stop1 = new GradientStop(); stop1.Color = StatusStringToColorObject(status); tempBrush.GradientStops.Add(stop1); GradientStop stop2 = new GradientStop(); stop2.Color = StatusStringToColorObject(status); stop2.Offset = 0.49; tempBrush.GradientStops.Add(stop2); GradientStop stop3 = new GradientStop(); stop3.Color = Colors.Transparent; stop3.Offset = 0.51; tempBrush.GradientStops.Add(stop3); GradientStop stop4 = new GradientStop(); stop3.Color = Colors.Transparent; stop3.Offset = 1; tempBrush.GradientStops.Add(stop4); return tempBrush; }
public static LinearGradientBrush GetLineBrush() { //<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> //<GradientStop Color="#FFCCCCCC" Offset="0"/> //<GradientStop Color="Black" Offset="1"/> //<GradientStop Color="#FFABABAB" Offset="0.457"/> //<GradientStop Color="Black" Offset="0.53"/> //</LinearGradientBrush> LinearGradientBrush brush = new LinearGradientBrush(); brush.EndPoint = new Point(0.5, 1); brush.StartPoint = new Point(0.5, 0); GradientStop gs = new GradientStop(); gs.Color = ConvertColor("#FFCCCCCC"); gs.Offset = 0; brush.GradientStops.Add(gs); gs = new GradientStop(); gs.Color = Colors.Black; gs.Offset = 1; brush.GradientStops.Add(gs); gs = new GradientStop(); gs.Color = ConvertColor("#FFABABAB"); gs.Offset = 0.457; brush.GradientStops.Add(gs); gs = new GradientStop(); gs.Color = Colors.Black; gs.Offset = 0.53; brush.GradientStops.Add(gs); return brush; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.frame = ((System.Windows.Controls.Border)(target)); return; case 2: this.FaultStateGroup = ((System.Windows.VisualStateGroup)(target)); return; case 3: this.rt = ((System.Windows.Media.RotateTransform)(target)); return; case 4: this.gsGreen = ((System.Windows.Media.GradientStop)(target)); return; case 5: this.gsRed1 = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.GradientStop1 = ((System.Windows.Media.GradientStop)(target)); return; case 2: this.TextBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.RealText = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.MyTextEffect = ((System.Windows.Media.TextEffect)(target)); return; case 5: this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target)); return; case 6: this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target)); return; case 7: this.timeTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public RSSFeed() { InitializeComponent(); schoolInfo = new MySchoolInfo(); ApplicationBar.Opacity = 0.5; Rectangle verticalFillRectangle = new Rectangle(); verticalFillRectangle.Width = 200; verticalFillRectangle.Height = 100; //'Create a vertical linear gradient LinearGradientBrush myVerticalGradient = new LinearGradientBrush(); myVerticalGradient.StartPoint = new Point(0.5, 0); myVerticalGradient.EndPoint = new Point(0.5, 1); GradientStop stop1 = new GradientStop(); stop1.Color = schoolInfo.Color1.Color; stop1.Offset = 0.33; GradientStop stop2 = new GradientStop(); stop2.Color = schoolInfo.Color2.Color; stop2.Offset = 0.66; myVerticalGradient.GradientStops.Add(stop1); myVerticalGradient.GradientStops.Add(stop2); listboxRSSFeedItems.Background = myVerticalGradient; }
/// <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); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\UserInterface\CharacterUserControl.xaml" ((GuildWars2Helper.UserInterface.CharacterUserControl)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.CharacterUC = ((System.Windows.Controls.Grid)(target)); return; case 3: this.CharacherUCBackgroundColor = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.ColumnTwo = ((System.Windows.Controls.ColumnDefinition)(target)); return; case 5: this.Profession = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myStoryboard = ((System.Windows.Media.Animation.Storyboard)(target)); return; case 2: this.BottomBackgroundColor = ((System.Windows.Media.GradientStop)(target)); return; case 3: this.EllipseRotater = ((System.Windows.Media.RotateTransform)(target)); return; case 4: this.MiddleGradientStop = ((System.Windows.Media.GradientStop)(target)); return; case 5: this.TextSkewTransform = ((System.Windows.Media.SkewTransform)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\UserInterface\AccountOverview.xaml" ((GuildWars2Helper.UserInterface.AccountOverview)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.AccountOverviewUC = ((System.Windows.Controls.Grid)(target)); return; case 3: this.CharacherUCBackgroundColor = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.CharacterOverviewIC = ((System.Windows.Controls.ItemsControl)(target)); return; } this._contentLoaded = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Tetris7;component/Piece/Block.xaml", System.UriKind.Relative)); this.rectangle = ((System.Windows.Shapes.Rectangle)(this.FindName("rectangle"))); this.gradientStop = ((System.Windows.Media.GradientStop)(this.FindName("gradientStop"))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Animirani = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/MQuter-eLabApp;component/View/Components/Activity/IOGateComponent.xaml", System.UriKind.Relative)); this.Gate = ((System.Windows.Shapes.Ellipse)(this.FindName("Gate"))); this.GateBrush = ((System.Windows.Media.GradientStop)(this.FindName("GateBrush"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/MQuter-eLabApp;component/View/ParamIOGate.xaml", System.UriKind.Relative)); this.ParamConnecctor = ((System.Windows.Shapes.Rectangle)(this.FindName("ParamConnecctor"))); this.GateBrush = ((System.Windows.Media.GradientStop)(this.FindName("GateBrush"))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Grid = ((System.Windows.Controls.Grid)(target)); return; case 2: this.ctxMenu = ((System.Windows.Controls.ContextMenu)(target)); return; case 3: this.ctxMenu_AddContact = ((System.Windows.Controls.MenuItem)(target)); #line 12 "..\..\..\Items\ItemGroup.xaml" this.ctxMenu_AddContact.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_AddContact_Click); #line default #line hidden return; case 4: this.ctxMenu_EditGroup = ((System.Windows.Controls.MenuItem)(target)); #line 18 "..\..\..\Items\ItemGroup.xaml" this.ctxMenu_EditGroup.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_EditGroup_Click); #line default #line hidden return; case 5: this.ctxMenu_DeleteGroup = ((System.Windows.Controls.MenuItem)(target)); #line 23 "..\..\..\Items\ItemGroup.xaml" this.ctxMenu_DeleteGroup.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_DeleteGroup_Click); #line default #line hidden return; case 6: this.GridGradien = ((System.Windows.Media.LinearGradientBrush)(target)); return; case 7: this.GridGradienStop = ((System.Windows.Media.GradientStop)(target)); return; case 8: this.labelDisplayName = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.grad = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
private void OnButtonClick(object sender, RoutedEventArgs e) { GradientStop[] gradientStops = new GradientStop[] { new GradientStop(Colors.DarkGreen, 0), new GradientStop(Colors.White, 1) }; this.Resources["myBrush"] = new LinearGradientBrush( new GradientStopCollection(gradientStops)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.win = ((Sky_1._0.MainWindow)(target)); return; case 2: this.gri = ((System.Windows.Controls.Grid)(target)); return; case 3: this.map = ((System.Windows.Shapes.Rectangle)(target)); #line 19 "..\..\Window2.xaml" this.map.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Rectanglemap_MauseDown); #line default #line hidden return; case 4: this.mapim = ((System.Windows.Media.ImageBrush)(target)); return; case 5: this.sk = ((System.Windows.Shapes.Rectangle)(target)); #line 25 "..\..\Window2.xaml" this.sk.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Rectanglesk_MauseDown); #line default #line hidden return; case 6: this.skim = ((System.Windows.Media.ImageBrush)(target)); return; case 7: this.x = ((System.Windows.Shapes.Line)(target)); return; case 8: this.wi = ((System.Windows.Media.GradientStop)(target)); return; case 9: this.bl = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
public void ShowPopUp(UserControl abc, Point x) { LinearGradientBrush brush = new LinearGradientBrush(); GradientStop stop = new GradientStop(Colors.Azure, 0.0); GradientStop stop2 = new GradientStop(Colors.Black, 1.0); brush.GradientStops.Add(stop); brush.GradientStops.Add(stop2); this.g.Background = brush; this.popUp = new Window(); this.popUp.Title = "Dispositon Render"; this.popUp.Name = "PopUp"; this.popUp.AllowsTransparency = true; this.popUp.Background = Brushes.Transparent; this.popUp.WindowStyle = WindowStyle.None; this.popUp.ShowInTaskbar = true; //this.popUp.Topmost = true; this.popUp.Height = 400.0; this.popUp.Width = 230.0; this.popUp.MouseLeave += new MouseEventHandler(this.popUp_MouseLeave); double primaryScreenWidth = SystemParameters.PrimaryScreenWidth; double primaryScreenHeight = SystemParameters.PrimaryScreenHeight; double num3 = primaryScreenWidth - x.X; double num4 = primaryScreenHeight - x.Y; if (num3 < this.popUp.Width) { this.popUp.Left = primaryScreenWidth - this.popUp.Width; } else { this.popUp.Left = x.X - 80.0; if (this.popUp.Left < 0.0) { this.popUp.Left = 0.0; } } if (num4 < this.popUp.Height) { this.popUp.Top = primaryScreenHeight - this.popUp.Height; } else { this.popUp.Top = x.Y - 30.0; if (this.popUp.Top < 0.0) { this.popUp.Top = 0.0; } } this.g.Children.Add(abc); this.popUp.Content = this.g; this.popUp.Show(); }
//========================================================================== public GradientStop ToGradientStop() { Color color = Color.ToColor(); color.A = (byte)Math.Round(Opacity.ToDouble() * 255); GradientStop stop = new GradientStop(); stop.Color = color; stop.Offset = Offset.ToDouble(); return stop; }
/// <summary> /// Creates a gradient brush from a list of colors. /// </summary> /// <param name="colors">The colors.</param> /// <param name="horizontal">if set to <c>true</c> [horizontal].</param> /// <returns>A LinearGradientBrush.</returns> public static LinearGradientBrush CreateGradientBrush(IList<Color> colors, bool horizontal = true) { var brush = new LinearGradientBrush { StartPoint = new Point(0, 0), EndPoint = horizontal ? new Point(1, 0) : new Point(0, 1) }; int n = colors.Count; for (int i = 0; i < n; i++) { var gs = new GradientStop(colors[i], (double)i / (n - 1)); brush.GradientStops.Add(gs); } return brush; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is Color) { Color cColor = (Color)value; string TragetColor = string.Format(@"#{0:X2}{1:X2}{2:X2}{3:X2}", cColor.A, cColor.R, cColor.G, cColor.B); return(TragetColor); } if (value is StyleColor) { var sc = (StyleColor)value; if (sc.FillType == ColorFillType.Solid) { return(new System.Windows.Media.SolidColorBrush(this.FromArgb(sc.ARGB))); } else if (sc.FillType == ColorFillType.Gradient) { var lineb = new System.Windows.Media.LinearGradientBrush(); lineb.StartPoint = new System.Windows.Point(0d, 0.5d); lineb.EndPoint = new System.Windows.Point(1d, 0.5d); var newFrames = sc.Frames; if (newFrames == null || newFrames.Count == 0) { newFrames = new Dictionary <double, int>(); newFrames[0] = -1; newFrames[1] = -16777216; } foreach (var keypair in newFrames) { var gradientStop = new System.Windows.Media.GradientStop( this.FromArgb(keypair.Value), keypair.Key); lineb.GradientStops.Add(gradientStop); } var aRotateTransform = new System.Windows.Media.RotateTransform(); aRotateTransform.CenterX = 0.5; aRotateTransform.CenterY = 0.5; aRotateTransform.Angle = sc.Angle; lineb.RelativeTransform = aRotateTransform; return(lineb); } } else { return(new System.Windows.Media.SolidColorBrush(Color.FromArgb(0, 255, 255, 255))); } return(Brushes.White); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var start = new GradientStop { Offset = 0.9, Color = ((Color) value) }; var stop = new GradientStop { Offset = 1, Color = Colors.Transparent }; var result = new RadialGradientBrush { GradientStops = new GradientStopCollection {start, stop} }; return result; }
private Brush getGradientBrush(Color color1, Color color2, int stopColor1, int stopColor2) { Point startPoint = new Point(0.5, 0); Point endPoint = new Point(0.5, 1); GradientStop stop1 = new GradientStop(color1, stopColor1); GradientStop stop2 = new GradientStop(color2, stopColor2); GradientStopCollection stops = new GradientStopCollection() { stop1, stop2 }; return new LinearGradientBrush(stops, startPoint, endPoint); }
public static LinearGradientBrush ChangeBackgroundColor(Color c) { var gs1 = new GradientStop(Colors.White, 0); var gs2 = new GradientStop(c, 1); var gsc = new GradientStopCollection {gs1, gs2}; var lgb = new LinearGradientBrush { StartPoint = new Point(0, 0), EndPoint = new Point(0, 1), GradientStops = gsc }; return lgb; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.shadowOuterStop1 = (GradientStop)base.GetTemplateChild("PART_ShadowOuterStop1"); this.shadowOuterStop2 = (GradientStop)base.GetTemplateChild("PART_ShadowOuterStop2"); this.shadowVertical1 = (GradientStop)base.GetTemplateChild("PART_ShadowVertical1"); this.shadowVertical2 = (GradientStop)base.GetTemplateChild("PART_ShadowVertical2"); this.shadowHorizontal1 = (GradientStop)base.GetTemplateChild("PART_ShadowHorizontal1"); this.shadowHorizontal2 = (GradientStop)base.GetTemplateChild("PART_ShadowHorizontal2"); this.outerGlowBorder = (Border)base.GetTemplateChild("PART_OuterGlowBorder"); this.UpdateGlowSize(this.OuterGlowSize); this.UpdateGlowColor(this.OuterGlowColor); }
public RadialGradientBrush (Color startColor, Color endColor) : this () { GradientStop start = new GradientStop (); start.Color = startColor; start.Offset = 0.0d; GradientStops.Add (start); GradientStop stop = new GradientStop (); stop.Color = endColor; stop.Offset = 1.0d; GradientStops.Add (stop); }
public BasicLED() { InitializeComponent(); ellipseRGB = ellipse.Fill as RadialGradientBrush; ellipseRGB_GS1 = ellipseRGB.GradientStops[0]; ellipseRGB_GS2 = ellipseRGB.GradientStops[1]; lastIsActive = false; lastActiveColor = lastInactiveColor = ellipseRGB_GS2.Color; lastHighlightColor = ellipseRGB_GS1.Color; lastBorderWidth = ellipse.StrokeThickness; }
private void SetBackground() { var brush = new LinearGradientBrush { StartPoint = new Point(0.5, 0.0), EndPoint = new Point(0.5, 1.0) }; var spectrumColors = ColorUtils.GetSpectrumColors(30); for (var i = 0; i < 30; i++) { var offset = (i * 1.0) / 30.0; var stop = new GradientStop(spectrumColors[i], offset); brush.GradientStops.Add(stop); } Background = brush; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.input_path = ((System.Windows.Controls.TextBox)(target)); #line 19 "..\..\PathSelect.xaml" this.input_path.KeyDown += new System.Windows.Input.KeyEventHandler(this.TextBox_KeyDown); #line default #line hidden #line 19 "..\..\PathSelect.xaml" this.input_path.LostFocus += new System.Windows.RoutedEventHandler(this.input_path_LostFocus); #line default #line hidden #line 19 "..\..\PathSelect.xaml" this.input_path.GotFocus += new System.Windows.RoutedEventHandler(this.input_path_GotFocus); #line default #line hidden #line 19 "..\..\PathSelect.xaml" this.input_path.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.input_path_TextChanged); #line default #line hidden return; case 2: this.lamp = ((System.Windows.Shapes.Ellipse)(target)); return; case 3: this.lamp_edge = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.lamp_center = ((System.Windows.Media.GradientStop)(target)); return; case 5: this.lamp_middle = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
public static LinearGradientBrush CreateLinearGradientBrush1() { LinearGradientBrush brush = new LinearGradientBrush(); brush.EndPoint = new Point(0.5, 1); brush.StartPoint = new Point(0.5, 0); GradientStop stop1 = new GradientStop(); stop1.Color = Color.FromArgb(112, 168, 216, 224); stop1.Offset = 0; GradientStop stop2 = new GradientStop(); stop2.Color = Color.FromArgb(255, 176, 201, 146); stop2.Offset = 1; brush.GradientStops.Add(stop1); brush.GradientStops.Add(stop2); return brush; }
private void SetBackground() { LinearGradientBrush brush = new LinearGradientBrush { StartPoint = new Point(0.5, 0.0), EndPoint = new Point(0.5, 1.0) }; Color[] spectrumColors = ColorUtils.GetSpectrumColors(30); for (int i = 0; i < 30; i++) { double offset = (i * 1.0) / 30.0; GradientStop stop = new GradientStop(spectrumColors[i], offset); brush.GradientStops.Add(stop); } base.Background = brush; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.tb_ID = ((System.Windows.Controls.TextBlock)(target)); #line 17 "..\..\ProjectItem.xaml" this.tb_ID.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.LeftMouseClick); #line default #line hidden return; case 2: this.tb_Name = ((System.Windows.Controls.TextBlock)(target)); #line 18 "..\..\ProjectItem.xaml" this.tb_Name.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.LeftMouseClick); #line default #line hidden return; case 3: this.image = ((System.Windows.Controls.Image)(target)); #line 19 "..\..\ProjectItem.xaml" this.image.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.LeftMouseClick); #line default #line hidden return; case 4: this.progressBar = ((System.Windows.Controls.ProgressBar)(target)); return; case 5: this.sb_ProgressShiny = ((System.Windows.Media.Animation.Storyboard)(target)); return; case 6: this.ShinyPoint = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Input string must be in the format "#007FFF:0.5". /// Hex strings can be either 6 or eight X-chars long and may or not /// start with "0x" and "#". /// </summary> public static GradientStop ToGradientStop(this string input) { var data = input.Clean(); if (!data.Contains(":")) return new GradientStop(data.ToColor(),0); var ray = data.Split(':'); var offset = Double.NaN; var result = new GradientStop{ Color=ray[0].ToColor(), Offset = double.TryParse(ray[1], out offset) ? offset : 0 }; ray = null; data = null; return result; }
public UIWithBoundBrush() { var rectangle = new Rectangle(); var brush = new LinearGradientBrush(); var stop = new GradientStop(); var binding = new Binding("Stop12"); //not correct BindingOperations.SetBinding(stop, GradientStop.OffsetProperty, binding); brush.GradientStops.Add(stop); rectangle.Fill = brush; Content = rectangle; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Talentos_Master;component/ButtonSeven.xaml", System.UriKind.Relative)); this.animEnter = ((System.Windows.Media.Animation.Storyboard)(this.FindName("animEnter"))); this.animLeave = ((System.Windows.Media.Animation.Storyboard)(this.FindName("animLeave"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.brushLight = ((System.Windows.Media.RadialGradientBrush)(this.FindName("brushLight"))); this.transitionColor = ((System.Windows.Media.GradientStop)(this.FindName("transitionColor"))); this.transitionSubColor = ((System.Windows.Media.GradientStop)(this.FindName("transitionSubColor"))); this.imgItem = ((System.Windows.Controls.Image)(this.FindName("imgItem"))); }
protected override void UpdateBackground() { // background color change must be handled separately // because the background would protrude through the border if the corners are rounded // as the background would be applied to the renderer's FrameworkElement var pancake = (PancakeView)Element; if (Control != null) { if ((pancake.BackgroundGradientStartColor != default(Color) && pancake.BackgroundGradientEndColor != default(Color)) || (pancake.BackgroundGradientStops != null && pancake.BackgroundGradientStops.Any())) { // Create a gradient layer that draws our background. if (pancake.BackgroundGradientStops != null && pancake.BackgroundGradientStops.Count > 0) { // A range of colors is given. Let's add them. var orderedStops = pancake.BackgroundGradientStops.OrderBy(x => x.Offset).ToList(); var gc = new System.Windows.Media.GradientStopCollection(); foreach (var item in orderedStops) { gc.Add(new System.Windows.Media.GradientStop { Offset = item.Offset, Color = item.Color.ToMediaColor() }); } this.Control.Background = new LinearGradientBrush(gc, pancake.BackgroundGradientAngle); } else { var gs1 = new System.Windows.Media.GradientStop { Offset = 0, Color = pancake.BackgroundGradientStartColor.ToMediaColor() }; var gs2 = new System.Windows.Media.GradientStop { Offset = 1, Color = pancake.BackgroundGradientEndColor.ToMediaColor() }; var gc = new System.Windows.Media.GradientStopCollection { gs1, gs2 }; this.Control.Background = new LinearGradientBrush(gc, pancake.BackgroundGradientAngle); } } else { Control.Background = Element.BackgroundColor.IsDefault ? null : Element.BackgroundColor.ToBrush(); } } }
public void SetSizeBg() { if (this.Tag != null) { if (this.Tag is ButtomControl) { var obj = this.Tag as ButtomControl; this.Width = obj.ButtomOR.ButtonWidth; this.Height = obj.ButtomOR.ButtonHeight; if (string.IsNullOrEmpty(obj.ButtomOR.Bg)) obj.ButtomOR.Bg = "bg1.png"; string mPath = Common.GetStartpath() + "Resources\\Buttonbg\\" + obj.ButtomOR.Bg; if (!System.IO.File.Exists(mPath)) { LinearGradientBrush FColor = new LinearGradientBrush(); FColor.StartPoint = new Point(0.5, 1); FColor.EndPoint = new Point(0.5, 0); GradientStop g = new GradientStop(); g.Color = Colors.White; FColor.GradientStops.Add(g); g = new GradientStop(); g.Color = Converter.ToColor("#FFCED4D9"); g.Offset = 1; FColor.GradientStops.Add(g); rect.Fill = FColor; } else { //BitmapImage bitmap = new BitmapImage(new Uri(gbUrl, UriKind.Absolute)); ImageBrush img = new ImageBrush() { ImageSource = new BitmapImage(new Uri(mPath, UriKind.Absolute)) }; //ImageBrush img = new ImageBrush(); //img.ImageSource = img; img.Stretch = Stretch.Fill; rect.Fill = img; } } } }
private void SetBackground() { LinearGradientBrush backgroundBrush = new LinearGradientBrush(); backgroundBrush.StartPoint = new Point(0.5, 0); backgroundBrush.EndPoint = new Point(0.5, 1); const int spectrumColorCount = 30; Color[] spectrumColors = ColorUtils.GetSpectrumColors(spectrumColorCount); for (int i = 0; i < spectrumColorCount; ++i) { double offset = i * 1.0 / spectrumColorCount; GradientStop gradientStop = new GradientStop(spectrumColors[i], offset); backgroundBrush.GradientStops.Add(gradientStop); } Background = backgroundBrush; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: this.displayColor = ((System.Windows.Media.GradientStop)(target)); return; case 3: this.rectMonitor = ((System.Windows.Shapes.Rectangle)(target)); #line 24 "..\..\..\Controls\AlphaSelectControl.xaml" this.rectMonitor.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.rectMonitor_MouseLeftButtonDown); #line default #line hidden #line 25 "..\..\..\Controls\AlphaSelectControl.xaml" this.rectMonitor.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.rectMonitor_MouseLeftButtonUp); #line default #line hidden #line 26 "..\..\..\Controls\AlphaSelectControl.xaml" this.rectMonitor.MouseMove += new System.Windows.Input.MouseEventHandler(this.rectMonitor_MouseMove); #line default #line hidden #line 27 "..\..\..\Controls\AlphaSelectControl.xaml" this.rectMonitor.LostMouseCapture += new System.Windows.Input.MouseEventHandler(this.rectMonitor_LostMouseCapture); #line default #line hidden return; case 4: this.rectMarker = ((System.Windows.Controls.Canvas)(target)); return; } this._contentLoaded = true; }
public object Convert( object value, Type targetType, object parameter, CultureInfo culture) { Color c = (Color)value; RadialGradientBrush radBrush = new RadialGradientBrush(); GradientStop g1 = new GradientStop(); g1.Offset = 0.982; g1.Color = c; GradientStop g2 = new GradientStop(); g2.Color = Color.FromArgb(0xFF, 0xAF, 0xB2, 0xB0); radBrush.GradientStops.Add(g1); radBrush.GradientStops.Add(g2); return radBrush; }
private void UpdateBorder(PancakeView pancake) { //// Create the border layer if (Control != null) { this.Control.BorderThickness = new System.Windows.Thickness(pancake.BorderThickness); if ((pancake.BorderGradientStartColor != default(Color) && pancake.BorderGradientEndColor != default(Color)) || (pancake.BorderGradientStops != null && pancake.BorderGradientStops.Any())) { // Create a gradient layer that draws our background. if (pancake.BorderGradientStops != null && pancake.BorderGradientStops.Count > 0) { // A range of colors is given. Let's add them. var orderedStops = pancake.BorderGradientStops.OrderBy(x => x.Offset).ToList(); var gc = new System.Windows.Media.GradientStopCollection(); foreach (var item in orderedStops) { gc.Add(new System.Windows.Media.GradientStop { Offset = item.Offset, Color = item.Color.ToMediaColor() }); } this.Control.BorderBrush = new LinearGradientBrush(gc, pancake.BorderGradientAngle); } else { var gs1 = new System.Windows.Media.GradientStop { Offset = 0, Color = pancake.BorderGradientStartColor.ToMediaColor() }; var gs2 = new System.Windows.Media.GradientStop { Offset = 1, Color = pancake.BorderGradientEndColor.ToMediaColor() }; var gc = new System.Windows.Media.GradientStopCollection { gs1, gs2 }; this.Control.BorderBrush = new LinearGradientBrush(gc, pancake.BorderGradientAngle); } } else { this.Control.BorderBrush = pancake.BorderColor.IsDefault ? null : pancake.BorderColor.ToBrush(); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.gridBigLed = ((System.Windows.Controls.Grid)(target)); return; case 2: this.border1 = ((System.Windows.Controls.Border)(target)); return; case 3: this.backgroundColor = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }
Color GetPrevColor(float offset) { GradientStop frame = null; foreach (var f in this.GradientStops) { if (f.Offset <= offset && (frame == null || (frame != null && f.Offset > frame.Offset))) { frame = f; } } if (frame != null) { return(frame.Color); } return(Colors.Transparent); }
float GetNextOffset(float offset) { GradientStop frame = null; foreach (var f in this.GradientStops) { if (f.Offset > offset && (frame == null || (frame != null && f.Offset < frame.Offset))) { frame = f; } } if (frame != null) { return(frame.Offset); } return(float.NaN); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.background = ((System.Windows.Media.GradientStop)(target)); return; case 2: this.title = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.levels = ((System.Windows.Controls.StackPanel)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ButtonFechar = ((System.Windows.Controls.Button)(target)); #line 92 "..\..\MainWindow.xaml" this.ButtonFechar.Click += new System.Windows.RoutedEventHandler(this.ButtonFechar_Click); #line default #line hidden return; case 2: this.c1 = ((System.Windows.Media.GradientStop)(target)); return; case 3: this.c2 = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.Anterior = ((System.Windows.Controls.Button)(target)); #line 157 "..\..\MainWindow.xaml" this.Anterior.Click += new System.Windows.RoutedEventHandler(this.Anterior_Click); #line default #line hidden return; case 5: this.Proxima = ((System.Windows.Controls.Button)(target)); #line 184 "..\..\MainWindow.xaml" this.Proxima.Click += new System.Windows.RoutedEventHandler(this.Proxima_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LoadedDoubleAnimation = ((System.Windows.Media.Animation.DoubleAnimation)(target)); return; case 2: this.PanelItemBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.stop1 = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.PanelItemGrid = ((System.Windows.Controls.Grid)(target)); return; case 5: this.PanelItemImage = ((System.Windows.Controls.Image)(target)); return; case 6: this.PanelItemModuleLabel = ((System.Windows.Controls.Label)(target)); return; case 7: this.PanelItemDetails = ((System.Windows.Controls.Label)(target)); return; case 8: this.rectangle1 = ((System.Windows.Controls.Canvas)(target)); #line 49 "..\..\..\..\Internal\CustomControls\StackPanelModuleElement.xaml" this.rectangle1.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.OnDoubleClick); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Grid1 = ((System.Windows.Controls.Grid)(target)); return; case 2: this.BatteryCap = ((System.Windows.Shapes.Rectangle)(target)); return; case 3: this.BatteryProgressBar = ((System.Windows.Controls.ProgressBar)(target)); return; case 4: this.GS_0 = ((System.Windows.Media.GradientStop)(target)); return; case 5: this.GS_1 = ((System.Windows.Media.GradientStop)(target)); return; case 6: this.GS_2 = ((System.Windows.Media.GradientStop)(target)); return; case 7: this.GS_3 = ((System.Windows.Media.GradientStop)(target)); return; case 8: this.Polygon_Charge = ((System.Windows.Shapes.Polygon)(target)); return; case 9: this.TextBlockProgress = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.gridLayout = ((System.Windows.Controls.Grid)(target)); return; case 2: this.og0 = ((System.Windows.Media.GradientStop)(target)); return; case 3: this.og1 = ((System.Windows.Media.GradientStop)(target)); return; case 4: this.qrFrameScan = ((System.Windows.Media.ScaleTransform)(target)); return; case 5: this.qrScan = ((System.Windows.Media.ScaleTransform)(target)); return; case 6: this.rectHead = ((System.Windows.Shapes.Rectangle)(target)); return; case 7: this.tbError = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.tbtnActive = ((System.Windows.Controls.Primitives.ToggleButton)(target)); return; case 9: this.pathEff = ((System.Windows.Shapes.Path)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\Other\WaitBar.xaml" ((天蘩工具箱.Other.WaitBar)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.gridContent = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ellipse = ((System.Windows.Shapes.Ellipse)(target)); return; case 4: this.cvs = ((System.Windows.Controls.Canvas)(target)); return; case 5: this.SpinnerRotate = ((System.Windows.Media.RotateTransform)(target)); return; case 6: this.rollColor = ((System.Windows.Media.GradientStop)(target)); return; case 7: this.txtblProgress = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this._MonitorUC = ((UbiDisplays.Interface.Controls.Monitor)(target)); return; case 2: this.gs0 = ((System.Windows.Media.GradientStop)(target)); return; case 3: this.gs1 = ((System.Windows.Media.GradientStop)(target)); return; case 4: this._Container = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.button1 = ((System.Windows.Controls.Button)(target)); return; case 2: this.ButtonBack = ((System.Windows.Media.SolidColorBrush)(target)); return; case 3: this.button2 = ((System.Windows.Controls.Button)(target)); return; case 4: this.ButtonBack2 = ((System.Windows.Media.GradientStop)(target)); return; } this._contentLoaded = true; }