Solved

Visual Studio 2005 not letting me resize a Listbox control

Posted on 2007-03-27
4
424 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 500 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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

695 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