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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:49:45+00:00 2026-06-07T02:49:45+00:00

I have created a method which draws all the controls to the panel, but

  • 0

I have created a method which draws all the controls to the panel, but its draws them based on the order which I have listed them, which means PictureBox1 will always be behind all the other pictureboxes. Example:

e.Graphics.DrawImage(PictureBox1.BackgroundImage,
    new Rectangle(PictureBox1.Location, PictureBox1.Size));

e.Graphics.DrawImage(PictureBox2.BackgroundImage,
    new Rectangle(PictureBox2.Location, PictureBox2.Size));

it draws PictureBox1 first, then PictureBox2 second, then PictureBox3 third etc…

This means that PictureBox2 get drawn Over PictureBox1, and PictureBox3 gets Drawn over PictureBox2. Here’s a pic to display overlapping images:

Now when I push a button when focus is on picturebox2 I would like the DrawImage order to be changed so that PictureBox2 is drawn last.
I’m sure one of you has a great solution to this, I would like to listen to any suggestions you may have.

  • 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-06-07T02:49:46+00:00Added an answer on June 7, 2026 at 2:49 am

    In your question you haven’t made it clear what determines the order for all the other picture boxes in the panel. However, you can achieve the same effect using SetChildIndex. To Swap the position of PictureBox1 with PictureBox2 for instance, you can do:

    var p1ndex = panel.Controls.IndexOf(pBox1);
    var p2ndex = panel.Controls.IndexOf(pBox2);
    panel.Controls.SetChildIndex(pBox1, p1ndex);
    panel.Controls.SetChildIndex(pBox2, p2ndex);
    

    Here, pBox1 could be the last PictureBox you hovered on and pBox2 the current one you’re hovering on…

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

Sidebar

Related Questions

I have created a Webpage which will post as post method..not as get method.
I have created a custom shipping method to show depo-names from which customers will
I have created a class library called AddServiceLibrary in which I have a method
I have created a class which extends Gallery. There is no onCreate() method in
We have repositories which have a Save method. They also throw a Created event
I have a winforms, and it connecting wit webservice. Webservice has method which create
I'm developing an ASP.NET forms webapplication using C#. I have a method which creates
I have a web service method in which I create a particular type of
I create small application which is media player. I have method where I have
Hi I want to create a WCF service that have login method, which is

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.