Reputation: 1843
I have a listbox that contains a long string.
The beginning is not all that relevant for the user which is why I'd like to make the listbox scroll automatically programatically to the right.
You can scroll to the last item vertically but I've not yet found a way to simulate the user scroll to the right.
Any ideas?
Upvotes: 3
Views: 20062
Reputation: 1
set HorizontalExtent = 0 and set HorizontalScrollbar = true.
Upvotes: 0
Reputation: 558
It's no sense and annoying as told by Sriram Sakthivel but it's not impossible
var point = Font.Size ;
string Mystr = "Gimme all your lovin', all your hugs and kisses too";
if (point * Mystr.Length > listBox1.Width)
listBox1.RightToLeft = RightToLeft.Yes;
listBox1.Items.Add(Mystr);
It will show you automatically end of the string in list box
And connect this method to click property in listbox for getting again in left
private void gotoleft(object sender, EventArgs e)
{
listbox1.RightToLeft = RightToLeft.No;
}
Upvotes: 0
Reputation: 668
Could this be what you are looking for?
It uses the HorizontalExtent property.
Upvotes: 0