本文整理汇总了C#中System.Windows.Media.LinearGradientBrush类的典型用法代码示例。如果您正苦于以下问题:C# LinearGradientBrush类的具体用法?C# LinearGradientBrush怎么用?C# LinearGradientBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearGradientBrush类属于System.Windows.Media命名空间,在下文中一共展示了LinearGradientBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Meter8
public Meter8()
{
var borderBrush = new LinearGradientBrush();
borderBrush.StartPoint = new Point();
borderBrush.EndPoint = new Point(1d, 1d);
borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0d });
borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0.4999d });
borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x84, 0x7B, 0x6C), Offset = 0.5d });
borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x84, 0x7B, 0x6C), Offset = 1d });
var border = new Rectangle();
border.Fill = borderBrush;
//border.Stroke = new SolidColorBrush(Colors.Black);
//border.StrokeThickness = 1d;
var background = new Rectangle();
background.Fill = new SolidColorBrush(Color.FromArgb(0xff, 0xAD, 0xA7, 0x9D));
background.Margin = new Thickness(4d);
var grid = new Grid();
grid.Children.Add(border);
grid.Children.Add(background);
grid.Children.Add(_canvas);
grid.Children.Add(_calibrationCanvas);
this.Content = grid;
_label.Text = Value.ToString();
_label.Foreground = new SolidColorBrush(ForeColor);
_pointLine.Stroke = new SolidColorBrush(Colors.Red);
_pointLine.StrokeThickness = 2d;
this.SizeChanged += Meter_SizeChanged;
}
开发者ID:Jitlee,项目名称:MonitorProject,代码行数:33,代码来源:Meter8.cs
示例2: SetCustomData
/// <summary>
/// Main windows에 적용 할 수 있는 간략한 Data 테스트
/// </summary>
private void SetCustomData()
{
// 제목
Title = "Display Some Text";
//// 현재 창에 나타날 data
//Content = "Content can be simple text!";
// font 지정
FontFamily = new FontFamily("Comic Sans MS");
FontSize = 48;
// gradient 효과가 적용된 Brush
Brush brush = new LinearGradientBrush(Colors.Black, Colors.White, new Point(0,0), new Point(1,1));
Background = brush;
Foreground = brush;
// 현재 창의 content 내용에 따라 창의 크기를 조절 할 수 있는 값
SizeToContent = SizeToContent.WidthAndHeight;
// 현재 창의 Resizing 방법 지정
ResizeMode = ResizeMode.CanMinimize;
}
开发者ID:yoosuphwang,项目名称:DotNet_App,代码行数:28,代码来源:MainWindow.xaml.cs
示例3: CreateTestScrollViewer
/// <summary>
/// Create a ScrollViewer that can be used by the tests.
/// </summary>
/// <returns>A ScrollViewer that can be used by the tests.</returns>
private static ScrollViewer CreateTestScrollViewer()
{
LinearGradientBrush brush = new LinearGradientBrush
{
StartPoint = new Point(),
EndPoint = new Point(1, 1)
};
brush.GradientStops.Add(new GradientStop { Offset = 0, Color = Colors.Red });
brush.GradientStops.Add(new GradientStop { Offset = 1, Color = Colors.Blue });
Canvas panel = new Canvas
{
Height = 400,
Width = 400,
Background = brush
};
return new ScrollViewer
{
Height = 100,
Width = 100,
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
Content = panel
};
}
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:30,代码来源:ScrollViewerExtensionsTest.cs
示例4: ResizeChrome
static ResizeChrome()
{
TransparentBrush = Brushes.Transparent;
TransparentBrush.Freeze();
var borderBrush = new LinearGradientBrush()
{
Opacity = 0.7,
StartPoint = new Point(0, 0),
EndPoint = new Point(1, 0.3),
};
borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 0));
borderBrush.GradientStops.Add(new GradientStop(Colors.LightBlue, 0.5));
borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 1));
borderBrush.Freeze();
BorderBrush = borderBrush;
var thumbBrush = new RadialGradientBrush()
{
Center = new Point(0.3, 0.3),
GradientOrigin = new Point(0.3, 0.3),
RadiusX = 0.7,
RadiusY = 0.7,
};
thumbBrush.GradientStops.Add(new GradientStop(Colors.White, 0));
thumbBrush.GradientStops.Add(new GradientStop(Colors.DarkSlateBlue, 0.9));
thumbBrush.Freeze();
ThumbBrush = thumbBrush;
TransparentPen = new Pen(TransparentBrush, 3.5);
BorderPen = new Pen(BorderBrush, 2);
BorderPen.DashStyle = DashStyles.Dash;
ThumbGeometry = new EllipseGeometry();
UpdateZoom(1);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:33,代码来源:ResizeChrome.cs
示例5: setgradient
public void setgradient(Panel elm)
{
LinearGradientBrush myBrush = new LinearGradientBrush();
Point startpoint = new Point();
int angle = CommunConfig.getInstance().Angle;
startpoint.X = System.Math.Cos(((double)angle / 180) * System.Math.PI)/2 + 0.5;
startpoint.Y = System.Math.Sin(((double)angle / 180) * System.Math.PI)/2 + 0.5;
angle -= 180;
Point endpoint = new Point();
endpoint.X = System.Math.Cos(((double)angle / 180) * System.Math.PI)/2 +0.5;
endpoint.Y = System.Math.Sin(((double)angle / 180) * System.Math.PI)/2 +0.5;
myBrush.StartPoint = startpoint;
myBrush.EndPoint = endpoint;
System.Windows.Media.Color c = new Color();
System.Drawing.Color drawingColor = CommunConfig.getInstance().StartColor;
c = System.Windows.Media.Color.FromRgb(drawingColor.R, drawingColor.G, drawingColor.B);
myBrush.GradientStops.Add(new GradientStop(c, 1));
drawingColor = CommunConfig.getInstance().EndColor;
c = System.Windows.Media.Color.FromRgb(drawingColor.R, drawingColor.G, drawingColor.B);
myBrush.GradientStops.Add(new GradientStop(c, 0));
elm.Background = myBrush;
}
开发者ID:zebulon75018,项目名称:photochoicetouch,代码行数:27,代码来源:gradientManager.cs
示例6: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var color = (string) value;
try
{
TypeConverter colorConverter = new ColorConverter();
var baseColor = (Color) colorConverter.ConvertFromString(color);
var c2 = Color.FromArgb(25, baseColor.R, baseColor.G, baseColor.B);
var colorBrush = new LinearGradientBrush();
colorBrush.StartPoint = new Point(0, 0);
colorBrush.EndPoint = new Point(0, 1);
colorBrush.GradientStops.Add(new GradientStop(c2, 0.15));
colorBrush.GradientStops.Add(new GradientStop(baseColor, 0.85));
colorBrush.GradientStops.Add(new GradientStop(c2, 1));
return colorBrush;
}
catch (Exception)
{
return Brushes.DarkRed;
}
}
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:25,代码来源:Converters.cs
示例7: ProgressColorChanged
private static void ProgressColorChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
ProgressBarGame senderCast = sender as ProgressBarGame;
if (senderCast == null)
{
return; // this should never happen
}
Color color = (Color)e.NewValue;
// Turn the color into a slight gradient
LinearGradientBrush brush = new LinearGradientBrush();
brush.StartPoint = new Point(0, 0);
brush.EndPoint = new Point(0, 1);
GradientStopCollection gradients = new GradientStopCollection();
gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.White, color, .5d), 0d));
gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.White, color, .25d), .1d));
gradients.Add(new GradientStop(color, .4d));
gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.Black, color, .2d), .9d));
gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.Black, color, .25d), 1d));
brush.GradientStops = gradients;
// The progress bar is actually tied to this property
senderCast.ProgressBrush = brush;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:26,代码来源:ProgressBarGame.xaml.cs
示例8: ZomingAndPanningExample
public ZomingAndPanningExample()
{
InitializeComponent();
var gradientBrush = new LinearGradientBrush
{
StartPoint = new System.Windows.Point(0, 0),
EndPoint = new Point(0, 1)
};
gradientBrush.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromRgb(33, 148, 241), 0));
gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));
cartesianChart1.Series.Add(new LineSeries
{
Values = GetData(),
Fill = gradientBrush,
StrokeThickness = 1,
PointGeometry = null
});
cartesianChart1.Zoom = ZoomingOptions.X;
cartesianChart1.AxisX.Add(new Axis
{
LabelFormatter = val => new System.DateTime((long)val).ToString("dd MMM")
});
cartesianChart1.AxisY.Add(new Axis
{
LabelFormatter = val => val.ToString("C")
});
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:32,代码来源:ZomingAndPanningExample.cs
示例9: GradientTheBrush
public GradientTheBrush()
{
Title = "Gradient the Brush";
LinearGradientBrush brush = new LinearGradientBrush(Colors.Red, Colors.Blue, new Point(0, 0), new Point(1, 1));
Background = brush;
brush.SpreadMethod = GradientSpreadMethod.Reflect;
}
开发者ID:volkoff-pro,项目名称:Petzold.WPF,代码行数:7,代码来源:GradientTheBrush.cs
示例10: Convert
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);
}
}
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:26,代码来源:BoolToColorConverter.cs
示例11: LinearGradientColorBrush
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;
}
开发者ID:dfberry,项目名称:WAZDash,代码行数:31,代码来源:StatusColor.cs
示例12: GetLineBrush
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;
}
开发者ID:dalinhuang,项目名称:my-un-code,代码行数:34,代码来源:Color.cs
示例13: LinearGradientAnimation
public LinearGradientAnimation(LinearGradientBrush fromValue, LinearGradientBrush toValue, Duration duration)
: this()
{
this.From = fromValue;
this.To = toValue;
base.Duration = duration;
}
开发者ID:jez9999,项目名称:Git-GUI,代码行数:7,代码来源:LinearGradientAnimation.cs
示例14: setBackground
public void setBackground()
{
Point p1 = new Point(0,0);
Point p2 = new Point(1.5,1);
switch (strFertigungsstatus)
{
case "Planung":
Background = new LinearGradientBrush(Colors.Orange,Colors.Transparent,p1,p2);
break;
case "Montage":
Background = new LinearGradientBrush(Colors.MediumTurquoise,Colors.Transparent,p1,p2);
break;
case "Prüfbereit":
Background = new LinearGradientBrush(Colors.Orchid,Colors.Transparent,p1,p2);
break;
case "Prüfung":
Background = new LinearGradientBrush(Colors.DeepSkyBlue,Colors.Transparent,p1,p2);
break;
case "Komplettierung":
Background = new LinearGradientBrush(Colors.LightSkyBlue,Colors.Transparent,p1,p2);
break;
case "Versendet":
Background = new LinearGradientBrush(Colors.GreenYellow,Colors.Transparent,p1,p2);
break;
default:
Background = new LinearGradientBrush(Colors.White,Colors.Transparent,p1,p2);
break;
}
}
开发者ID:FabianHeiss,项目名称:FBE2.MaXolution.Fertigungsplanung,代码行数:29,代码来源:Fertigungsstatus.cs
示例15: PaintBackground
private void PaintBackground()
{
var backgroundSquare = new GeometryDrawing(Brushes.Black, null, new RectangleGeometry(new Rect(0, 0, 100, 100)));
var aGeometryGroup = new GeometryGroup();
aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(0, 0, 50, 50)));
aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(50, 50, 50, 50)));
var checkerBrush = new LinearGradientBrush();
checkerBrush.GradientStops.Add(new GradientStop(Colors.Black, 0.0));
checkerBrush.GradientStops.Add(new GradientStop(Color.FromRgb(0, 22, 0), 1.0));
var checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup);
var checkersDrawingGroup = new DrawingGroup();
checkersDrawingGroup.Children.Add(backgroundSquare);
checkersDrawingGroup.Children.Add(checkers);
var myBrush = new DrawingBrush
{
Drawing = checkersDrawingGroup,
Viewport = new Rect(0, 0, 0.02, 0.02),
TileMode = TileMode.Tile,
Opacity = 0.5
};
LayoutRoot.Background = myBrush;
}
开发者ID:estromsnes,项目名称:CodeNinjaSpy,代码行数:28,代码来源:CodeNinjaSpyShell.xaml.cs
示例16: UpdateFill
public void UpdateFill(CoreColor min, CoreColor max)
{
Background = new LinearGradientBrush
{
StartPoint = new Point(0, 0),
EndPoint = new Point(0, 1),
GradientStops = new GradientStopCollection
{
new GradientStop
{
Color = new Color
{
A = min.A,
R = min.R,
G = min.G,
B = min.B
},
Offset = 0
},
new GradientStop
{
Color = new Color
{
A = max.A,
R = max.R,
G = max.G,
B = max.B
},
Offset = 1
}
}
};
}
开发者ID:Coder420,项目名称:Live-Charts,代码行数:33,代码来源:HeatColorRange.xaml.cs
示例17: LinearCanvasGradient
public LinearCanvasGradient(double x0, double y0, double x1, double y1)
{
_brush = new LinearGradientBrush();
_brush.StartPoint = new Point(x0, y0);
_brush.EndPoint = new Point(x1, y1);
_brush.MappingMode = BrushMappingMode.Absolute;
}
开发者ID:podlipensky,项目名称:sharpcanvas,代码行数:7,代码来源:LinearCanvasGradient.cs
示例18: CreateGradientBrush
private static LinearGradientBrush CreateGradientBrush(Orientation orientation, params Color[] colors)
{
var brush = new LinearGradientBrush();
var negatedStops = 1 / (float) colors.Length;
for (var i = 0; i < colors.Length; i++)
{
brush.GradientStops.Add(new GradientStop { Offset = negatedStops * i, Color = colors[i] });
}
// creating the full loop
brush.GradientStops.Add(new GradientStop { Offset = negatedStops * colors.Length, Color = colors[0] });
if (orientation == Orientation.Vertical)
{
brush.StartPoint = new Point(0, 1);
brush.EndPoint = new Point();
}
else
{
brush.EndPoint = new Point(1, 0);
}
return brush;
}
开发者ID:selaromdotnet,项目名称:Coding4FunToolkit,代码行数:25,代码来源:ColorSpace.cs
示例19: ZoomingAndPanning
public ZoomingAndPanning()
{
InitializeComponent();
var gradientBrush = new LinearGradientBrush {StartPoint = new Point(0, 0),
EndPoint = new Point(0, 1)};
gradientBrush.GradientStops.Add(new GradientStop(Color.FromRgb(33, 148, 241), 0));
gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Values = GetData(),
Fill = gradientBrush,
StrokeThickness = 1,
PointGeometrySize = 0
}
};
ZoomingMode = ZoomingOptions.X;
XFormatter = val => new DateTime((long) val).ToString("dd MMM");
YFormatter = val => val.ToString("C");
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:27,代码来源:ZoomingAndPanning.xaml.cs
示例20: Process
private static void Process(IList<ComposerEraViewModel> composerEraViewModels)
{
var count = composerEraViewModels.Count;
for (int i = 0; i < count - 1; i++)
{
var era1StartDate = composerEraViewModels[i].Dates.Earliest();
var era1EndDate = composerEraViewModels[i].Dates.Latest();
var era2StartDate = composerEraViewModels[i + 1].Dates.Earliest();
var era2EndDate = composerEraViewModels[i + 1].Dates.Latest();
if (era2StartDate < era1EndDate)
{
var transitionBrush = new LinearGradientBrush();
transitionBrush.StartPoint = new Point(0, 0.5);
transitionBrush.EndPoint = new Point(1, 0.5);
transitionBrush.GradientStops.Add(new GradientStop(((SolidColorBrush)composerEraViewModels[i].Background).Color, 0));
transitionBrush.GradientStops.Add(new GradientStop(((SolidColorBrush)composerEraViewModels[i + 1].Background).Color, 1));
var transitionEra = new ComposerEraViewModel(null, new ExtendedDateTimeInterval(era2StartDate, era1EndDate), transitionBrush, Brushes.White);
composerEraViewModels[i].Dates = new ExtendedDateTimeInterval(era1StartDate, era2StartDate);
composerEraViewModels[i + 1].Dates = new ExtendedDateTimeInterval(era1EndDate, era2EndDate);
composerEraViewModels.Add(transitionEra);
}
}
}
开发者ID:nharren,项目名称:MusicTimeline,代码行数:29,代码来源:ComposerEraViewModelBuilder.cs
注:本文中的System.Windows.Media.LinearGradientBrush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论