CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 1999
    Posts
    14

    How can I prevent the size of columns of my listview?

    Hello,

    Could you tell me how can I prevent the size of columns of my listview? Thanks.


  2. #2
    Join Date
    Mar 2001
    Posts
    90

    Re: How can I prevent the size of columns of my listview?


    Hi
    Are u talking about Sizing the Column or Resizing the Column.

    U can use the below given statement for

    Sizing the Column :-

    ListView1.View = LVWReport
    ListView1.ColumnHeaders.Add ,,300

    The third argument is the Column Width. U can change that accordingly to ur wish.

    Take Care Bye Bye
    Vijooo


  3. #3
    Join Date
    Nov 1999
    Posts
    14

    Re: How can I prevent the size of columns of my listview?

    Thank you for your reply.

    Actually I don't want the width of column can change. I want to lock it. Could you tell me how to do it?


  4. #4
    Join Date
    Nov 1999
    Posts
    14

    Can I lock the width of columns of a listview?

    Actually I don't want the size of columns of my listview can change. Could you tell me how can I do that?


  5. #5
    Join Date
    Mar 2001
    Posts
    90

    Re: Can I lock the width of columns of a listview?


    Hi

    If u dont want ur LVW Column to be resized, then
    i dont think that there r some solutions for ur requirements. But i suggest u a cheating way to
    overcome this problem.

    1) Place the following code in Form Load
    Private Sub Form_Load()
    ListView1.View = lvwReport
    ListView1.ColumnHeaders.Add , , "Sample", 500
    End Sub

    2) Insert a Timer Control and set the Interval to
    100.

    3) Then Place the following code in the Timer.
    Private Sub Timer1_Timer()
    ListView1.ColumnHeaders(1).Width = 500
    End Sub

    This is the first way and there is another way also. U can use an API Call for that.

    Const LVSCW_AUTOSIZE = -1
    Const LVSCW_AUTOSIZE_USEHEADER = -2


    All the Best. Reply me back

    Take Care Bye Bye
    Vijooo



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