473,376 Members | 1,043 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,376 software developers and data experts.

Making size of control = size of form

Hello all;

I'm trying to simulate a "scrollable context menu". What I want is to have
a listbox fill the entire area of a small form (with no border).

Using the designer and property grid, I noticed that if I set the form size
first, then try to copy and paste this value into the size of the listbox
(making sure the listbox is in location 0,0 first), the designer won't let
the listbox fill the entire form area - there are 9 pixels of the form at
the bottom still showing (when you paste the size value in for the listbox,
watch how 9 is magically subtracted from the height).

If I go the other way, and set the size of the listbox first, then paste
that value into the size of the form, it works OK.

Can anyone explain the difference to me? I think it might have something to
do with the absence of the title bar - there seems to be a 4x4 pixel border
around that, which is probably left behind when I set border style to
"none".

Also, when I try to create the listbox in code, the 9 pixels always show,
regardless of whether I set the size of the form or listbox first.

Thanks for any info,

Derrick
Nov 16 '05 #1
4 1855
Not sure about the form stuff, but it sounds like what you really want is a
UserControl, not a form. If you put a control onto a UserControl, then set
the "Dock" property to "fill", it will fill the entire area of the control.
You can show and hide that and move it wherever you want, even add
properties to it.

-Rachel

"Derrick" <de***********@hotmail.com> wrote in message
news:7m*******************@news20.bellglobal.com.. .
Hello all;

I'm trying to simulate a "scrollable context menu". What I want is to have a listbox fill the entire area of a small form (with no border).

Using the designer and property grid, I noticed that if I set the form size first, then try to copy and paste this value into the size of the listbox
(making sure the listbox is in location 0,0 first), the designer won't let
the listbox fill the entire form area - there are 9 pixels of the form at
the bottom still showing (when you paste the size value in for the listbox, watch how 9 is magically subtracted from the height).

If I go the other way, and set the size of the listbox first, then paste
that value into the size of the form, it works OK.

Can anyone explain the difference to me? I think it might have something to do with the absence of the title bar - there seems to be a 4x4 pixel border around that, which is probably left behind when I set border style to
"none".

Also, when I try to create the listbox in code, the 9 pixels always show,
regardless of whether I set the size of the form or listbox first.

Thanks for any info,

Derrick

Nov 16 '05 #2
Why are you not setting the dock property to fill? Also, you need to turn of
the integral height, which will always make the listbox display whole items,
not partial items, that's what causing the automatic resizing you
experience.

You should post this to the windowsfoms newsgroup.

Etienne Boucher.
"Derrick" <de***********@hotmail.com> a écrit dans le message de
news:7m*******************@news20.bellglobal.com.. .
Hello all;

I'm trying to simulate a "scrollable context menu". What I want is to have a listbox fill the entire area of a small form (with no border).

Using the designer and property grid, I noticed that if I set the form size first, then try to copy and paste this value into the size of the listbox
(making sure the listbox is in location 0,0 first), the designer won't let
the listbox fill the entire form area - there are 9 pixels of the form at
the bottom still showing (when you paste the size value in for the listbox, watch how 9 is magically subtracted from the height).

If I go the other way, and set the size of the listbox first, then paste
that value into the size of the form, it works OK.

Can anyone explain the difference to me? I think it might have something to do with the absence of the title bar - there seems to be a 4x4 pixel border around that, which is probably left behind when I set border style to
"none".

Also, when I try to create the listbox in code, the 9 pixels always show,
regardless of whether I set the size of the form or listbox first.

Thanks for any info,

Derrick

Nov 16 '05 #3
I was using the dock property, but that yielded the same effect as sizing.
The integral height should be the fix I was missing - thanks a lot!

BTW: for some reason, my newsreader doesn't see the windows forms newsgroup,
hence my posting here. Sorry.

Derrick
"Etienne Boucher" <et*****@novat.qc.ca> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Why are you not setting the dock property to fill? Also, you need to turn of the integral height, which will always make the listbox display whole items, not partial items, that's what causing the automatic resizing you
experience.

