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

Resize two custom shapes doesn't work

2 Answers 59 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Maite
Top achievements
Rank 1
Maite asked on 02 May 2018, 10:48 AM

Hello, 

 I have two custom shapes. One contains the other. When I resize the principal in the diagram, I resize manually in the code the secundary. The problem is that I can not selected the principal shape if the size is little. If I don't resize de secundari, the resized works correctly. 

 

The code of resize is: 

"this" is the principal shape ( RadDiagramShape)

"wire" is the secundari shape ( RadDiagramShape)

private void PositionShape_SizeChanged(object sender, SizeChangedEventArgs e)
{
    this.Border = (OriginalStrokeThickness / Scale);
    this.OriginalWidth = e.NewSize.Width / Scale;
    this.OriginalHeight = e.NewSize.Height / Scale;
 
    this.OriginalPosition = new Point(this.Position.X / Scale, this.Position.Y / Scale);
 
    if (e.PreviousSize.Width != 0 && e.PreviousSize.Height != 0)
    {
        switch (OrientaActual)
        {
            case 'N':
           this.Wire.WireHeight = (this.OriginalHeight * 2)*Scale;
                this.Wire.WireWidth = this.OriginalWidth*Scale;
                this.Wire.WirePosition = new Point(this.Position.X, this.Position.Y - this.Wire.Height);
                break;
            case 'E':
                this.Wire.WireHeight = (this.OriginalHeight * 2)*Scale;
                this.Wire.WireWidth = this.OriginalWidth*Scale;
                    this.Wire.WirePosition = new Point(this.Position.X + this.Height * 1.5, this.Position.Y - this.Height / 2);
                break;
            case 'S':
                this.Wire.WireHeight = (this.OriginalHeight * 2)*Scale;
                this.Wire.WireWidth = this.OriginalWidth*Scale;                    
                this.Wire.WirePosition = new Point(this.Position.X, (this.Position.Y + this.Height));
                break;
           case 'W':
               this.Wire.WireHeight = (this.OriginalHeight * 2)*Scale;
                this.Wire.WireWidth = this.OriginalWidth*Scale;
                this.Wire.WirePosition = new Point((this.Position.X - this.Width / 2) - this.Wire.Width, this.Position.Y- this.Height / 2);
                break;
                }  
            }
        }

2 Answers, 1 is accepted

Sort by
0
Maite
Top achievements
Rank 1
answered on 02 May 2018, 12:13 PM
By the way, I select only the principal shape. Other shape moves manually in the code. 
0
Dinko | Tech Support Engineer
Telerik team
answered on 07 May 2018, 08:42 AM
Hi Maite,

Thank you for the provided code snippet.

In your post, you mentioned that you have one shape which contains the other one. Can you elaborate more on what do you mean by this? Is the wire shape is placed on top of the principal shape? Are you using RadDiagramContainerShape (Principal) which contains RadDiagramShapes (Wire) inside? Also is it possible to send me a code snippet of the custom shapes? This way I could try to reproduce this behavior on my side.

Regards,
Dinko
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.
Tags
Diagram
Asked by
Maite
Top achievements
Rank 1
Answers by
Maite
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or