本文整理汇总了C#中System.Windows.Media.RadialGradientBrush类的典型用法代码示例。如果您正苦于以下问题:C# RadialGradientBrush类的具体用法?C# RadialGradientBrush怎么用?C# RadialGradientBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RadialGradientBrush类属于System.Windows.Media命名空间,在下文中一共展示了RadialGradientBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: getBrushFromColorRadialGradient
public static Brush getBrushFromColorRadialGradient(Color color)
{
RadialGradientBrush b = new RadialGradientBrush();
b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
return b;
}
开发者ID:kopfnuss,项目名称:starFlowers,代码行数:7,代码来源:ColorsAndBrushes.cs
示例2: OnReplaceBrush
private void OnReplaceBrush(object sender, RoutedEventArgs e)
{
var brush = new RadialGradientBrush();
brush.GradientStops.Add(new GradientStop(Colors.Blue, 0));
brush.GradientStops.Add(new GradientStop(Colors.White, 1));
this.Resources["brush1"] = brush;
}
开发者ID:korakotru,项目名称:TestWPF,代码行数:7,代码来源:MainWindow.xaml.cs
示例3: SaveGradient
public override void SaveGradient()
{
double rate = DataManager.Instance.MainData.PixelWidth / _bokehData.Width;
GradientStopCollection collection = new GradientStopCollection();
collection.Add(new GradientStop() { Color = Colors.Transparent, Offset = _bokehData.Rate });
collection.Add(new GradientStop() { Color = Color.FromArgb(128, 0, 0, 0), Offset = _bokehData.Rate });
collection.Add(new GradientStop() { Color = Color.FromArgb(255, 0, 0, 0), Offset = 1 });
RadialGradientBrush brush = new RadialGradientBrush()
{
GradientOrigin = _bokehData.StarPoint,
Center = _bokehData.StarPoint,
RadiusX = _bokehData.RadiusX,
RadiusY = _bokehData.RadiusY,
GradientStops = collection,
};
Rectangle rectangle = new Rectangle()
{
Width = DataManager.Instance.MainData.PixelWidth,
Height = DataManager.Instance.MainData.PixelHeight,
Fill = _bokehData.MaskBrush,
OpacityMask = brush
};
Canvas saveCanvas = new Canvas()
{
Width = rectangle.Width,
Height = rectangle.Height,
Background = new ImageBrush() { ImageSource = DataManager.Instance.MainData },
};
saveCanvas.Children.Add(rectangle);
WriteableBitmap bmp = new WriteableBitmap(saveCanvas, null);
DataManager.Instance.SaveToFile(bmp);
}
开发者ID:onionstyle,项目名称:BokehDemo,代码行数:35,代码来源:EllipseGradient.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: Initialize
private void Initialize()
{
try
{
ColorConverter cc = new ColorConverter();
_colourStart = new byte[3];
_colourStop = new byte[3];
_brushPosted = (Color)ColorConverter.ConvertFromString("#FF0DE251");
_brushNotPosted = (Color)ColorConverter.ConvertFromString("#FFEA402F");
_colourStart[0] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStartR"));
_colourStart[1] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStartG"));
_colourStart[2] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStartB"));
_colourStop[0] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStopR"));
_colourStop[1] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStopG"));
_colourStop[2] = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings.Get("ColourStopB"));
_brushNotTransparent = new RadialGradientBrush(
Color.FromRgb(_colourStart[0], _colourStart[1], _colourStart[2]),
Color.FromRgb(_colourStop[0], _colourStop[1], _colourStop[2]));
OverrideSelectionEvent += UIPictureBox_OverrideSelectionEvent;
}
catch (Exception) { }
}
开发者ID:bedashii,项目名称:ReturnMedz,代码行数:26,代码来源:UIPictureBox.xaml.cs
示例6: ParticleSystem
public ParticleSystem(int maxCount, System.Windows.Media.Color color)
{
this.maxParticleCount = maxCount;
this.particleList = new List<Particle>();
this.particleModel = new GeometryModel3D();
this.particleModel.Geometry = new MeshGeometry3D();
Ellipse e = new Ellipse();
e.Width = 32.0;
e.Height = 32.0;
RadialGradientBrush b = new RadialGradientBrush();
b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
e.Fill = b;
e.Measure(new System.Windows.Size(32, 32));
e.Arrange(new Rect(0, 0, 32, 32));
var brush = new VisualBrush(e);
DiffuseMaterial material = new DiffuseMaterial(brush);
this.particleModel.Material = material;
this.rand = new Random(brush.GetHashCode());
}
开发者ID:xerxesb,项目名称:codekatas,代码行数:27,代码来源:ParticleSystem.cs
示例7: GetBackgroundByName
public static RadialGradientBrush GetBackgroundByName(string strName)
{
RadialGradientBrush result = new RadialGradientBrush();
if (Application.Current.Resources.Contains(strName))
{
result = Application.Current.Resources[strName] as RadialGradientBrush;
}
//string uri = "/Designer;component/Resources/Brushes.xaml";
//StreamResourceInfo StreamResourceInfoObj = Application.GetResourceStream(new Uri(uri, UriKind.RelativeOrAbsolute));
//if (StreamResourceInfoObj != null && StreamResourceInfoObj.Stream != null)
//{
// using (StreamReader StreamReaderObj = new StreamReader(StreamResourceInfoObj.Stream))
// {
// string resourcemerged = StreamReaderObj.ReadToEnd();
// if (string.IsNullOrEmpty(resourcemerged) == false)
// {
// ResourceDictionary loadresources = XamlReader.Load(resourcemerged) as ResourceDictionary;
// if (loadresources.Contains(strName))
// result = loadresources[strName] as RadialGradientBrush;
// }
// }
//}
return result;
}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:30,代码来源:BackgroundConverter.cs
示例8: AddFeature
public Feature AddFeature(String Id, GeoCoordinate GeoCoordinate, Double Width, Double Height, Color Color)
{
var radialBrush = new RadialGradientBrush();
var ColorHigh = Color; ColorHigh.A = 0xFF;
var ColorLow = Color; ColorLow.A = 0x00;
radialBrush.GradientStops.Add(new GradientStop(ColorHigh, 0.0));
radialBrush.GradientStops.Add(new GradientStop(ColorLow, 1.0));
var XY = GeoCalculations.WorldCoordinates_2_Screen(GeoCoordinate.Latitude, GeoCoordinate.Longitude, ZoomLevel);
var Feature = new Feature(new EllipseGeometry() { RadiusX = Width/2, RadiusY = Height/2 });
Feature.Id = Id;
Feature.Latitude = GeoCoordinate.Latitude;
Feature.Longitude = GeoCoordinate.Longitude;
Feature.Width = Width;
Feature.Height = Height;
Feature.Fill = radialBrush;
Feature.ToolTip = Id;
// The position on the map will be set within the PaintMap() method!
this.Children.Add(Feature);
return Feature;
}
开发者ID:subbuballa,项目名称:Aegir,代码行数:25,代码来源:HeatmapLayer.cs
示例9: ClickTheGradientCenter
public ClickTheGradientCenter()
{
Title = "Click The Gradient Center";
brush = new RadialGradientBrush(Colors.White, Colors.Red);
brush.RadiusX = brush.RadiusY = 0.10;
brush.SpreadMethod = GradientSpreadMethod.Repeat;
Background = brush;
}
开发者ID:volkoff-pro,项目名称:Petzold.WPF,代码行数:8,代码来源:ClickTheGradientCenter.cs
示例10: OnMouseLeave
private void OnMouseLeave(object sender, RoutedEventArgs e)
{
GradientStopCollection stopCollection = new GradientStopCollection();
stopCollection.Add(new GradientStop(Colors.Blue, 0.05));
stopCollection.Add(new GradientStop(Colors.LightBlue, 0.95));
RadialGradientBrush brush = new RadialGradientBrush(stopCollection);
circle.Fill = brush;
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:8,代码来源:PlaybackButton.xaml.cs
示例11: ConfigurarComponenteVisualArticulacao
private void ConfigurarComponenteVisualArticulacao(Shape pForma, int pDiametroArticulacao,
int pLarguraDesenho, Brush pCorDesenho, bool pPreencheComGradiente, bool pColorirGradienteMesmaCorDoPincel)
{
pForma.Height = pDiametroArticulacao;
pForma.Width = pDiametroArticulacao;
pForma.StrokeThickness = pLarguraDesenho;
if (pPreencheComGradiente)
{
pForma.Stroke = Brushes.Black;
RadialGradientBrush lGradiente = new RadialGradientBrush();
lGradiente.GradientOrigin = new Point(0.5, 0.5);
lGradiente.Center = new Point(0.5, 0.5);
lGradiente.RadiusX = 0.5;
lGradiente.RadiusY = 0.5;
Color lCor1;
Color lCor2;
if (pColorirGradienteMesmaCorDoPincel)
{
if (pCorDesenho == Brushes.Green)
{
lCor1 = Colors.Lime;
lCor2 = Colors.DarkGreen;
}
else if (pCorDesenho == Brushes.Blue)
{
lCor1 = Colors.RoyalBlue;
lCor2 = Colors.DarkBlue;
}
else
{
lCor1 = Colors.OrangeRed;
lCor2 = Colors.DarkRed;
}
}
else
{
lCor1 = Colors.OrangeRed;
lCor2 = Colors.DarkRed;
}
//lCor1 = Colors.Lime;
//lCor2 = Colors.DarkGreen;
lGradiente.GradientStops.Add(new GradientStop(lCor1, 0.5));
lGradiente.GradientStops.Add(new GradientStop(lCor2, 1));
pForma.Fill = lGradiente;
}
else
{
pForma.Stroke = pCorDesenho;
}
}
开发者ID:nunesrenato86,项目名称:TCC,代码行数:58,代码来源:EsqueletoUsuarioAuxiliar.cs
示例12: BackGradient
RadialGradientBrush BackGradient()
{
RadialGradientBrush rgb
= new RadialGradientBrush()
{
GradientOrigin = new Point(_rnd.NextDouble(), _rnd.NextDouble()),
Center = new Point(_rnd.NextDouble(), _rnd.NextDouble()),
RadiusX = _rnd.NextDouble(),
RadiusY = _rnd.NextDouble()
};
// Beginning of gradient offset
rgb.GradientStops.Add(
new GradientStop(new Color()
{
R = (byte)_rnd.Next(255),
G = (byte)_rnd.Next(255),
B = (byte)_rnd.Next(255),
A = 255
}, 0.0
)
);
// Scrambled middle gradients
for (int i = 0; i < _rnd.Next(5); i++)
{
rgb.GradientStops.Add(
new GradientStop(
new Color()
{
R = (byte)_rnd.Next(255),
G = (byte)_rnd.Next(255),
B = (byte)_rnd.Next(255),
A = 255
}
, _rnd.NextDouble()
)
);
}
// Ending of gradient offset
rgb.GradientStops.Add(
new GradientStop(
new Color()
{
R = (byte)_rnd.Next(255),
G = (byte)_rnd.Next(255),
B = (byte)_rnd.Next(255),
A = 255
}, 1.0
)
);
rgb.Freeze();
return rgb;
}
开发者ID:aprovodi,项目名称:HappyFriendMemoryGame,代码行数:57,代码来源:MemoryGameView.xaml.cs
示例13: OnRender
protected override void OnRender(DrawingContext dc)
{
RadialGradientBrush brush = new RadialGradientBrush(
IsPressed ? SystemColors.ControlDarkColor : SystemColors.ControlLightLightColor,
SystemColors.ControlColor);
brush.GradientOrigin = IsPressed ? new Point(0.75, 0.75) : new Point(0.25, 0.25);
dc.DrawRoundedRectangle(brush, new Pen(SystemColors.ControlDarkDarkBrush, 1),
new Rect(new Point(0, 0), RenderSize), RenderSize.Height/2, RenderSize.Height/2);
}
开发者ID:JianchengZh,项目名称:kasicass,代码行数:9,代码来源:RoundedButtonDecorator.cs
示例14: GetGradientBrush
public static Brush GetGradientBrush(Color color)
{
RadialGradientBrush myBrush = new RadialGradientBrush();
myBrush.GradientOrigin = new Point(0.75, 0.25);
myBrush.GradientStops.Add(new GradientStop(color.LightenOrDarken(50), 0.0));
myBrush.GradientStops.Add(new GradientStop(color, 0.5));
myBrush.GradientStops.Add(new GradientStop(color.LightenOrDarken(-50), 1.0));
return myBrush;
}
开发者ID:goldman99,项目名称:SnoopBreadcrumbs,代码行数:9,代码来源:Utils.cs
示例15: BrushEditor
public BrushEditor()
{
GradientStopCollection stops = new GradientStopCollection();
stops.Add(new GradientStop(Colors.Black, 0));
stops.Add(new GradientStop(Colors.White, 1));
linearGradientBrush = new LinearGradientBrush(stops);
linearGradientBrush.EndPoint = new Point(1, 0);
radialGradientBrush = new RadialGradientBrush(stops);
}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:10,代码来源:BrushEditor.cs
示例16: MainWindow
public MainWindow()
{
Title = "Click the Gradient Center";
brush = new RadialGradientBrush(Colors.White, Colors.Red);
brush.RadiusX = brush.RadiusY = 0.10;
brush.SpreadMethod = GradientSpreadMethod.Repeat;
//BorderBrush = Brushes.SaddleBrown;
// BorderThickness = new Thickness(25, 50, 75, 100);
Background = brush;
InitializeComponent();
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:11,代码来源:MainWindow.xaml.cs
示例17: CollectionCtorSingle
public void CollectionCtorSingle ()
{
GradientStopCollection gsc = new GradientStopCollection ();
gsc.Add (new GradientStop ());
RadialGradientBrush rgb = new RadialGradientBrush (gsc);
Assert.IsTrue (Object.ReferenceEquals (gsc, rgb.GradientStops), "Same GradientStops");
GradientStop gs1 = rgb.GradientStops [0];
Assert.AreEqual ("#00000000", gs1.Color.ToString (), "1.Color");
Assert.AreEqual (0.0, gs1.Offset, "1.Offset");
}
开发者ID:kangaroo,项目名称:moon,代码行数:11,代码来源:RadialGradientBrushTest.cs
示例18: Convert
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;
}
开发者ID:eugenezinoviev,项目名称:UControl,代码行数:12,代码来源:ColorToOuterGlowConverter.cs
示例19: ColorsCtor
public void ColorsCtor ()
{
RadialGradientBrush rgb = new RadialGradientBrush (Colors.Black, Colors.White);
GradientStop gs1 = rgb.GradientStops [0];
Assert.AreEqual ("#FF000000", gs1.Color.ToString (), "1.Color");
Assert.AreEqual (0.0, gs1.Offset, "1.Offset");
GradientStop gs2 = rgb.GradientStops [1];
Assert.AreEqual ("#FFFFFFFF", gs2.Color.ToString (), "2.Color");
Assert.AreEqual (1.0, gs2.Offset, "2.Offset");
}
开发者ID:kangaroo,项目名称:moon,代码行数:12,代码来源:RadialGradientBrushTest.cs
示例20: BasicLED
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;
}
开发者ID:mosaicsys,项目名称:MosaicLibCS,代码行数:13,代码来源:BasicLED.xaml.cs
注:本文中的System.Windows.Media.RadialGradientBrush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论