CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: ListViews

  1. #1
    Join Date
    Aug 1999
    Posts
    11

    ListViews

    I have a Report Style List View but i want to it look like a DBGrid with Horizontal and vertical lines.

    Can anyone help??

    Also, can you have a DBGrid which is not associated with a Data Source control
    i.e by adding column headers and information yourself!!


  2. #2
    Join Date
    Apr 1999
    Posts
    49

    Re: ListViews

    Just use the LVS_EX_GRIDLINES :

    DWORD dwExStyle= myList.GetExtendedStyle();
    myList.SetExtendedStyle(dwExStyle | LVS_EX_GRIDLINES);

    If you don't like the look of these lines, you can use the LVS_OWNERDRAWFIXED style to draw the content of your list.

    Marc


  3. #3
    Join Date
    Apr 1999
    Posts
    49

    Re: ListViews

    Wow... sorry, wasn't in the good forum

    Marc


  4. #4
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: ListViews

    If you're using VB6, then it's one of the properties (i guess it's called ShowGridlines)

    Crazy D :-)

  5. #5
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: ListViews

    If you're using VB5, you can use the following code to turn on / off grid lines :

    - Place the following into a BAS module (or into a form - just don't forget to change the 'Publics' as appropriate)



    public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval Msg as Long, byval wParam as Long, byval lParam as Long) as Long
    '
    ' ListView API Constants
    '
    public Const LVM_FIRST as Long = &H1000
    public Const LVM_SETEXTENDEDLISTVIEWSTYLE as Long = LVM_FIRST + 54
    public Const LVS_EX_GRIDLINES = &H1
    '
    ' Show Grid Lines Routine - Call with :
    '
    ' ShowGridLines ListView1.Hwnd, true
    '
    public Sub ShowGridLines(byval lLVHwnd as Long, byval bShowGridLines as Boolean)
    '
    SendMessageLong lLVHwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES, bShowGridLines
    '
    End Sub






    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

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