You should post this to the windowsfoms newsgroup.

Etienne Boucher.
"Derrick" <de***********@hotmail.com> a écrit dans le message de
news:7m*******************@news20.bellglobal.com.. .
Hello all;

I'm trying to simulate a "scrollable context menu". What I want is to have
a listbox fill the entire area of a small form (with no border).

Using the designer and property grid, I noticed that if I set the form

size
first, then try to copy and paste this value into the size of the listbox (making sure the listbox is in location 0,0 first), the designer won't let the listbox fill the entire form area - there are 9 pixels of the form at the bottom still showing (when you paste the size value in for the

listbox,
watch how 9 is magically subtracted from the height).

If I go the other way, and set the size of the listbox first, then paste
that value into the size of the form, it works OK.

Can anyone explain the difference to me? I think it might have something to
do with the absence of the title bar - there seems to be a 4x4 pixel

border
around that, which is probably left behind when I set border style to
"none".

Also, when I try to create the listbox in code, the 9 pixels always

show, regardless of whether I set the size of the form or listbox first.

Thanks for any info,

Derrick


Nov 16 '05 #4
Thanks Rachel. That would be a better solution, except that I never
mentioned that I wanted this to work on both the Framework and Compact
Framework. In order to get the overlay effect I wanted on CF, I had to use
a form.

Appreciate your help,

Derrick
"Rachel Suddeth" <ra****@bldhound.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Not sure about the form stuff, but it sounds like what you really want is a UserControl, not a form. If you put a control onto a UserControl, then set
the "Dock" property to "fill", it will fill the entire area of the control. You can show and hide that and move it wherever you want, even add
properties to it.

-Rachel

"Derrick" <de***********@hotmail.com> wrote in message
news:7m*******************@news20.bellglobal.com.. .
Hello all;

I'm trying to simulate a "scrollable context menu". What I want is to have
a listbox fill the entire area of a small form (with no border).

Using the designer and property grid, I noticed that if I set the form

size
first, then try to copy and paste this value into the size of the listbox (making sure the listbox is in location 0,0 first), the designer won't let the listbox fill the entire form area - there are 9 pixels of the form at the bottom still showing (when you paste the size value in for the

listbox,
watch how 9 is magically subtracted from the height).

If I go the other way, and set the size of the listbox first, then paste
that value into the size of the form, it works OK.

Can anyone explain the difference to me? I think it might have something to
do with the absence of the title bar - there seems to be a 4x4 pixel

border
around that, which is probably left behind when I set border style to
"none".

Also, when I try to create the listbox in code, the 9 pixels always

show, regardless of whether I set the size of the form or listbox first.

Thanks for any info,

Derrick


Nov 16 '05 #5

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

Similar topics

0
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
4
by: JMUApache | last post by:
Hi, A have a problem with Inhreit Control. I try to Change its Size in Construct Function, And it works. Code Here: -------------------------------------------------- public class...
4
by: Steve Amey | last post by:
Hi all I have a Form that is inherited from a main form. On the child form I am putting 2 panels directly on the form, not in any other controls. If I build the project, 1 of the panels decides...
1
by: Ricardo Furtado | last post by:
in my app i must have several pictureboxes over the others. Some pictureboxes just have a couple of lines or rectangles, and absolutly nothing more but the image is an .BMP. So, my problem is that...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
11
by: herman404 | last post by:
Hi everyone, I have a DataGrid that displays data on a dialog application. When the dialog is resized, the datagrid keeps the same shape, We would need the datagrid to keep a relative shape...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
4
by: =?Utf-8?B?ZHNoZW1lc2g=?= | last post by:
Hello, I have a project with windows forms. The size of the forms is fixed, and the text in the form is made to fit exactly in the form. The problem is that if the user changes the font size in...
4
by: Hamed | last post by:
Hello I have a UserControl sized to 100; 200 When I drop it in my form the initial size is 100;200 (as I prefer). Then I decided to change the size of my UserControl to 200;200 but although I...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.