473,503 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie needs help with a user control problem

3 New Member
Hi guys and gals!

I'm writting a simple user control and I need to conditionally set the size of it at control load time.

I have coded that into the constructor. It runs but the changes are not displayed on the screen (on the form at run time). At this time the parent property of the control is null. At what point (ie is there a handy event) are the properties BOTH standard and my custom ones all loaded up?

I need access to the design time porperties to decide on the visual setup of the control.

I'd be really gratefull for a steer in the right direction.

Here's the code:

public DrawerControl()
{
InitializeComponent();
ToggleState(pbStartOpen);
}

private void ToggleState(bool bOpen)
{

if (bOpen == false)
{
// close up
this.Height = (cmdOpenShut.Height + 6);
cmdOpenShut.Text = psClosedCaption;
}
else
{
// open up
this.Height = piToolFrameHeight;
cmdOpenShut.Text = psOpenCaption;
}
}
Mar 2 '07 #1
1 1095
r035198x
13,262 MVP
Hi guys and gals!

I'm writting a simple user control and I need to conditionally set the size of it at control load time.

I have coded that into the constructor. It runs but the changes are not displayed on the screen (on the form at run time). At this time the parent property of the control is null. At what point (ie is there a handy event) are the properties BOTH standard and my custom ones all loaded up?

I need access to the design time porperties to decide on the visual setup of the control.

I'd be really gratefull for a steer in the right direction.

Here's the code:

public DrawerControl()
{
InitializeComponent();
ToggleState(pbStartOpen);
}

private void ToggleState(bool bOpen)
{

if (bOpen == false)
{
// close up
this.Height = (cmdOpenShut.Height + 6);
cmdOpenShut.Text = psClosedCaption;
}
else
{
// open up
this.Height = piToolFrameHeight;
cmdOpenShut.Text = psOpenCaption;
}
}
The changes need to be placed before setVisible(true) is called. Can you provide the code for the size change?
Mar 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1489
by: Joe Fallon | last post by:
I have a user control which can appear on many pages. The control needs to know which page it is on so it can render itself correctly. What is the best way for the control to find out what page is...
0
1113
by: John Delange | last post by:
Hello, I wrote a .NET Windows.Forms User Control that needs to be runned through Internet Explorer, like in this article: http://www.15seconds.com/issue/030610.htm. This control needs to 1.) Run...
5
1981
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
0
1404
by: Statsstudent2006 | last post by:
Hello! I am a newbie, and have received my first VBA assignment. I have to write a subroutine that generates the Fibonacci sequence of numbers (the first n numbers, where n is an integer number...
2
1458
by: accessnovice | last post by:
Hello All! I am new to programming in the MS Access environment and decided to join this community due to various problems I encountered in Access 2000 and 2003. I began a small project in Access...
0
1461
nev
by: nev | last post by:
I know when is best to use some templates but listed below are most that I don't know when is best to use or even know how to use: I am creating a windows application with mysql backend. 1....
1
2366
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
8
1598
by: jch | last post by:
Sorry for the newbie question but I'm trying to learn Visual Studio. I've got VS Express 2008 and I'm using visual basic. I'm trying to learn how to deploy a program so I've written a very basic...
6
11465
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.