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 600011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:33:38+00:00 2026-05-13T16:33:38+00:00

I have a custom C# user-control where I would like to draw a circle

  • 0

I have a custom C# user-control where I would like to draw a circle behind a textbox anchored to the centered bottom of the control. I’m drawing the circle like:

protected override void OnResize(EventArgs e)
{
   this.gp= new GraphicsPath();
   this.gp.AddEllipse(0,0,width,height); //this is the width and height of the control
   this.Region=new Region(this.gp);
   this.Refresh();
   base.OnResize (e);
}

protected override void OnPaint(PaintEventArgs pe)
{
   Color centerColor = Color.FromArgb(255,255,255,255);
   Color surroundColor = Color.FromArgb(255,255,255,255);
   PathGradientBrush br=new PathGradientBrush(this.gp);
   br.CenterColor=centerColor;
   br.SurroundColors=new Color[]{surroundColor};
   pe.Graphics.FillPath(br,this.gp);
}

I’ve added the textbox to the control in the GUI designer.

When I run this I end up with something like this:

alt text

How can I keep the ellipse behind the textbox?

Thanks,
Mark

  • 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-13T16:33:38+00:00Added an answer on May 13, 2026 at 4:33 pm

    If you want this in the background, do this in the “OnPaintBackground” override rather than in OnPaint. Then, when you want to draw it, invalidate the region the ellipse is in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom user control with a textbox on it and I'd like
I would like to expose a complex property from a custom ASP.NET user control,
I have a custom user control that contains asp:ValidationSummary . It is placed on
I have a custom validation function in JavaScript in a user control on a
I have a custom WinForms control (inherits from control, i.e. without user interface jsut
I have this custom wpf user control: ShowCustomer.xaml: <UserControl x:Class=TestControlUpdate2343.Controls.ShowCustomer xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <Grid> <TextBlock
I have created a custom WPF user control which is intended to be used
If I have a custom user control (say, MyCustomControl.ascx) which contains a number of
I have a number of application settings (in user scope) for my custom grid
I have implemented my custom button inheriting from CButton and drawing it by using

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.