This is a migrated thread and some comments may be shown as answers.

pencil drawing

6 Answers 187 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
yoochul
Top achievements
Rank 1
yoochul asked on 21 Jun 2018, 02:55 AM
draw pencil tool

# Mouse Action :  Left,Right,Down,.... (loop)  - OK
# Mouse Action : Left,Right,...(loop) -  bug? :    problem line

to show attach file(line.jpg) for detail information

6 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 22 Jun 2018, 10:39 AM
Hello Yoochul,

This is a known issue in the diagram. You can find it logged in our feedback portal where you can track its status. ​I am afraid that, currently, I can't suggest you a convenient workaround for working this around.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
yoochul
Top achievements
Rank 1
answered on 23 Aug 2018, 02:55 AM

I think this problem is WPF ByDesign. ( WPF renders "corners" )

   https://stackoverflow.com/questions/980798/wpf-bug-or-am-i-going-crazy

to resolve  release remark

 =>        //_path.StrokeLineJoin = PenLineJoin.Bevel;  

#sample

<Window x:Class="WpfApp3_geo.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp3_geo"
        mc:Ignorable="d"
        Title="Window1" Height="450" Width="800" >
    <Canvas Name="PathCol" Cursor="Hand" />
</Window>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace WpfApp3_geo
{
    public class PathData
    {
        private PathFigure _pathFigure = new PathFigure();
        PathFigureCollection _pathCollection = new PathFigureCollection();
        PathSegmentCollection _segments = new PathSegmentCollection();
        private PathGeometry _pathGeometry = new PathGeometry();
        public Path _path;
        public PathData()
        {
            _path = new Path();
            _path.Stroke = Brushes.Blue;
            //_path.StrokeLineJoin = PenLineJoin.Bevel;  
            _path.StrokeThickness = 3;           
            _pathFigure.Segments = _segments;
            _pathCollection.Add(_pathFigure);
            _pathGeometry.Figures = _pathCollection;
            _path.Data = _pathGeometry;
        }
        public PathFigure PathFigure { get { return _pathFigure; } }
        public Path Path { get { return _path; } }
    }
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        List<PathData> pathDatas = new List<PathData>();
        PathData pathData;
        public Window1()
        {
            InitializeComponent();
            this.MouseLeftButtonDown += Window1_MouseLeftButtonDown;
            this.MouseMove += Window1_MouseMove;
        }
        private void Window1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            pathData = new PathData();
            PathCol.Children.Add(pathData.Path);
            pathData.PathFigure.StartPoint = e.GetPosition(this);
        }
        private void Window1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                LineSegment segment = new LineSegment();
                segment.Point = e.GetPosition(this);
                pathData.PathFigure.Segments.Add(segment);
            }
        }
    }
}

--

Please review the code (drawingadorner.jpg) and  I need to workaround

0
Martin Ivanov
Telerik team
answered on 27 Aug 2018, 09:46 AM
Hello Yoochul,

Thank you for the additional information. Based on this I've come up with an workaround which you can try. You can find it demonstrated in the attached project. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
yoochul
Top achievements
Rank 1
answered on 28 Aug 2018, 12:18 AM

When I apply to workaround, the glitch disappeared

Thank you.

0
yoochul
Top achievements
Rank 1
answered on 28 Aug 2018, 12:39 AM

Other problem is appeared.

 

# Drawing line -> Diagram Save -> application close -> application start -> Diagram Load -> glitch Draw line

 

how to load diagram for applied strokeMiterLimit in path

 

 

0
Martin Ivanov
Telerik team
answered on 30 Aug 2018, 08:58 AM
Hi Yoochul,

To resolve this too, instead of setting the StrokeMiterLimit in the Drawing event handler as shown in the project, you can extract the RadDiagramShape ControlTemplate and set the StrokeMiterLimit on the Path there. This way each time a shape is added to the diagram, the template will be applied and the miter limit will be set. I've updated my last project to show this approach. I've marked the change in the template with a comment in XAML. The RadDiagramShape Style is defined without an x:Key which means that it will be applied globally to all shapes.

I've also updated your Telerik points for helping us find a workaround for this issue.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Diagram
Asked by
yoochul
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
yoochul
Top achievements
Rank 1
Share this question
or