473,830 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1876
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******** ***********@new s20.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******** ***********@new s20.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******** ******@tk2msftn gp13.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******** ***********@new s20.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****@bldhoun d.com> wrote in message
news:eB******** ******@TK2MSFTN GP12.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******** ***********@new s20.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
2771
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 and goes to the index file again, I can't figure out how it opens the chatroom. I want to get it to skip the login box and go straight to the room, with user name "guest" or "" or whatever but I'll add a field to type the name in the chat room....
4
1578
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 UserControl:TextBox {
4
2247
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 to re-size itself, but the other one doesn't. Obviously, I don't want the panels re-sizing every time I perform a build. Has any-one encountered this behaviour at all? If I look at the code in the form, the size of the panel is correct, but...
1
8813
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 i need to see whats beind those pictureboxes and at the same time showing, the lines and rectangles that exist on the pictureboxes that are at the top. Because i just can't copy the image to the other picturebox (because i'll have to be able to...
14
3438
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 PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of
11
2876
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 compared to the rest of the dialog when the user resizes it. Any ideas on how to do this? Thanks!
18
25017
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, that IE7 does not seem to offer any way to control the font size of a text input element.
4
1426
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 windows, the form itself doesn't change its size but the text becomes bigger, and only part of it is seen. Is there anyway to make the text remain in the same size always, regardless of the font size of windows? thanks, --
4
9333
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 have not set any value to the size of the dropped control in my form, recompiling the project does not affect the new size of the user control in my form. Surprisingly if I reset the Size property of my user control in the form, the size changes...
0
9793
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
10774
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10491
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7746
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
6951
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
5617
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
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4411
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
3959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.