当前位置: 首页 > 编程语言 > C#

在canvas上绘制单个点的有效方法分享

时间:2023-04-10 18:12:02 C#

C#学习教程:一种在画布上绘制单点的高效方法.在android中,我会做类似paint.Color=Color.Rgb(10,10,10);的事情。canvas.DrawPoint(x,y,paint);所以我想我可以在Shape类中找到它,但它不存在。我是不是遗漏了什么或者没有办法绘制一个点?在第二种情况下,推荐的绘制点的方法是什么?在HTML5canvas中也有类似的问题,人们使用矩形/圆形来绘制点。PSAsimilarlytitledquestionAddPointtoCanvas不回答它并进入“如何绘制形状”。我刚刚遇到了UWP的同样问题,我最终决定使用Ellipse:intdotSize=10;椭圆currentDot=newEllipse();currentDot.Stroke=newSolidColorBrush(Colors.Green);currentDot.StrokeThickness=3;Canvas.SetZIndex(currentDot,3);currentDot.Height=dotSize;currentDot.Width=dotSize;currentDot.Fill=newSolidColorBrush(Colors.Green);currentDot.Margin=newThickness(100,200,0,0);//设置位置.myGrid.Children.Add(currentDot);多段线呢?XAML:C#:以上就是C#学习教程的全部内容:在画布上绘制单点的有效方法。如果对大家有用,需要进一步了解C#学习教程,希望大家多加关注—privatevoidButtonBase_OnClick(objectsender,RoutedEventArgse){polyline.Points.Add(newPoint(0,0));折线.Points.Add(新点(0,1));折线.Points.Add(新点(1,0));折线.Points.Add(新点(1,1));}本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处: