I have created an array of ListBox in which I have populated with some data from a text file. I want to change between each Listbox when the user scrolls either left or right so each one can be displayed. How would I go about doing this? I have populated my user interface with the first List-box Listbox(0).
I don't fully understand your question, but if you are trying to put the scrollbar to the left side of the listbox, you can set the RightToLeft property to true.
If you want to move from one ListBox to another the better control to use is a Slider then a ScrollBar
Related
To be clear I'm talking about Grid - not GridView or DataGrid or anything like that.
All I found online was about GridView and such.
I want to be able to select items with a mouse click or drag from a Grid.
What I have is a table filled with text implemented through a Grid. I want to be able to select "cells" in the Grid.
The reason I don't use DataGrid is because I couldn't find a way to set a cell's span.
Thank you,
Dolev.
I had nearly the same approach some month ago: Dynamic ui with rows and columns
Maybe this will help you.
In the end I used Selector.IsSelected attached property.
Selector Class
I modified the MouseDown, MouseUp, MouseMove event to record a rectangle created when dragging the mouse while the left button is held. Then I checked which cells are within that rectangle.
As a double check to see that the cell is really selected I used Selector.SetIsSelected and Selector.GetIsSelected.
I added a listbox control to log entries but I want the entries to have a date in the right side. Apparently, I'm able to only align it one side and not able to have this text on both the side. I was wondering if it is possible. Here's a photoshopped image to describe what I need. The right side date doesn't actually turn up. I added that through photoshop but its exactly what I need.
I would like to suggest you to use ListView instead of Listbox. You can show your list with multiple columns in detail view. You can also align column value, Hide header using HeaderStyle property.
If you don't want to use ListView control and want to use ListBox. then you have three options to do that.
You can draw item using OwnerDraw method.
You can add label to the ListBox. but, it creates lot of problems when you are trying to scroll items.
Set the listbox font Courier New and use String.PadRight or String.PadLeft to place space between two item. But, in this method the item will be return with space. Here you need to process to separate that field.
So I have a vanilla DataGridView in a WinForms solution.
As you tab through the cells in the DataGrid eventually you reach a point where the selected cell is only half in view. In order to view it you must scroll over.
Well this is obviously something that I want to handle automatically so the question is....
How do I enable my DataGridView to scroll automatically as the user tabs.
I searched for a scroll bar index value or position value but couldn't seem to find anything.
DataGrid
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx
I think you are looking for something like FirstDisplayedCell to control your scroll.
dataGridView1.FirstDisplayedCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.firstdisplayedscrollingrowindex.aspx
In my C# .Net program, a list of items is presented on the left and a PropertyGrid is displayed on the right with information on the item selected. When I move the scrollbar for the PropertyGrid then select another item from the list, the scrollbar stays where it was previously. I want to be able to reset the scrollbar to the top every time a new item is selected.
I've been able to see where the .value of the scrollbar is stored, but I can't access it (System.Windows.Forms.PropertyGridInternal.PropertyGridView.ScrollBar). Is there any way I can get access to these values to change them?
This was the only thing I found in other questions, but I'm not sure how I could adapt this solution to my problem:
How can I catch scroll events in windows forms PropertyGrid
EDIT: The question I linked to is how I eventually solved the problem. I used Reflection to get the internal scrollBar control and SetScrollOffset method, then used those to set the scrollbar value to 0 when the item on the left was changed.
You could set the SelectedObject of the PropertyGrid to null before setting it to the new value.
UI is created in VS 2008. I'm using C# .... I need to let the user move/focus between text fields from top to bottom by clicking tab button. How can i do it?
On the Layout toolbar (will normally show up if you're in Design View) click on the buttom on the most right (it's called tab order).
Now on every element on your designer will come up a little box with a number. Just click all your elements in the order you like and they will automatically be re-ordered.
If you like to do it manually, just take ho1 advice and change the property manually.
You just set up the TabIndex property properly, so that it's sequential from top to bottom. Then it'll work automatically and you won't need any code to move around the focus.
So in other words, set the top TextBox TabIndex to 1, the next one you set to 2 etc and then one at the bottom will have the highest number (of the textboxes, you probably want to have even higher indexes for any OK buttons and similar so that the user can jump to them after editing all the textboxes).
You can find more info about it here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx