How to scroll a listview with scrollable property disabled
-
Hi alll, How to scroll a listview with out scroll bar. I know
ListBox1.EnsureVisible(index)
will do the job, but since i have disabled Scrollable property using
ListBox1.Scrollable = false
EnsureVisible is not doing the job. is there any other way to scroll listview with scrollable propery set to false Regards Vayanans
-
Hi alll, How to scroll a listview with out scroll bar. I know
ListBox1.EnsureVisible(index)
will do the job, but since i have disabled Scrollable property using
ListBox1.Scrollable = false
EnsureVisible is not doing the job. is there any other way to scroll listview with scrollable propery set to false Regards Vayanans
-
Hi alll, How to scroll a listview with out scroll bar. I know
ListBox1.EnsureVisible(index)
will do the job, but since i have disabled Scrollable property using
ListBox1.Scrollable = false
EnsureVisible is not doing the job. is there any other way to scroll listview with scrollable propery set to false Regards Vayanans
-
I don't think of any idea in c# windows application. But if you could explain your scenario a bit, perhaps i could be able to give you any suggestion.
Ahsan Ullah Senior Software Engineer
-
hi I dont want to use scroll bar to scroll the listview. i have two buttons for scrolling u and down is there is any way to do so...? Regards Vayanans
-
Hi alll, How to scroll a listview with out scroll bar. I know
ListBox1.EnsureVisible(index)
will do the job, but since i have disabled Scrollable property using
ListBox1.Scrollable = false
EnsureVisible is not doing the job. is there any other way to scroll listview with scrollable propery set to false Regards Vayanans
Put the list box on a panel. Make the list box tall enough to display all the items at the same time. Make you buttons move the list box up and down so what ever part of the panel you want visible can be seen in the panel. Here's a sample of what I mean using a label. Just create a new winforms app, and paste this over the form1 definition:
public partial class Form1 : Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; public Form1() { InitializeComponent(); // Create the controls. this.panel1 = new System.Windows.Forms.Panel(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); // // panel1 // this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(93, 12); this.panel1.Size = new System.Drawing.Size(60, 50); this.panel1.TabIndex = 0; // // button1 // this.button1.Location = new System.Drawing.Point(12, 12); this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "Up"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.scrollUp); // // button2 // this.button2.Location = new System.Drawing.Point(12, 41); this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 0; this.button2.Text = "Down"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.scrollDown); // // label1 // this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(60, 186); this.label1.TabIndex = 1; this.label1.Text = "This is a label with some text that goes on for ages and ages to " + "demonstrate how it is possible to manually scroll a control using a panel.";