473,655 Members | 3,072 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()
{
InitializeCompo nent();
ToggleState(pbS tartOpen);
}

private void ToggleState(boo l bOpen)
{

if (bOpen == false)
{
// close up
this.Height = (cmdOpenShut.He ight + 6);
cmdOpenShut.Tex t = psClosedCaption ;
}
else
{
// open up
this.Height = piToolFrameHeig ht;
cmdOpenShut.Tex t = psOpenCaption;
}
}
Mar 2 '07 #1
1 1100
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()
{
InitializeCompo nent();
ToggleState(pbS tartOpen);
}

private void ToggleState(boo l bOpen)
{

if (bOpen == false)
{
// close up
this.Height = (cmdOpenShut.He ight + 6);
cmdOpenShut.Tex t = psClosedCaption ;
}
else
{
// open up
this.Height = piToolFrameHeig ht;
cmdOpenShut.Tex t = 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
1492
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 being requested? Code snippet would be great. Thanks! -- Joe Fallon
0
1128
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 on the Internet and 2.) have FileIOPermission... Is there a way of deployment where the final user (the user who's just surfing on the internet) doesn't have to set the FileIOPermission to the assembly manually? Like the way signed ActiveX...
5
1991
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 like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a bug.
0
1419
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 that the user inputs). For example, the first seven numbers will be 0,1,1,2,3,5,8). I also have to write a subroutine that generates Pascal's triangle (the first n rows, where n is an integer number that the user inputs). For example, the first...
2
1469
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 2000 several weeks ago that involved programatically building a user menu (selections are file, company plants, suppliers, database tables for example). In the Access 2000 environment, the menu was loaded when I loaded the main user form and...
0
1467
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. Windows Form - I use this mostly to create my windows forms 2. Dialog - I use this for windows that need user intervention 3. Explorer Form - maybe I will use this if I plan to make something like windows explorer 4. MDI Parent Form - I also use this...
1
2378
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 in the right direction. Ok the problem. I am creating a program that ask the user to input a height value, the program will then do a calculation and create a golden ratio width. The type of both the height and the width are double. This is...
8
1605
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 windows application (lets call it TWinApp1) with just a couple of buttons and a text box. It is very simple and runs fine in the debugger. Using TWinApp1 I'm trying to learn how to create a setup program to install an application on a system....
6
11479
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
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
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 we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.