473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Visible controls reports not visible

Hi
I have a problem in one of my user controls that I cannot find any solution
for.
I'am running C# for Visual studio 2003 and developing a windows application.
The problem is the following:
I have a user control with several panels inside it. Each panel is docked at
top, which means that if one panel is hidden, the panels underneath it will
move up to cover the newly hidden area (basic information, I know, but just
to clarify :-). Forms in my application that are using this control should
adjust their heights, so that the user control fits into them, without any
blank area.
In this user control I have some properties that can be set to true/false,
which in turns shows or hides the panels.
Now to the strange thing: When hiding some of the panels, I want to change
the size of the user control not to have any blank area in it. This is done
by looping through all of the panels in the control and checking the visible
property. The panel with the location at the bottom that has its visible
property set to true decides the height of the control.
The problem is that all panels report their visible property set to false
when looping through them - always. Even if they report their visible
property to false, the panels that should be visible (according to the
properties I have) are visible, so the control behaves correctly in this
case. The problem is that the reported height of the control is not ok.
The application is only running in one thread.
Have anyone a solution to this?

/Fredrik
Aug 22 '07 #1
3 3712
When a Control is hidden, by virtue of being underneath another Control, its
Visible property is false. Rather than setting the Visible property, why not
just use the BringToFront method of the Control to bring it to the top, then
resize the UserControl to fit the top Panel?

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Fredrik" <Fr*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.com...
Hi
I have a problem in one of my user controls that I cannot find any
solution
for.
I'am running C# for Visual studio 2003 and developing a windows
application.
The problem is the following:
I have a user control with several panels inside it. Each panel is docked
at
top, which means that if one panel is hidden, the panels underneath it
will
move up to cover the newly hidden area (basic information, I know, but
just
to clarify :-). Forms in my application that are using this control should
adjust their heights, so that the user control fits into them, without any
blank area.
In this user control I have some properties that can be set to true/false,
which in turns shows or hides the panels.
Now to the strange thing: When hiding some of the panels, I want to change
the size of the user control not to have any blank area in it. This is
done
by looping through all of the panels in the control and checking the
visible
property. The panel with the location at the bottom that has its visible
property set to true decides the height of the control.
The problem is that all panels report their visible property set to false
when looping through them - always. Even if they report their visible
property to false, the panels that should be visible (according to the
properties I have) are visible, so the control behaves correctly in this
case. The problem is that the reported height of the control is not ok.
The application is only running in one thread.
Have anyone a solution to this?

/Fredrik

Aug 22 '07 #2
Thanks for the answer.

