本文整理汇总了C#中OxyColor类的典型用法代码示例。如果您正苦于以下问题:C# OxyColor类的具体用法?C# OxyColor怎么用?C# OxyColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OxyColor类属于命名空间,在下文中一共展示了OxyColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ErrorColumnItem
/// <summary>
/// Initializes a new instance of the <see cref="ErrorColumnItem"/> class.
/// </summary>
/// <param name="value">
/// The value.
/// </param>
/// <param name="error">
/// The error.
/// </param>
/// <param name="categoryIndex">
/// Index of the category.
/// </param>
/// <param name="color">
/// The color.
/// </param>
public ErrorColumnItem(double value, double error, int categoryIndex = -1, OxyColor color = null)
{
this.Value = value;
this.Error = error;
this.CategoryIndex = categoryIndex;
this.Color = color;
}
示例2: Export
/// <summary>
/// Exports the specified plot model to a file.
/// </summary>
/// <param name="model">The model to export.</param>
/// <param name="fileName">The file name.</param>
/// <param name="width">The width of the output bitmap.</param>
/// <param name="height">The height of the output bitmap.</param>
/// <param name="background">The background color. The default value is <c>null</c>.</param>
/// <param name="resolution">The resolution (resolution). The default value is 96.</param>
public static void Export(PlotModel model, string fileName, int width, int height, OxyColor background, int resolution = 96)
{
using (var s = File.Create(fileName))
{
Export(model, s, width, height, background, resolution);
}
}
示例3: ExportToString
/// <summary>
/// Export the specified plot model to an xaml string.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
/// <returns>A xaml string.</returns>
public static string ExportToString(PlotModel model, double width, double height, OxyColor background = null)
{
var g = new Grid();
if (background != null)
{
g.Background = background.ToBrush();
}
var c = new Canvas();
g.Children.Add(c);
var size = new Size(width, height);
g.Measure(size);
g.Arrange(new Rect(0, 0, width, height));
g.UpdateLayout();
var rc = new ShapesRenderContext(c) { UseStreamGeometry = false };
model.Update();
model.Render(rc, width, height);
var sb = new StringBuilder();
using (var sw = new StringWriter(sb))
{
var xw = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true });
XamlWriter.Save(c, xw);
}
return sb.ToString();
}
示例4: HighLowSeries
public HighLowSeries(OxyColor color, double strokeThickness = 1, string title = null)
: this()
{
this.Color = color;
this.StrokeThickness = strokeThickness;
this.Title = title;
}
示例5: Export
/// <summary>
/// Exports the specified plot model to a xaml file.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fileName">Name of the file.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
public static void Export(PlotModel model, string fileName, double width, double height, OxyColor background)
{
using (var w = new StreamWriter(fileName))
{
w.Write(ExportToString(model, width, height, background));
}
}
示例6: IntervalBarItem
/// <summary>
/// Initializes a new instance of the <see cref="IntervalBarItem"/> class.
/// </summary>
/// <param name="start">
/// The start.
/// </param>
/// <param name="end">
/// The end.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="color">
/// The color.
/// </param>
public IntervalBarItem(double start, double end, string title = null, OxyColor color = null)
{
this.Start = start;
this.End = end;
this.Title = title;
this.Color = color;
}
示例7: Export
/// <summary>
/// Exports the specified plot model to an xps file.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fileName">The file name.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background color.</param>
public static void Export(IPlotModel model, string fileName, double width, double height, OxyColor background)
{
using (var xpsPackage = Package.Open(fileName, FileMode.Create, FileAccess.ReadWrite))
{
using (var doc = new XpsDocument(xpsPackage))
{
var canvas = new Canvas { Width = width, Height = height, Background = background.ToBrush() };
canvas.Measure(new Size(width, height));
canvas.Arrange(new Rect(0, 0, width, height));
var rc = new ShapesRenderContext(canvas);
#if !NET35
rc.TextFormattingMode = TextFormattingMode.Ideal;
#endif
model.Update(true);
model.Render(rc, width, height);
canvas.UpdateLayout();
var xpsdw = XpsDocument.CreateXpsDocumentWriter(doc);
xpsdw.Write(canvas);
}
}
}
示例8: ScatterSeries
/// <summary>
/// Initializes a new instance of the <see cref="ScatterSeries"/> class.
/// </summary>
/// <param name="title">
/// The title.
/// </param>
/// <param name="markerFill">
/// The marker fill color.
/// </param>
/// <param name="markerSize">
/// Size of the markers (If ScatterPoint.Size is set, this value will be overridden).
/// </param>
public ScatterSeries(string title, OxyColor markerFill = null, double markerSize = 5)
: this()
{
this.MarkerFill = markerFill;
this.MarkerSize = markerSize;
this.Title = title;
}
示例9: DrawEllipse
/// <summary>
/// Draws an ellipse.
/// </summary>
/// <param name="rect">The rectangle.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The thickness.</param>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
{
this.SetAlias(false);
var convertedRectangle = rect.Convert();
if (fill.IsVisible())
{
this.SetFill(fill);
using (var path = new CGPath())
{
path.AddEllipseInRect(convertedRectangle);
this.gctx.AddPath(path);
}
this.gctx.DrawPath(CGPathDrawingMode.Fill);
}
if (stroke.IsVisible() && thickness > 0)
{
this.SetStroke(stroke, thickness);
using (var path = new CGPath())
{
path.AddEllipseInRect(convertedRectangle);
this.gctx.AddPath(path);
}
this.gctx.DrawPath(CGPathDrawingMode.Stroke);
}
}
示例10: DrawLine
public void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray,
OxyPenLineJoin lineJoin, bool aliased)
{
var e = new Polyline();
if (stroke != null && thickness > 0)
{
e.Stroke = GetCachedBrush(stroke);
switch (lineJoin)
{
case OxyPenLineJoin.Round:
e.StrokeLineJoin = PenLineJoin.Round;
break;
case OxyPenLineJoin.Bevel:
e.StrokeLineJoin = PenLineJoin.Bevel;
break;
// The default StrokeLineJoin is Miter
}
if (thickness != 1) // default values is 1
e.StrokeThickness = thickness;
if (dashArray != null)
e.StrokeDashArray = new DoubleCollection(dashArray);
}
// pl.Fill = null;
if (aliased)
e.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
var pc = new PointCollection(points.Count);
foreach (var p in points)
pc.Add(ToPoint(p));
e.Points = pc;
Add(e);
}
示例11: Export
/// <summary>
/// Exports the specified plot model to a xaml file.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fileName">Name of the file.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
public static void Export(PlotModel model, string fileName, double width, double height, OxyColor background)
{
using (var sw = new StreamWriter(fileName))
{
var xw = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true });
Export(model, xw, width, height, background);
}
}
示例12: Export
/// <summary>
/// Exports the specified plot model to an xps file.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fileName">The file name.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background color.</param>
public static void Export(IPlotModel model, string fileName, double width, double height, OxyColor background)
{
using (var stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite))
{
var exporter = new XpsExporter { Width = width, Height = height, Background = background };
exporter.Export(model, stream);
}
}
示例13: RectangleBarItem
/// <summary>
/// Initializes a new instance of the <see cref="RectangleBarItem"/> class.
/// </summary>
/// <param name="x0">
/// The x0.
/// </param>
/// <param name="y0">
/// The y0.
/// </param>
/// <param name="x1">
/// The x1.
/// </param>
/// <param name="y1">
/// The y1.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="color">
/// The color.
/// </param>
public RectangleBarItem(double x0, double y0, double x1, double y1, string title = null, OxyColor color = null)
{
this.X0 = x0;
this.Y0 = y0;
this.X1 = x1;
this.Y1 = y1;
this.Title = title;
this.Color = color;
}
示例14: Export
/// <summary>
/// Exports the specified plot model to a stream.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="stream">The stream.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
/// <param name="resolution">The resolution.</param>
public static void Export(PlotModel model, Stream stream, int width, int height, OxyColor background = null, int resolution = 96)
{
var bmp = ExportToBitmap(model, width, height, background);
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
encoder.Save(stream);
}
示例15: ExportToString
/// <summary>
/// Export the specified plot model to an xaml string.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
/// <returns>A xaml string.</returns>
public static string ExportToString(IPlotModel model, double width, double height, OxyColor background)
{
var sb = new StringBuilder();
using (var sw = new StringWriter(sb))
{
var xw = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true });
Export(model, xw, width, height, background);
}
return sb.ToString();
}