Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
AnswerRe: Design pattern ask for advice Pin
led mike24-Oct-08 6:32
led mike24-Oct-08 6:32 
GeneralRe: Design pattern ask for advice Pin
George_George25-Oct-08 0:34
George_George25-Oct-08 0:34 
QuestionHow to scroll a listview with scrollable property disabled Pin
vayanan24-Oct-08 0:02
vayanan24-Oct-08 0:02 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
AhsanS24-Oct-08 0:11
AhsanS24-Oct-08 0:11 
GeneralRe: How to scroll a listview with scrollable property disabled Pin
vayanan24-Oct-08 0:16
vayanan24-Oct-08 0:16 
GeneralRe: How to scroll a listview with scrollable property disabled Pin
AhsanS24-Oct-08 0:35
AhsanS24-Oct-08 0:35 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
Eddy Vluggen24-Oct-08 0:15
professionalEddy Vluggen24-Oct-08 0:15 
AnswerRe: How to scroll a listview with scrollable property disabled Pin
Simon P Stevens24-Oct-08 0:37
Simon P Stevens24-Oct-08 0:37 
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.";


        // Add the controls to the form.
        this.Controls.Add(this.button2);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.panel1);

        this.ClientSize = new System.Drawing.Size(169, 75);
    }

    private void scrollUp(object sender, EventArgs e)
    {
        label1.Top += 10;
        if (label1.Top > 0)
        {
            label1.Top = 0;
        }
    }

    private void scrollDown(object sender, EventArgs e)
    {
        label1.Top -= 10;
        if (label1.Top < panel1.Height-label1.Height)
        {
            label1.Top = panel1.Height - label1.Height;
        }
    }
}
imon
QuestionBeginReceive: How do I get out of the thread when reachig callback function? Pin
Kurt23-Oct-08 23:41
Kurt23-Oct-08 23:41 
AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Simon P Stevens24-Oct-08 0:20
Simon P Stevens24-Oct-08 0:20 
GeneralRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Kurt24-Oct-08 0:35
Kurt24-Oct-08 0:35 
GeneralRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Simon P Stevens24-Oct-08 0:42
Simon P Stevens24-Oct-08 0:42 
GeneralWhy don't we need invoke events of controls? Pin
Kurt24-Oct-08 1:41
Kurt24-Oct-08 1:41 
GeneralRe: Why don't we need invoke events of controls? Pin
Simon P Stevens24-Oct-08 1:53
Simon P Stevens24-Oct-08 1:53 
AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? Pin
Gideon Engelberth24-Oct-08 3:04
Gideon Engelberth24-Oct-08 3:04 
AnswerRe: BeginReceive: How do I get out of the thread when reachig callback function? [modified] Pin
Alan N24-Oct-08 8:13
Alan N24-Oct-08 8:13 
AnswerSolution incl. example :-) Pin
Kurt27-Oct-08 0:50
Kurt27-Oct-08 0:50 
QuestionOpen-source C# shopping cart Pin
Andrey Mazoulnitsyn23-Oct-08 22:49
Andrey Mazoulnitsyn23-Oct-08 22:49 
QuestionAccess different variable names on the fly Pin
J-Cod3r23-Oct-08 20:55
J-Cod3r23-Oct-08 20:55 
AnswerRe: Access different variable names on the fly Pin
Eduard Keilholz23-Oct-08 21:44
Eduard Keilholz23-Oct-08 21:44 
AnswerRe: Access different variable names on the fly Pin
N a v a n e e t h23-Oct-08 22:42
N a v a n e e t h23-Oct-08 22:42 
AnswerRe: Access different variable names on the fly Pin
PIEBALDconsult24-Oct-08 4:32
mvePIEBALDconsult24-Oct-08 4:32 
QuestionAuto Generate Customer ID Pin
nt_virus23-Oct-08 18:12
nt_virus23-Oct-08 18:12 
AnswerRe: Auto Generate Customer ID Pin
AhsanS23-Oct-08 20:16
AhsanS23-Oct-08 20:16 
AnswerRe: Auto Generate Customer ID Pin
N a v a n e e t h23-Oct-08 20:42
N a v a n e e t h23-Oct-08 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.