本文整理汇总了C#中System.Windows.Shapes.Path类的典型用法代码示例。如果您正苦于以下问题:C# Path类的具体用法?C# Path怎么用?C# Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Path类属于System.Windows.Shapes命名空间,在下文中一共展示了Path类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Draw
public static void Draw(Canvas canvas, List<LinePoint> points, Brush stroke, bool clear = true)
{
if (clear)
{
canvas.Children.Clear();
}
PathFigureCollection myPathFigureCollection = new PathFigureCollection();
PathGeometry myPathGeometry = new PathGeometry();
foreach (LinePoint p in points)
{
PathFigure myPathFigure = new PathFigure();
myPathFigure.StartPoint = p.StartPoint;
LineSegment myLineSegment = new LineSegment();
myLineSegment.Point = p.EndPoint;
PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
myPathSegmentCollection.Add(myLineSegment);
myPathFigure.Segments = myPathSegmentCollection;
myPathFigureCollection.Add(myPathFigure);
}
myPathGeometry.Figures = myPathFigureCollection;
Path myPath = new Path();
myPath.Stroke = stroke == null ? Brushes.Black : stroke;
myPath.StrokeThickness = 1;
myPath.Data = myPathGeometry;
canvas.Children.Add(myPath);
}
开发者ID:Eddie104,项目名称:Libra-CSharp,代码行数:34,代码来源:GraphicsHelper.cs
示例2: WpfArc
public WpfArc(IArc arc)
{
_xarc = arc;
_fillBrush = new SolidColorBrush(_xarc.Fill.ToNativeColor());
_fillBrush.Freeze();
_strokeBrush = new SolidColorBrush(_xarc.Stroke.ToNativeColor());
_strokeBrush.Freeze();
_path = new Path();
_path.Tag = this;
_path.Fill = _fillBrush;
_path.Stroke = _strokeBrush;
_path.StrokeThickness = arc.StrokeThickness;
_pg = new PathGeometry();
_pf = new PathFigure();
_pf.IsFilled = arc.IsFilled;
_pf.IsClosed = arc.IsClosed;
_start = new Point();
_as = new ArcSegment();
SetArcSegment(_as, arc, out _start);
_pf.StartPoint = _start;
_pf.Segments.Add(_as);
_pg.Figures.Add(_pf);
_path.Data = _pg;
Native = _path;
}
开发者ID:monocraft,项目名称:RxCanvas,代码行数:28,代码来源:Wpf.cs
示例3: Draw
public void Draw(EasingFunctionBase easingFunction)
{
canvas1.Children.Clear();
PathSegmentCollection pathSegments = new PathSegmentCollection();
for (double i = 0; i < 1; i += _samplingInterval)
{
double x = i * canvas1.Width;
double y = easingFunction.Ease(i) * canvas1.Height;
var segment = new LineSegment();
segment.Point = new Point(x, y);
pathSegments.Add(segment);
}
var p = new Path();
p.Stroke = new SolidColorBrush(Colors.Black);
p.StrokeThickness = 3;
PathFigureCollection figures = new PathFigureCollection();
figures.Add(new PathFigure() { Segments = pathSegments });
p.Data = new PathGeometry() { Figures = figures };
canvas1.Children.Add(p);
}
开发者ID:CNinnovation,项目名称:WPFWorkshopFeb2016,代码行数:26,代码来源:EasingChartControl.xaml.cs
示例4: GraphmapsEdge
public GraphmapsEdge(Edge edge, FrameworkElement labelFrameworkElement) {
Edge = edge;
CurvePath = new Path {
Data = GetICurveWpfGeometry(edge.GeometryEdge.Curve),
Tag = this
};
EdgeAttrClone = edge.Attr.Clone();
if (edge.Attr.ArrowAtSource)
SourceArrowHeadPath = new Path {
Data = DefiningSourceArrowHead(),
Tag = this
};
if (edge.Attr.ArrowAtTarget)
TargetArrowHeadPath = new Path {
Data = DefiningTargetArrowHead(Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness),
Tag = this
};
SetPathStroke();
if (labelFrameworkElement != null) {
LabelFrameworkElement = labelFrameworkElement;
Common.PositionFrameworkElement(LabelFrameworkElement, edge.Label.Center, 1);
}
edge.Attr.VisualsChanged += (a, b) => Invalidate();
}
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:29,代码来源:GraphmapsEdge.cs
示例5: Initialize
protected void Initialize()
{
System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(source);
System.IO.FileInfo[] filesInfo = directoryInfo.GetFiles();
var files = filesInfo.OrderBy(f => f.FullName);//sort alphabetically
//foreach (System.IO.FileInfo info in filesInfo)
foreach(System.IO.FileInfo info in files)
{
//System.Diagnostics.Debug.WriteLine("Reading " + info.Name + "...");
SvgReader reader = new SvgReader(info.FullName);
//HACK: At this moment only support one Path in a template file. Ideal case is get a group of graphic object.
var elements = reader.GetXMLElements("path");
foreach (XElement element in elements)
{
Path path = new Path();
path.Fill = Brushes.Black;
XAttribute attribute = element.Attribute(XName.Get("d"));
path.Data = (Geometry)new GeometryConverter().ConvertFromString(attribute.Value);//key
//string name = info.Name.ToLower().TrimEnd(new char[] { 'g', 'v', 's', '.' });//caused some ended with 's' interpreted wrongly.
string name = info.Name.ToLower().Substring(0, info.Name.Length - 4);
string label = GetLabel(info.Name);
if (label.Length > 0) name = name.Replace(label, string.Empty);
PathViewModel item = new PathViewModel(name, path, label);
this.items.Add(item);
break;
}
}//end loops
}
开发者ID:nilmarpublio,项目名称:jawiweb,代码行数:31,代码来源:PathCollection.cs
示例6: Triangle
public Triangle()
{
InitializeComponent();
l1 = new LineSegment();
l2 = new LineSegment();
f = new PathFigure();
f.Segments.Add(l1);
f.Segments.Add(l2);
f.IsClosed = true;
PathGeometry g = new PathGeometry();
g.Figures.Add(f);
Path p = new Path();
this.SetBinding(FillProperty, new Binding("Fill") { Source = p, Mode = BindingMode.TwoWay });
this.SetBinding(StrokeProperty, new Binding("Stroke") { Source = p, Mode = BindingMode.TwoWay });
this.SetBinding(StrokeThicknessProperty, new Binding("StrokeThickness") { Source = p, Mode = BindingMode.TwoWay });
p.Data = g;
this.Fill = new SolidColorBrush(Colors.White);
this.Stroke = new SolidColorBrush(Colors.Black);
this.LayoutRoot.Children.Add(p);
}
开发者ID:satomacoto,项目名称:Silverlight-Graph,代码行数:26,代码来源:Triangle.xaml.cs
示例7: HologramDisplay2
public HologramDisplay2(Hologram2 holo)
{
hologram2 = holo;
InitializeComponent();
Path PathInstance = new Path();
PathInstance.PathId = holo.video;
this.DataContext = PathInstance;
myMediaElement1.LoadedBehavior = MediaState.Manual;
myMediaElement2.LoadedBehavior = MediaState.Manual;
myMediaElement3.LoadedBehavior = MediaState.Manual;
myMediaElement4.LoadedBehavior = MediaState.Manual;
myMediaElement1.MediaEnded += new RoutedEventHandler(myMediaElement1_MediaEnded);
myMediaElement2.MediaEnded += new RoutedEventHandler(myMediaElement2_MediaEnded);
myMediaElement3.MediaEnded += new RoutedEventHandler(myMediaElement3_MediaEnded);
myMediaElement4.MediaEnded += new RoutedEventHandler(myMediaElement4_MediaEnded);
myMediaElement1.MediaOpened += new RoutedEventHandler(myMediaElement1_MediaOpened);
myMediaElement1.Play();
myMediaElement2.Play();
myMediaElement3.Play();
myMediaElement4.Play();
state = "play";
}
开发者ID:Broams,项目名称:holography,代码行数:27,代码来源:HologramDisplay2.xaml.cs
示例8: UpdatePath
public void UpdatePath(Path path, Point sp, Point ep)
{
using (StreamGeometryContext cnt = ((StreamGeometry)(path.Data)).Open())
{
InternalDrawGeometry(cnt, sp, ep);
}
}
开发者ID:chijianfeng,项目名称:PNManager,代码行数:7,代码来源:BaseAction.cs
示例9: geometryLine
public geometryLine(Canvas cvs)
{
rootPanel = cvs;
//myPathFigure = new PathFigure();
myPathGeometry = new PathGeometry();
//myPathGeometry.Figures.Add(myPathFigure);
myPath = new Path();
myPath.Stroke = Brushes.Blue;
myPath.StrokeThickness = 1;
myPath.Data = myPathGeometry;
rootPanel.Children.Add(myPath);
myPathFigureOld = new PathFigure();
myPathGeometryOld = new PathGeometry();
myPathGeometryOld.Figures.Add(myPathFigureOld);
myPathOld = new Path();
myPathOld.Stroke = Brushes.Blue;
myPathOld.StrokeThickness = 1;
myPathOld.Data = myPathGeometryOld;
rootPanel.Children.Add(myPathOld);
myPathFigureTest = new PathFigure();
myPathGeometry.Figures.Add(myPathFigureTest);
isFirstPoint = true;
}
开发者ID:hehaiyang7133862,项目名称:VICO_Current,代码行数:28,代码来源:geometryLine.cs
示例10: SelectTest
public void SelectTest()
{
PathCollection target = new PathCollection(@"E:\jawi\khots");
//alef raw data
string alef = "M2.8853219,14.535578L3.4452919,24.413808 6.0826619,72.682508C6.0826619,72.682508 7.8725619,70.888858 8.9450019,69.255188 10.466172,66.940318 10.546172,64.950418 11.003652,62.728038 11.362382,60.984378 11.386132,60.595648 11.238632,58.834488L8.3512919,24.397558 8.0763019,18.551618C8.3637919,18.709108,8.6375219,18.851598,8.8950119,18.977838L13.337272,21.177728 12.489822,18.840348C12.393622,18.575368 12.291082,18.294128 12.188582,18.011638 10.956152,14.616818 10.272432,11.259498 9.4512319,7.77842770000001 8.6662719,4.44610770000001 7.6188219,0.00758770000001263 7.6188219,0.00758770000001263 7.6188219,0.00758770000001263 6.8776119,-0.0311122999999874 6.1939019,0.0662877000000126 4.3165019,0.335027700000013 0.307961849999997,6.31470770000001 0.0479718499999979,7.67338770000001 0.0229718499999979,7.80212770000001 0.00797184999999793,7.93087770000001 0.00297184999999793,8.05836770000001 -0.00832815000000207,8.33959770000001 0.0129718499999979,8.63458770000001 0.0604718499999979,8.93956770000001 0.404201849999998,11.129458 1.5066519,12.998108 2.8853219,14.535528z";
Path path = new Path();
path.Data = (Geometry)new GeometryConverter().ConvertFromString(alef);
PathViewModel viewModel = new PathViewModel(string.Empty, path, string.Empty);
target.Select(viewModel);
//check SelectedPath
Assert.AreEqual(target.SelectedPath.Path.Data.ToString(), viewModel.Path.Data.ToString());
//ensure always only one Item IsChecked.
int count = 0;
foreach (PathViewModel item in target.Items)
if (item.IsChecked) count++;
Assert.AreEqual(1, count);
//select next object.
string dot = "M3.1054696,15.75434C3.6094426,18.82793 4.5492686,23.76517 4.0869176,25.03635 3.7460606,25.97381 3.0559716,26.66627 2.4212556,27.49747 -0.2264804,30.96604 -0.6113344,35.03333 0.8220896,39.70933 2.3521336,44.70032 7.7263506,42.62043 12.616468,39.51934 15.53069,37.67069 22.65219,32.61096 24.193108,29.29988 24.278228,29.11614 24.35785,28.92865 24.432221,28.73616 23.762131,26.18129 21.683116,28.80496 21.676741,28.80866 13.716785,34.24837 5.3694746,37.5407 2.7644876,36.5195 2.1845176,36.29201 1.8942836,35.68829 2.2572636,34.40961 2.4872516,33.5984 2.9583516,32.7547 3.0645966,32.6272 4.2296596,31.21978 6.6485326,29.7861 8.1425786,28.15369 9.0814046,27.12749 9.6549996,26.02255 10.645197,25.32509 11.898881,24.44264 13.820405,24.21265 15.293827,23.55393 19.110751,21.84777 22.053346,17.22927 22.415827,13.61696 23.065668,7.1410503 19.6006,5.0074103 13.9169,1.0438703 13.15794,0.5139003 12.546472,0.0951703 11.285414,0.0151703000000001 9.9611076,-0.0685296999999999 7.9205906,0.2214103 7.9205906,0.2214103 7.9205906,0.2214103 7.8168456,3.3425003 8.2474486,5.5648803 8.7287976,8.0485003 9.8782376,9.4096803 10.368087,11.07084 10.477081,11.44082 10.553452,11.8258 10.422457,11.95954 10.287464,12.09704 9.9326076,11.96854 9.5935006,11.75455 6.9287656,10.06839 6.7901486,7.6610203 4.6721346,8.7434603 3.5073216,9.3396803 2.9713496,10.73336 2.8809796,12.64201 2.8233596,13.85944 2.8458596,14.17068 3.1054676,15.75434z M12.059248,8.3897303L11.909756,7.1123003C11.909756,7.1123003 12.745087,6.9660603 13.331431,7.0248003 14.077891,7.1010003 14.420623,7.5122803 14.86935,7.9035103 17.496086,10.19839 20.907657,11.09834 19.429234,13.39572 19.191497,13.76445 17.71095,15.29812 16.400519,16.42056 14.615988,17.94923 13.518921,18.30171 13.693787,16.38806 13.965647,13.41697 11.998626,7.8710103 12.059248,8.3897303z M9.0800296,19.17791L7.4994876,19.27421C6.7894006,19.31791 6.6677816,19.30921 6.2840516,19.19541 5.5918386,18.99042 4.7182596,18.27046 4.3830266,17.58425 4.2211606,17.25301 4.1994116,17.15302 4.1646636,16.5843L4.0872936,15.32062 5.3517266,15.24312C5.9198216,15.20812 6.0216916,15.21812 6.3701736,15.33812 7.3446216,15.67435 8.8960406,17.33176 8.9930346,17.75549 9.1320276,18.36296 9.0800346,19.17791 9.0800346,19.17791z";
Path path2 = new Path();
path2.Data = (Geometry)new GeometryConverter().ConvertFromString(dot);
PathViewModel viewModel2 = new PathViewModel(string.Empty, path2, string.Empty);
target.Select(viewModel2);
//check SelectedPath
Assert.AreEqual(target.SelectedPath.Path.Data.ToString(), path2.Data.ToString());
//ensure always only one Item IsChecked.
count = 0;
foreach (PathViewModel item in target.Items)
if (item.IsChecked) count++;
Assert.AreEqual(1, count);
}
开发者ID:nilmarpublio,项目名称:jawiweb,代码行数:34,代码来源:PathCollectionTest.cs
示例11: VEdge
public VEdge(Edge edge, FrameworkElement labelFrameworkElement) {
Edge = edge;
CurvePath = new Path {
Data = GetICurveWpfGeometry(edge.GeometryEdge.Curve),
Tag = this
};
EdgeAttrClone = edge.Attr.Clone();
if (edge.Attr.ArrowAtSource)
SourceArrowHeadPath = new Path {
Data = DefiningSourceArrowHead(),
Tag = this
};
if (edge.Attr.ArrowAtTarget)
TargetArrowHeadPath = new Path {
Data = DefiningTargetArrowHead(Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness),
Tag = this
};
SetPathStroke();
if (labelFrameworkElement != null) {
LabelFrameworkElement = labelFrameworkElement;
Common.PositionFrameworkElement(LabelFrameworkElement, edge.Label.Center, 1);
}
edge.Attr.VisualsChanged += (a, b) => Invalidate();
edge.IsVisibleChanged += obj => {
foreach (var frameworkElement in FrameworkElements) {
frameworkElement.Visibility = edge.IsVisible ? Visibility.Visible : Visibility.Hidden;
}
};
}
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:34,代码来源:VEdge.cs
示例12: DrawPath
private void DrawPath(IEnumerable<Vector2> path)
{
if (!path.Any())
throw new ArgumentException("Path cannot be empty.");
var figure = new PathFigure();
var start = path.First();
figure.StartPoint = PointFromVector(start);
foreach (var vector in path.Skip(1))
{
var point = PointFromVector(vector);
figure.Segments.Add(new LineSegment(point, true));
}
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
var pathImage = new Path()
{
Stroke = Brushes.Black,
StrokeThickness = 3,
Data = geometry
};
mainCanvas.Children.Add(pathImage);
}
开发者ID:PlastecProfiles,项目名称:ComputationalGeometry,代码行数:28,代码来源:MainWindow.xaml.cs
示例13: OvLine
//to be modified
//constructor
public OvLine(Canvas canvas, ITextSnapshotLine itv, float bzCurvArea, OvCollection parent)
{
_bzCurvArea = bzCurvArea;
lnNumber = itv.LineNumber;
lnStart = 0.0f;
lnTextStart = (float)Find1stChar(itv);
//if (lnNumber == 65) System.Diagnostics.Trace.WriteLine("%%% REGEX: " + lnTextStart );
lnEnd = (float)itv.Length;
lnHeight = 1.0f;
lnLength = itv.Length;
lnColor = new System.Windows.Media.Color(); //get the color of the textview
lnFocus = false;
myCanvas = canvas;
myPath = new Path();
myParent = parent;
IsSeleted = false;
this.myPath.MouseEnter += new System.Windows.Input.MouseEventHandler(myPath_MouseEnter);
this.myPath.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(myPath_MouseLeftButtonDown);
this.myPath.MouseLeave += new System.Windows.Input.MouseEventHandler(myPath_MouseLeave);
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:30,代码来源:OvLine.cs
示例14: Stop
internal void Stop(Canvas field, Subway subway)
{
pathAnimationStoryboard.Children.Clear();
field.Children.Remove(trainPath);
RectangleGeometry rc = trainPath.Data as RectangleGeometry;
trainPath.RenderTransform = null;
travelTime = 0;
timeOnStation = 3;
Start = false;
onStation = false;
leftStation = false;
numOfPassage = passage;
currStationInd = 0;
id = 0;
Back = false;
away = false;
if (subway.GetRailways.ElementAt(lineNumber).GetStations.Count > 1)
{
if (subway.GetRailways.ElementAt(lineNumber).GetStations.ElementAt(0) != null)
{
Station st = subway.GetRailways.ElementAt(lineNumber).GetStations.ElementAt(0);
rc.Rect = new Rect(st.Coordinate.X - 15, st.Coordinate.Y - 15, 30, 30);
}
else
{
trainPath = null;
}
}
}
开发者ID:M0N3,项目名称:Subway,代码行数:29,代码来源:Train.cs
示例15: InitializeComponent
public void InitializeComponent()
{
if (!this._contentLoaded)
{
this._contentLoaded = true;
Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/CaptionSettingsView.xaml", UriKind.Relative));
this.userControl = (UserControl) base.FindName("userControl");
this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
this.DialogBorder = (Border) base.FindName("DialogBorder");
this.BackgroundRectangle = (Border) base.FindName("BackgroundRectangle");
this.Gradient = (Rectangle) base.FindName("Gradient");
this.HeaderGrid = (Grid) base.FindName("HeaderGrid");
this.GlyphCanvas = (Canvas) base.FindName("GlyphCanvas");
this.BoxPath = (Path) base.FindName("BoxPath");
this.CPath1 = (Path) base.FindName("CPath1");
this.CPath2 = (Path) base.FindName("CPath2");
this.CheckedBoxPath = (Path) base.FindName("CheckedBoxPath");
this.CheckedCPath1 = (Path) base.FindName("CheckedCPath1");
this.CheckedCPath2 = (Path) base.FindName("CheckedCPath2");
this.CaptionSettingsLayoutRoot = (Grid) base.FindName("CaptionSettingsLayoutRoot");
this.MetaDataBackground = (Rectangle) base.FindName("MetaDataBackground");
this.CharacterSettingsLayoutRoot = (Grid) base.FindName("CharacterSettingsLayoutRoot");
this.FooterGrid = (Grid) base.FindName("FooterGrid");
this.DefaultsButton = (Button) base.FindName("DefaultsButton");
this.CloseButton = (Button) base.FindName("CloseButton");
}
}
开发者ID:BigBri41,项目名称:TWCTVWindowsPhone,代码行数:27,代码来源:CaptionSettingsView.cs
示例16: AddArrow
private void AddArrow(Panel rootCanvas, Point arrowPoint)
{
var size = 10.0;
var relationshipPath = new Path
{
Stroke = Brushes.Black,
StrokeThickness = 2,
Visibility = Visibility.Visible,
Fill = Brushes.Black
};
var geometry = new StreamGeometry
{
FillRule = FillRule.EvenOdd
};
using (var ctx = geometry.Open())
{
ctx.BeginFigure(new Point(arrowPoint.X, arrowPoint.Y), true, true);
ctx.LineTo(new Point(arrowPoint.X - size / 2, arrowPoint.Y - size), true, true);
ctx.LineTo(new Point(arrowPoint.X + size / 2, arrowPoint.Y - size), true, true);
}
geometry.Freeze();
relationshipPath.Data = geometry;
rootCanvas.Children.Add(relationshipPath);
}
开发者ID:NicoVermeir,项目名称:ServiceInsight,代码行数:30,代码来源:SagaWindowView.xaml.cs
示例17: AxesFrame
public AxesFrame()
{
canvas = new AxisCanvas();
this.Content = canvas;
frame = new Path() { Stroke = Brushes.Black, StrokeThickness = 1, StrokeLineJoin = PenLineJoin.Miter, Data = geometry };
canvas.Children.Add(frame);
}
开发者ID:goutkannan,项目名称:ironlab,代码行数:7,代码来源:AxesFrame.cs
示例18: Draw
private void Draw()
{
Path ellipsePath = new Path
{
Fill = new SolidColorBrush(Colors.White),
StrokeThickness = StrokeThikness,
Stroke = BorderBrush,
Data = GetCircleGeometry(0, 2 * Math.PI, ActualWidth, ActualHeight)
};
Path filledEllipse = new Path
{
Fill = Foreground,
StrokeThickness = StrokeThikness,
Stroke = BorderBrush,
Data = GetCircleGeometry(StartAngle, FillingAngle, ActualWidth, ActualHeight)
};
Path additionalEllipse = new Path
{
Fill = new SolidColorBrush(Color.FromArgb(224, 229,229,229)),
StrokeThickness = 0,
Data = GetCircleGeometry(0, 2*Math.PI, ActualWidth * 0.75, ActualHeight*0.75),
HorizontalAlignment=HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
this.MainGrid.Children.Add(ellipsePath);
this.MainGrid.Children.Add(filledEllipse);
this.MainGrid.Children.Add(additionalEllipse);
}
开发者ID:iGad,项目名称:EmblemPaint,代码行数:28,代码来源:ResultChart.xaml.cs
示例19: gridLine
//gridLine constructor
public gridLine(int value, string dir, MainWindow window)
{
// Create a path to draw a geometry with.
line = new Path();
line.Stroke = Brushes.WhiteSmoke;
line.StrokeThickness = 0.5;
line.SnapsToDevicePixels = true;
//this.line = new Line();
this.canvas = window.plot;
this.view = window.view;
this.direction = dir;
this.window = window;
creategeometry(value);
if (dir == LineDirection.Horizontal)
{
TextLabel(5, value, value.ToString());
}
else
{
TextLabel(value + 1, 30, value.ToString());
}
canvas.Children.Add(line);
}
开发者ID:DiLRandI,项目名称:ArduinoMonitor,代码行数:29,代码来源:gridLine.cs
示例20: AddCircularArcGraph
private void AddCircularArcGraph(Point startPoint, Point endPoint, Size size)
{
PathFigure pf = new PathFigure();
pf.StartPoint = new Point(startPoint.X, startPoint.Y);
ArcSegment arcSegment = new ArcSegment();
arcSegment.Point = new Point(endPoint.X, endPoint.Y);
arcSegment.Size = size;
arcSegment.SweepDirection = SweepDirection.Counterclockwise;
PathSegmentCollection psc = new PathSegmentCollection();
psc.Add(arcSegment);
pf.Segments = psc;
PathFigureCollection pfc = new PathFigureCollection();
pfc.Add(pf);
PathGeometry pg = new PathGeometry();
pg.Figures = pfc;
var path = new Path();
path.Stroke = Brushes.Black;
path.StrokeThickness = 1;
path.Data = pg;
path.Fill = Brushes.Orange;
path.Stretch = Stretch.Fill;
var viewportPanel = new ViewportHostPanel();
ViewportPanel.SetViewportBounds(path, new DataRect(0, 0, 50, 50));
viewportPanel.Children.Add(path);
plotter.Children.Add(viewportPanel);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:33,代码来源:Window1.xaml.cs
注:本文中的System.Windows.Shapes.Path类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论