Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 918401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:22:09+00:00 2026-05-15T18:22:09+00:00

I have an ellipse that I’d like to programatically put into a canvas. Unfortunately,

  • 0

I have an ellipse that I’d like to programatically put into a canvas. Unfortunately, the ellipse only draws in the top right. Any help?

SolidColorBrush newColor = HotSquare(col);
        Color newCol = getCol(col);
        Color newCol2 = getCol2(col);

        Ellipse el1 = new Ellipse();
        el1.Height = 40;
        el1.Width = 40;
        RadialGradientBrush rgb = new RadialGradientBrush();
        GradientStop gsa = new GradientStop();
        el1.StrokeThickness = 3;
        el1.Stroke = newColor;
        el1.StrokeDashArray = new DoubleCollection() { 6, 6 };
        gsa.Color = newCol;
        gsa.Offset = 0;
        rgb.GradientStops.Add(gsa);
        GradientStop gsb = new GradientStop();
        gsb.Color = newCol2;
        gsb.Offset = 1;
        rgb.GradientStops.Add(gsb);
        el1.Fill = rgb;

        Ellipse el2 = new Ellipse();
        el2.Height = 40;
        el2.Width = 40;
        el2.StrokeThickness = 3;
        el2.Stroke = newColor;

        //el2.Fill = new SolidColorBrush(Colors.Transparent);

        Canvas canvas = new Canvas();
        canvas.Children.Add(el1);
        //canvas.Children.Add(el2);
        TextBlock txt = new TextBlock();
        txt.Text = "\n   " + amnt.ToString();
        txt.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
        txt.Height = 60;
        txt.Width = 60;
        txt.HorizontalAlignment = HorizontalAlignment.Center;
        //txt.VerticalAlignment = VerticalAlignment.Bottom;
        txt.FontSize = 12;
        canvas.Children.Add(txt);
        Border border = new Border();
        border.BorderBrush = newColor;
        border.BorderThickness = new Thickness(2);
        border.Child = canvas;
        LocationRect lr = new LocationRect(North, West, South, East);
        HotspotLayer.AddChild(ele, lr);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:22:10+00:00Added an answer on May 15, 2026 at 6:22 pm

    You can call Canvas.SetTop and Canvas.SetLeft on the child element to set its position in the Canvas.

    Canvas.SetTop(el2, 100);
    Canvas.SetLeft(el2, 100);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the deal. I have multiple points (X,Y) that form an 'ellipse like'
I have a point on a canvas that I want to place an ellipse.
I have an ellipse (prew) that I want to delete from canvas (canvas1) by
I have a DepencencyProperty (a boolean) that works fine on an Ellipse, but not
I would like to create a UserControl that will have some behavior(animated collapsing...) and
I have an Ellipse and a TextBlock that I want to be Centred relative
I have a picturebox that has an image in it and a top of
I have a number of ellipse controls that are programmatic added on a page.
This is what I'm trying to accomplish: I want to have a canvas that
I am programmatically creating an Ellipse shape but I can't find any property that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.