CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2008
    Posts
    16

    Progressbar inside of listview?

    Is there any way to get like a listview of controls? I need something that looks like a listview that can hold an image, text, and a progressbar.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Progressbar inside of listview?

    If you want a ProgressBar inside one of your LV Columns, you could do something like this :
    Code:
    public System.Windows.Forms.ProgressBar LvAddProgB(ref System.Windows.Forms.ListView LV, int LVII, int LVColI) 
    { 
        Rectangle SizeR = default(Rectangle); 
        //Size of LV Items 
        System.Windows.Forms.ProgressBar ProgBar = new System.Windows.Forms.ProgressBar(); 
        //New Prog Bar 
        
        SizeR = LV.Items(LVII).Bounds(); 
        //Get Size 
        SizeR.Width = LV.Columns(LVColI).Width; 
        //Get Width 
        //If No Cols 
        if (LVColI > 0) { 
            SizeR.X = SizeR.X + LV.Columns(LVColI - 1).Width; 
            // 
        } 
        ProgBar.Parent = LV; 
        //Put Prog bar In LV 
        ProgBar.SetBounds(SizeR.X, SizeR.Y, SizeR.Width, SizeR.Height); 
        //Specify Locations etc. 
        ProgBar.Visible = true; 
        //Show PB 
        
        return ProgBar; 
    }
    Usage :

    Code:
        LvAddProgB(ListView1, 1, 0); 
        //Usage Anywhere in an event
    Add a couple of LV Items, and Columns, and experiment with this code.

    I sincerely hope my info was useful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured