Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Visual Studio 2005 not letting me resize a Listbox control

Posted on 2007-03-27
4
Medium Priority
?
426 Views
Last Modified: 2013-11-26
I am having trouble in Visual Studio 2005 with resizing of a listbox control.  I have the listbox control's Locked property = false, Enabled = true and a Size of 688, 407 with a Location of 22, 40.  

What I am trying to do is change the size of the listbox to 688, 412.  Seems simple right?  Well Visual Studio won't let me!  As soon as I change it, it snaps back to 407 almost as if it has somehow linked the two values together.  I tried even changing it in the Designer.cs code for that form, but it seems to ignore that code on display.  His all started happening after I set Locked = true and Enabled = false.  However, I switched both of those back, tried putting down an entirely new Listbox to see if i'd corrupted the other one somehow, tried rebooting Visual Studio etc all to no avail.  VS has decided it is smarter than me and won't let me make the changes.  I even checked the properties and turned off SnapGrid but i'm not in Snap layout mode so it shouldn't matter.

Help please!

Oh and before anyone suggests it, Listbox controls do NOT have an Autosize property.

Nathan
0
Comment
Question by:ironwill96
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18804512
Lol...it does actually have an "AutoSize" property of sorts.

What it's doing is snapping the size of the ListBox so that rows of data are not chopped off.

This is based on the size of the Font selected.

Try this...

Populate the ListBox at Design-Time with a bunch of test data like:
a
b
c
d
...
enough to fill the listbox and then some.

Now adjust the height of the ListBox using its handles and watch where it snaps and how the rows appear inside.

Now make the size of the font large, something ridiculous like 36 point.

Resize again and watch what happens...
0
 
LVL 2

Author Comment

by:ironwill96
ID: 18804589
Grr..anyway to turn off that feature since i'm using scroll bars anyway?

Thanks,
Nathan
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 18804614
I'm not sure...never tried.  On a side note, this "snapping" occurs even when you have the ListBox anchored and/or docked and you are dynamically resizing the ListBoxes container...

Aha!...found it...not so cleverly hidden under the title of "ListBox.IntegralHeight":
http://msdn2.microsoft.com/en-us/library/system.windows.forms.listbox.integralheight.aspx
0
 
LVL 2

Author Comment

by:ironwill96
ID: 18804785
Hehe, I guess that makes sense right?  I'd almost call it modulus more than integral, but whatever.   Thanks for the help!  It was driving me nuts!

Nathan
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question