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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:48:18+00:00 2026-05-14T06:48:18+00:00

In CSS, we have a Property called z-index, what is the same in WinForms

  • 0

In CSS, we have a Property called z-index, what is the same in WinForms set for a Panel control to the "Z-Index?

  • 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-14T06:48:18+00:00Added an answer on May 14, 2026 at 6:48 am

    WinForms has a z-order, but you can’t access it as a number. Instead, every control has a BringToFront method and a SendToBack method, which move the control to the top of the z-order or to the bottom, respectively.

    Not sure exactly why it was exposed this way, although you rarely encounter situations where either BringToFront or SendToBack don’t provide what you need.

    Update: I’m wrong, you can access the z-order directly via a method on the control’s container’s Controls collection. Here’s a simple method that wraps it:

    public void SetControlZOrder(Control ctrl, int z)
    {
        ctrl.Parent.Controls.SetChildIndex(ctrl, z);
    }
    

    I’m guessing they encapsulated this in BringToFront and SendToBack just to keep everything simple and easy to use. I applaud.

    Update 2: I interpreted your comments to a different answer here to mean that you want to be able to take a control that is inside a panel and larger than the panel (so that part of it is hidden) and make it so that the control is in front of the panel and larger than it (so that you see the whole control).

    You can do this by removing the control from the panel, shifting its position by the original panel’s position, and adding it to the form’s controls:

    panel1.Controls.Remove(button1);
    button1.Left += panel1.Left;
    button1.Top += panel1.Top; 
    this.Controls.Add(button1);
    

    The Left and Top shifts are necessary because the button’s position was originally relative to the panel, and will now be relative to the form. The shifts keep it in the original virtual position, so it appears to come out of the panel.

    You would then have to deal with putting it back in the panel, which is just a reverse of the above code.

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

Sidebar

Related Questions

I have a CSS class called grid which I place on my tables. I
Is it possible to use 2 CSS classes that have the same name for
By default the CSS Width property is set to value Auto. What width value
I have the following style in an external CSS file called first.css table {
i have a web page using a css style file who have this property:
I have this style property in my css file: .table tbody tr:hover th, .table
I need to set a CSS property in this script to go along with
I have to get needed css property of element (properties may be inherited from
Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are
It is advisable to use tables in HTML pages (now that we have CSS)?

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.