My bad english is also playing in this :-)
The panels are not underneeth each other, they are stacked. All panels are
in the same containter (the user control's main area). With all panel's dock
property set to TOP, they are stacked on each other meaning that if the first
panel has its location at 0,0 and a height of 100, the second panel gets its
location to 0,100 etc. When setting the first panels visible property to
false, the second panel is automatically moved to 0,0.
So my intension is to check which panel is at bottom, and is visible (with
its Location or Top property higher than other panels).
But when I check the panel's visible property, all panels have "false" even
if they are visible.
I'll try to show below how I mean in more detail:
My user control contains 4 panels, A,B,C and D, all in the same container.
They are visually as shown below:
A
B
C
D
In some cases, I want to hide panels C or D. Lets assume that panel C is to
be hidden. When setting the visible property to false for panel C, panel D
moves up to panel C's old position (due to the dock property). Then I want to
check their visible property, but this always return false.
I've seen then phenomena when setting properties for visual controls from
another thread, but in this case I only have 1 thread.

Long explenation, but hope it will show what I want, and explain more in
detail what my problem is.
/Fredrik

"Kevin Spencer" wrote:
When a Control is hidden, by virtue of being underneath another Control, its
Visible property is false. Rather than setting the Visible property, why not
just use the BringToFront method of the Control to bring it to the top, then
resize the UserControl to fit the top Panel?

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Fredrik" <Fr*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.com...
Hi
I have a problem in one of my user controls that I cannot find any
solution
for.
I'am running C# for Visual studio 2003 and developing a windows
application.
The problem is the following:
I have a user control with several panels inside it. Each panel is docked
at
top, which means that if one panel is hidden, the panels underneath it
will
move up to cover the newly hidden area (basic information, I know, but
just
to clarify :-). Forms in my application that are using this control should
adjust their heights, so that the user control fits into them, without any
blank area.
In this user control I have some properties that can be set to true/false,
which in turns shows or hides the panels.
Now to the strange thing: When hiding some of the panels, I want to change
the size of the user control not to have any blank area in it. This is
done
by looping through all of the panels in the control and checking the
visible
property. The panel with the location at the bottom that has its visible
property set to true decides the height of the control.
The problem is that all panels report their visible property set to false
when looping through them - always. Even if they report their visible
property to false, the panels that should be visible (according to the
properties I have) are visible, so the control behaves correctly in this
case. The problem is that the reported height of the control is not ok.
The application is only running in one thread.
Have anyone a solution to this?

/Fredrik


Aug 22 '07 #3
Hi Fredrik,

That is odd. I have not tried something similar, but I will take your word
that this is what you are seeing.

I suppose you will have to implement a tracking mechanism to keep track of
the state of the Panels when it changes.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Fredrik" <Fr*****@discussions.microsoft.comwrote in message
news:2E**********************************@microsof t.com...
Thanks for the answer.

My bad english is also playing in this :-)
The panels are not underneeth each other, they are stacked. All panels are
in the same containter (the user control's main area). With all panel's
dock
property set to TOP, they are stacked on each other meaning that if the
first
panel has its location at 0,0 and a height of 100, the second panel gets
its
location to 0,100 etc. When setting the first panels visible property to
false, the second panel is automatically moved to 0,0.
So my intension is to check which panel is at bottom, and is visible (with
its Location or Top property higher than other panels).
But when I check the panel's visible property, all panels have "false"
even
if they are visible.
I'll try to show below how I mean in more detail:
My user control contains 4 panels, A,B,C and D, all in the same container.
They are visually as shown below:
A
B
C
D
In some cases, I want to hide panels C or D. Lets assume that panel C is
to
be hidden. When setting the visible property to false for panel C, panel D
moves up to panel C's old position (due to the dock property). Then I want
to
check their visible property, but this always return false.
I've seen then phenomena when setting properties for visual controls from
another thread, but in this case I only have 1 thread.

Long explenation, but hope it will show what I want, and explain more in
detail what my problem is.
/Fredrik

"Kevin Spencer" wrote:
>When a Control is hidden, by virtue of being underneath another Control,
its
Visible property is false. Rather than setting the Visible property, why
not
just use the BringToFront method of the Control to bring it to the top,
then
resize the UserControl to fit the top Panel?

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Fredrik" <Fr*****@discussions.microsoft.comwrote in message
news:56**********************************@microso ft.com...
Hi
I have a problem in one of my user controls that I cannot find any
solution
for.
I'am running C# for Visual studio 2003 and developing a windows
application.
The problem is the following:
I have a user control with several panels inside it. Each panel is
docked
at
top, which means that if one panel is hidden, the panels underneath it
will
move up to cover the newly hidden area (basic information, I know, but
just
to clarify :-). Forms in my application that are using this control
should
adjust their heights, so that the user control fits into them, without
any
blank area.
In this user control I have some properties that can be set to
true/false,
which in turns shows or hides the panels.
Now to the strange thing: When hiding some of the panels, I want to
change
the size of the user control not to have any blank area in it. This is
done
by looping through all of the panels in the control and checking the
visible
property. The panel with the location at the bottom that has its
visible
property set to true decides the height of the control.
The problem is that all panels report their visible property set to
false
when looping through them - always. Even if they report their visible
property to false, the panels that should be visible (according to the
properties I have) are visible, so the control behaves correctly in
this
case. The problem is that the reported height of the control is not ok.
The application is only running in one thread.
Have anyone a solution to this?

/Fredrik



Aug 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Supra | last post by:
I have 8 panels control on right side uing treeview control. this will work in vb6 but can't figuring in vb.net. and i got error Sub PanelVisible(ByVal szPanel As String) Dim i As Integer,...
2
by: tshad | last post by:
I have a datagrid that has objects that are not visible and I need to use them in my Sql Statement. The problem is they are not there when set as "visible=false", but they are if set to true. ...
6
by: Nick Stansbury | last post by:
Hi, I have a loop running on Page_PreRender that sets a number of controls to invisible based on a set of criteria. Before I do this however, I set all of the drop down lists to be visible with...
6
by: Marc Robitaille | last post by:
Hello, Hello, I developed a UserControl. It has funny behavior. It is composed of three controls. A texbox, a combobox and a button. There are three properties to indicate the visibility of...
2
by: kaosyeti | last post by:
i can't get this working. in vba i tried to set visible to false in an if statement that looked like this: Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer) If...
8
by: Hansen | last post by:
Hi I have a form with multiple labels and textboxes and listboxes that need to be made visible and not visible when buttons are clicked. Is there anyway of grouping them together so that I have...
0
by: Madhu Subramanya | last post by:
I have a Crystal Report 10 report which i need to use in my app. I use Managed solution for this. There are no compiler or linker problems. I am not able to display this report on the screen but am...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
8
by: Dan | last post by:
Hi, i experimented with postback and viewstate. With this code, there are 2 dropdownlists created, one visible and with AutoPostBack true, the other not visible and no AutoPostBack, and one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.