C# Displaying same panel across different tabs - c#

I have a tabcontrol with multiple tabs and I want a panel that shows progress bar to be visible whenever user is processing something and be hidden when the processing has completed.
I added that panel in first tab of the tabcontrol. However, now the panel will only be visible when user selects the first tab but disappears when user selects other tabs.
I want the panel to display when user selects other tabs. How can I do that?

Is there something wrong with putting it outside the TabControl?

I hope you talk about WPF, if so, wrap the TabControl in a grid
give the grid 2 childs first tb control second the progress bar, whenever you set the progress bar visibility to visible it'll be on top of screen.

Related

Reaching Controls

So lets say I have a Panel. Inside of it there is a Button and TextBox. I can reach those controls' control with panel.Controls[index] with this way.
I am trying to reach panel with reverse way. I mean lets say I click the textbox inside of panel. And the active control of form became the textbox. Is there any possible way to reach that panel with active control?
Panel -> Textbox instead of Active Control -> Panel
Thanks

Penal of User control going back side of parent panel

I have prepared one dropdown user control with a searching feature using textbox, panel, and checked listview.
when I click on down arrow PictureBox or in the displayed textbox, the listview panel will open as dropdown, and based on the mouse click I hiding and showing checked listview panel.
Now, when I put my user control within any panel and an open dropdown that time my user control's listview panel is going backside of the parent control/panel as I shown in the screen.
Please Help me.

How do I keep my winforms controls from overlapping when I expand the application?

I have a pretty simple winforms application. It contains a rich edit box, embedded browser, progress bar, a few buttons etc.
I have the anchors on the controls set to expand in all directions.
When expanding up and down, however, the controls will overlap one another. How do I prevent this from happening?
Thanks
Your best bet is to add a TableLayoutPanel to your form which contains the "layout grid" this should be docked to the form, then you can add your controls into the cells in the table (they can cover multiple rows and columns so you can get the layout you want).
You must set the property Autosize=true on every control, especially on the main form.
Note that some controls like TabControl have this property, but you can't see it with intellisense (Attribute Browseable=false).

DataGridView cannot be Focused, but one of them can

I've come across the strangest bug pertaining to DataGridViews in Windows Forms.
I have a TabControl, that is supposed to contain a docked DataGridView in each tab page. I thought it would be convenient that the grid is focused upon changing the tab page, so that the user could simply hover the mouse over the grid and start scrolling when he changes the page. So, I just put a grids[tabs.SelectedIndex].Focus() in the event handler for changing the tab page.
However, something really strange happened. In my test application, I have three tab pages. If I try scrolling the grid right after starting the application, it doesn't work; I have to click in the grid first. I was expecting this. However, if I change the tab page, I can't scroll in any of the other grids until I click, except for the first one!
So, if I switch pages to the second page, then back to the first, I can automatically scroll that grid without clicking, but if I then switch to the third, I have to click for the grid to focus.
I had a look at the CanFocus properties of the grids, and it seems that only the first grid has it set to True. They are all created programmatically, and all in the same way. I don't see why they would be different.
Any ideas?
Inactive tab pages have their Visible property set to false. The documentation for CanFocus says:
In order for a control to receive
input focus, the control must have a
handle assigned to it, and the Visible
and Enabled properties must both be
set to true for both the control and
all its parent controls
Well, I solved it. Stupid programming error on my part, I had grids[tabs.TabIndex].Focus() instead of grids[tabs.SelectedIndex].Focus().
Oh well.

GUI Design: Hide/Show controls at run time

what is the best idea/technique to do this and I prefer not to create all these at run time and not using the Tabs control:
let's say we have three radio buttons on the form and based on the user selection we want to show him different GUI stuff ( checkbox, listbox, etc ... ) on the same form.
How to do that?
Set the controls' Visible property to false.
This will be easiest to do if you put the controls on different panels and show / hide the panels instead of hiding each control separately.
Controls have a Visible property, that makes the control disappear when it is set to False. When a button is clicked, you could write some code that sets certain controls to be invisible.

Categories

Resources