Click here to Skip to main content
15,885,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1. I was made List box in form
2. but I wanna enlarge width of Scroll Bar. So, Customize a new Scroll Bar using VScroll bar in 'Tool Box'
3. but I don't know Combine VScroll Bar with List box and How do I scroll down List box I was made...
4. I think.. Using Event " .Scroll += new System.Windows.Forms.ScrollEventHandler" but I don't know how to specific method...

C#
private void frmSettingConfig_Load(object sender, EventArgs e)
{
    this.LoadSettingConfig();
    this.EnableVScrollBar();
}

private void LoadSettingConfig()
{
    try
    {
        LogWrite.Log.InformationWrite("Load Setting Config.");
        string filepath = Application.StartupPath;

        if (Directory.Exists(filepath) == true)
        {
            DirectoryInfo di = new DirectoryInfo(filepath);

            foreach (FileInfo item in di.GetFiles())
            {
                if (item.Name.Contains("SettingConfig"))
                {
                    mSettingConfigList.Add(item.Name);
                }
            }
        }
        else
        {
            MessageBox.Show("Does not Exist Setting Config File in Directory
            !");
        }
        this.ShowSettingConfig();
    }
    catch (Exception ex)
    {
        MessageBox.Show("Load Setting Config Error !");
        LogWrite.Log.InformationWrite("Load Setting Config Error" +
        ex.ToString());
    }

}

private void EnableVScrollBar()
{
    VScrollBar vScroller = new VScrollBar();

    this.lbxSettingConfigList.Controls.Add(vScroller);
    vScroller.Height = lbxSettingConfigList.Height;
    vScroller.Width = 30;
    vScroller.Dock = DockStyle.Right;

    vScroller.Scroll += new
    System.Windows.Forms.ScrollEventHandler(vScoller_Scroll);
}

private void vScoller_Scroll(object sender, ScrollEventArgs e)
{
    // How do I ? in this block.
}


What I have tried:

eeeeeeeeeeeeeeeeeeeeeeeeeeeeevrything..
Posted
Updated 9-Dec-18 19:19pm

1 solution

Hi, please try changing the scroll viewer in the control template of Listbox.
please check this Link. In the question itself user has tried implementing that.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900