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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:56:09+00:00 2026-05-24T06:56:09+00:00

I have two panels: one that is always visible and another that gets declared

  • 0

I have two panels: one that is always visible and another that gets declared later and belongs to the first panel:
“panel1.Controls.Add(this.Panel2);”

The whole program always has 2 TextBoxes, 7 PictureBoxes that are used as buttons, 3 labels and 1 panel (they are declared as soon as the program starts running).

After the second panel is declared, a drawing function activates. The function draws on the second panel.

If Panel2 is higher or wider (or both) than Panel1 (Panel2 becomes partly visible), the first time when the drawing function gets called, the second panel becomes blank after the drawing function finishes. I have to re-size the window, or something in order to have my drawing back (the drawing function gets called in many cases). If Panel2 is smaller than Panel1 in every way, the problem doesn’t happen.

Panel2 is being manipulated is in this sequence:
Declaring Panel2;
Adjusting Panel2’s properties;
Adding Panel2 to Panel1;
Drawing on Panel2;
Other Panel2 related stuff.

At first I used buttons and a PictureBox inside Panel1. The problem used to happen only if the buttons weren’t using their default appearances (no matter the size of the PictureBox). Later I changed the PictureBox with a Panel and the buttons with PictureBoxes (I wanted to make custom buttons). After that change I faced the problem again.

The code is big, and I’m not sure if it is necessary. I surely have a problem with the algorithm of the code.

  • 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-24T06:56:10+00:00Added an answer on May 24, 2026 at 6:56 am

    You’re drawing wrong.

    You need to draw inside a Paint handler so that your content gets redrawn whenever the control is repainted.
    You should never draw to control.CreateGraphics().

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

Sidebar

Related Questions

I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains
I have two spreadsheets... when one gets modified in a certain way I want
I have two panels that i wish to display to the user. I decided
Here's the idea: I have two panels that have MouseDown events. The idea I
I have two applications that use the same data to create a UI, one
I have two columns. One with fixed size (220px) and the other that fills
I have two applications written in Java that communicate with each other using XML
I have two identical tables and need to copy rows from table to another.
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources

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.