I want set Listbox background to transparent but not working
Is there any idea?
As you've no doubt encountered it appears that you can't do this with a ListBox. One possible alternative (suggested here) is to use a list of Labels (which can be transparent) in place of a ListBox. It might not be practical for your situation but it's an option.
The exemple with label is a good idea if you don't want to use WPF. But, if you want to sort, the list a purpose to you to create a list with all the label name and create the number of label you need in a flowpanel. When you want to sort, you not sort the label, but the list, and after change the name of the label.
Ju
Best way is to use Windows presentation foundation ! (WPF)
Related
I'm creating a form that will display a long list of properties and their associated value. I'd like to display them in a sort of table-like control. Something with heading values at the top and a list of organized data underneath it. Something like these:
I realize those 2 examples aren't exactly the same but I'm flexible on what I produce as long as it gives a similar effect. My question is, how do I create a list like that? Is there a control in the Visual Studio toolbox that will produce this effect?
I'm sure there's something similar that easy to find but I can't figure out what to call that control so my searches haven't turned up anything useful.
Any help would be greatly appreciated. Thanks!
A combination of ListView and TabControl controls could be used to emulate what you're showing above. See the links for ListView and TabControl to help you get started.
Yes, there are windows form controls that provides this functionality.
For the tabbed windows use the TabControl:
For the different lists use a ListView control in the mode Details - which means a list with columns:
For the second feature, the ListView control has the Group features:
In order to group items togheter set the group for the chosen item(s):
All of this can be of course done programatically. There are good tutorials on MSDN and Channel9.
How can you make and use a list of labels in VB.NET, WinForms?
I want a 4x4 grid of labels that can be used and interacted with just like an array, e.g. Public somearray(3,3) as Integer. I want to be able to programmatically create, change the text of, and the location of these labels, without having to use repetitive code (if possible).
Also, as a by-question, is there some programmatic way of finding out how much space a label will take up, so as to centre it within a certain area?
Use a TableLayOutPanel for your grid of labels. The labels can be access directly by their name like any other control you add to your form. You can also add all the labels to an Array or List if you like and access by index.
Is it possible to have 2 areas of text in one cell such that each can have a different color? You can do this in crystal reports but I cannot see a way to do this in ReportViewer. What it is doing is essentially highlighting an important text fragment if it appears in a cell description to draw the users attention. I am fairly new to reportviewer so it for now I am assuming it's my lack of knowledge that is making this difficult. I am using VS2010.
Thanks.
Turns out VicarlnATutu wasn't quite right.
You can do this, but only if you are using VS2010 (which I am) because it includes the new SSRS rendering engine for SQL-Server 2008. This allows you to put some basic HTML into a field and have multiple formats in one cell. For more info see below:
http://msdn.microsoft.com/en-us/library/cc645967.aspx
http://msdn.microsoft.com/en-us/library/cc627491.aspx
One thing that tripped me up is what they call a 'placeholder' in the MS documentation is the little bit of text inside the textbox control that shows up by default. You can select two different things on the control in VS2010. One is the textbox itself. Right clicking on the textbox gives you 'text box properties'. The other thing you can select is the default text INSIDE the textbox. Right clicking on this 'placeholder' text gives you a different context menu where you can select 'placeholder properties'. This is where you can change the cell to accept HTML.
No, unfortunately not. I don't know if there are custom controls out there for ReportViewer, but the built-in TextBox only supports setting color (be it Foreground or Background) for the entire thing.
ah, good to know. kind of a unintuitive way to tell a TextBox to display HTML, but nice to know that you can!
How many times have we seen this type of selector:
List Box Selector http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/MoveItemsListBox.jpg
I was just about to start creating this in a WinForms app, when I thought that others may have some ideas for doing this better. We need it to sort - so the right hand list will need up/down buttons. But this seems so old school. I love devexpress components, and was thinking of asking them if they would consider adding a component that handles this functionality with a slick UI.
I am thinking that a graphical representation of the objects, and a graphical representation of the listboxes - that would be a more intuitive way to move items around.
Has anyone seen an open source project like this?
If a CheckListBox won't suffice (and it usually will), then the "modern" approach would be to use a ListView or similar component with a "Transfer" column. Render the button inline in that column, one for each row, so that it only takes one click to move an item from one to the other.
You see this everywhere in Vista, usually with hyperlinks as opposed to buttons. Instead of clicking on an item and then choosing an action, you click the action at the item level.
I wouldn't go overboard with slickness as it can impair functionality, but the dual-listbox screen is definitely old-school.
Also, if there's a very large amount of data to manage, it helps to provide a progressive search at the bottom of one or both lists.
I have done this type of selection using (essentially) a single CheckListBox that displays each item as an image. Part of the image looks like a LED, which is on (bright) if the item is selected or off (dark) if it is not selected.
This works well if you have a reasonable amount of data to select from, and also works well in a multi-column format if you can predict that the options will have reasonably similar lengths.
Allow users to drag items in/out of list 2, and also drag to reorder in list2.
(All items dragged out of list2, and dropped anywhere outside the list, get put back into list 1, in their correct place in the list by alphabetical or natural order.)
You can merge the two list boxes into one with the help of groups (LVGF_GROUPID flag): one group for selected and one for not selected.
You can also implement group membership changes with drag-drop between them. This way single drag-drop can move an item into the other group at the appropriate position, saving most/all of the other buttons.
Additionaly the bottom of each group can have one pseudo item with help text (i.e. "Drag items here to...") that is visible only when relevant.
My winforms application will display 100 different names, and I will need the user to enter a number 1 through 4 next to each name. I will then store this data.
I know I can use the spreadsheet control, but is there something much simpler that I can use?
Maybe an array of textboxes or a datagrid?
You should be able to use a datagrid and have the first column contain a textbox Item and have a second column display a name. you should also be able to use a listview the same way. Although to be honest you might want a drop down box put in the gridview instead of a text box because with a dropdown/combo box you can make sure they input only a 1-4 because that will be there only options
I would recommend using a DataGrid. This will scale much better than an array of TextBoxes, and should do exactly what you need.
Why not use a numeric up/down control (spinner)?
Something like this would work well:
http://visualbasic.about.com/od/usingvbnet/l/aa082103a.htm
You can embed this in a custom field in a datagrid or repeater if necessary.
You can also just use a combobox:
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx
Depending on what you are using this for, you might also be able to use something like this:
http://www.codeproject.com/KB/miscctrl/cs_star_rating_control.aspx
Then the user can just click the value.
With either of these options at least your user wont have to enter a value manually and you can set bounds in the control instead of having to validate their input. Your last option should be the user entering a number into a textbox really.