I have a drop down list in asp.net. I want to increase its height. please suggest, how to icrease it.
There is a height property on the drop down list.
myDropDown.Height = 200;
BTW: There is pleny of information around on how to do it:
http://dotnetslackers.com/Community/forums/asp.net-dropdownlist-item-height/p/3151/31235.aspx
http://www.vbforums.com/showthread.php?t=419074
http://forums.asp.net/t/1300753.aspx/1
If setting the height property is not helping you,
One way of achieving this by increasing the font of the dropdown as it gets set based on the height of its contents.
Or you could set it via css (not sure will work in all browsers)
Please edit to describe your current scenario with some code
Set the Height property of the control
Related
My DropDownList won't keep the size setted in the CSS.
When the input is focused, the size is larger than expected.
Otherwize, the size is good.
What should I do for keeping the size of the DropDownList at the good size even if the input is focused ?
Thank you for your help.
You can use the css :focus
input:focus {
//set the style the same as your input while not focused
}
I used this: onmousedown="$(this).focus()"
So I'm making a C# Windows Forms application in which I have a label. This label's size is 100x100 by default*, but I want to automatically increase the label's height so that any string fits in it regardless of its "height". How would I do this? I haven't tried anything myself yet because I don't really have an idea of what to do. I'm just a beginner, after all!
Thanks in advance.
*100x100 is just an example, the real size is different (I'm not sure yet what it'll be)
Thanks everyone, I managed to get what I want by setting the label's MaximumSize property. (Answered by #LarsTech in comments)
AutoSize defaults to true - so the default behaviour of the textbox should resize to any font size/content that is in use.
The label control in Windows Forms is a container which accepts your input strings. Therefore, if you do change its initial values it will get to its content size anyways. So, just change its Text Property.
You could try it first.
here's an example code you can use. It uses the AutoSize property.
If you label is called Label1 you can change it like this:
Label1.AutoSize = true;
Label1.Text = "The text in this label is longer than the set size.";
And it will automatically change it.
I have a WPF DataGrid and the row headers don't line up vertically with the content. Any idea why?
Seems like the RowHeaders default to VerticalAlignment = Center and TextBlock defaults to Top. They are still a little off from one another but once I changed that property it was close enough for me!
Have you tried making the row height to lets say double of it's current size? It might point you that you have different alignment/padding properties set for them :) Just a suggestion tho :) And yeah, code would be helpful :)
I believe by default the row headers are aligned like that. You should be able to tell what alignment you want by saying something like:
yourDataDrid.RowHeaderStyle.BasedOn = yourDataDrid.CellStyle;
With reference to my previous question here: Changing Font Size for ListView Column in C#. I would like to know how to change the height of the column within a listView with OwnerDraw enabled.
I have succeeded in changing the font using the following code.
using (Font headerFont =
new Font("Helvetica", 10, FontStyle.Bold)) //Font size!!!!
{
e.Graphics.DrawString(e.Header.Text, headerFont,
Brushes.Black, e.Bounds, sf);
}
Although I cannot change the size of the column, giving it a cut-off effect. I have been playing around with the Rectangle.Bounds property but this appears to be read only.
Any suggestions?
Thanks
I have decided to take an alternative approach for my application. I chose to remove the header altogether and replace it with labels within a Container Panel.
This was achieved by changing the HeaderStyle property of the listView to "None". The result allowed me to dock the labels to the top of my listView, giving me the larger text I've been after!
Granted this is a little different to the question asked but provides a simple solution to what appears to be a complex problem! Additionally this would make the column headers static so may not be useful for developing applications requiring numerous changes
Thanks for all your help, and let me know if you would like more detail
Euan
You can try Better ListView Express. It allows changing column header height to arbitrary sizes. It is also free and the usage is 99% same as ListView.
What is the easiest/best way to set the maximum width of a web page. For example assume I don't want to let the user to expand the width beyond 400px. HTML code, CSS, C#?
I am using Visual Studio 2008 C# environment.
Thanks
Bruce
If you want to limit the browser width, well you can't do that :P
Alternatively, if you want to limit a certain element's width, such as a div with an ID of #container, then you would use CSS:
#container {
max-width:400px;
}
Wrap the content of the page is some sort of container (a <div>) is usually suitable. Apply the max-width property to it.
Simply make a fixed width CSS layout set at 400px.
Trying to prevent the browser window to be greater than 400px is horrible idea, and will fail in more ways than it will work (mobile, etc).