Skip to content

Rendering Labels with TranslateTransform #6144

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
Hello,
i do have the following Code:

        private static void AddElements(Canvas canvas)
        {
            double canvasHeight = canvas. Height;
            double canvasWidth = canvas. Width;
            double y0 = canvasHeight / 2;
            double x0 = canvasWidth / 2;

// Defining the new Coordinate-Point (0,0) to mid auf Canvas
            TranslateTransform tt = new TranslateTransform(x0, y0);

Line line1 = new Line();
            line1. X1 = -350;
            line1. Y1 = 0;
            line1. X2 = 350;
            line1. Y2 = 0;
            line1. Stroke = Brushes.Black;
            line1. StrokeThickness = 2.0;
            line1. RenderTransform = tt;
            canvas. Children.Add(line1);

Line line2 = new Line();
            line2. X1 = 0;
            line2. Y1 = -350;
            line2. X2 = 0;
            line2. Y2 = 350;
            line2. Stroke = Brushes.Black;
            line2. StrokeThickness = 2.0;
            line2. RenderTransform = tt;
            canvas. Children.Add(line2);

Label lblN = new Label();
            lblN.Width = 50;
            lblN.Height = 15;
            lblN.Background = Brushes.Red;
            lblN.Margin = new System.Windows.Thickness(0, -300, 0, 0);
            lblN.Content = $"N";
            lblN.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
            lblN.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            lblN.RenderTransform = tt;
            lblN.Padding = new System.Windows.Thickness(0);
            lblN.BorderBrush = Brushes.Black;
            lblN.BorderThickness = new System.Windows.Thickness(2.0);
            lblN.RenderTransform = tt;
            canvas. Children.Add(lblN);

Label lblS = new Label();
            lblS.Width = 50;
            lblS.Height = 15;
            lblS.Background = Brushes.Red;
            lblS.Margin = new System.Windows.Thickness(0, 300, 0, 0);
            lblS.Content = $"S";
            lblS.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
            lblS.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            lblS.RenderTransform = tt;
            lblS.Padding = new System.Windows.Thickness(0);
            lblS.BorderBrush = Brushes.Black;
            lblS.BorderThickness = new System.Windows.Thickness(2.0);
            lblS.RenderTransform = tt;
            canvas. Children.Add(lblS);
        }

this method is called on an Menu-Eventhandler and it shows an coordinate system with (0,0) in the mid of the canvas. It should show a label with "N" at the top and a label with "S" at the bottom.

But i shows the attached image
! [Screenshot_SetHeight.png] (https://aka.ms/dc/image?name=B0f35bbf7aace44918f1f9c91b038954d637524593333606810_Screenshot_SetHeight.png&tid=0f35bbf7aace44918f1f9c91b038954d637524593333606810)

I expcted that the lblN to be more higher on the y-coordinate.

Does anyone know, why lblN looks different than lblS ?

best regards

Volkhard


Original Comments

Feedback Bot on 3/29/2021, 02:42 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 7/6/2021, 02:35 PM:

I detected that this issue hasn’t received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it’s my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.

Ashish Singh [MSFT] on 11/30/2021, 02:19 PM:

Please provide a sample repro app for this bug to be checked further.

Volkhard Vogeler on 12/11/2021, 04:28 PM:

Hello Ashish,

thanks for your request.
Attached you find an sample. select Menu “Ansicht”=> “Lagenkugeln in Pollage”

WpfApp1-v4.zip

Feedback Bot on 12/8/2021, 11:03 AM:

We will close this report in 14 days because we don’t have enough information to investigate further. To keep the problem open, please provide the requested details.

Feedback Bot on 12/27/2021, 05:41 PM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

Feedback Bot on 2/14/2022, 05:52 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions