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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:15:54+00:00 2026-05-27T10:15:54+00:00

I got a problem. There is panel1 which i want to use as my

  • 0

I got a problem. There is panel1 which i want to use as my paiting window. And i also have 2 buttons. One should draw “fillRectangle” in the middle of panel and second one should draw “fillellipse” next to it. I dont have the problem with drawing itself

Color aColor = Color::FromArgb( 255, 0, 0 ); 
SolidBrush^ aBrush = gcnew SolidBrush(aColor);
Rectangle rect = Rectangle(x, y, 10, 10);
e->Graphics->FillEllipse(aBrush, rect);

But i want to know, how to make that pressing each button draws different shape inside panel. Do i need to put both, ellipse and rectangle in panel1_Paint and use flags like…

if(ellip == 1) FillEllipse; 
if(recta == 1) FillRectangle

which are set using buttons? I hoped i can code drawing part inside button or function, and then somehow refer to that panel. Is it possible?

  • 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-27T10:15:55+00:00Added an answer on May 27, 2026 at 10:15 am

    If you want the buttons to have their own painting routines, then they draw themselves and your panel is unnecessary, in terms of drawing anyway, they’ll have their own canvas.

    If you want a panel that draws shapes on itself dependant on some property, then yes you go down something like the route you suggested, though I’d be tempted by some sort of shape class even if it wasn’t a control. Would make adding other shapes or more of a shape much easier.

    You could have panel carry a collection of shapes that implement say IDraw which takes a Graphics reference, and then just iterate through them and call it with Panel1’s graphics instance.

    If it was me though particulary if I wanted enabled, visible, tab, click etc. I’d have a ShapedButton Control.

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

Sidebar

Related Questions

I've got following problem: (c#) There is some class (IRC bot), which has method,
Hey there, i got this very annoying problem: I have a CheckBoxList getting items
I've got a problem I was wondering if there's an elegant solution to. It
I've got m2eclipse plugin installed and there's no problem syncing compile time dependencies that
I've got probably what is a simple problem, but there's no informative errors or
I want to ask about strcpy. I got problem here. Here is my code:
Got a problem with a query I'm trying to write. I have a table
I got many panels and one form. I have employed panels so I don't
I've got a HTTPHandler which returns either an image or some text and want
I have got a memory leak problem in the example below(u can download the

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.