Creating a table using Win32 API

前端 未结 3 2063
抹茶落季
抹茶落季 2021-02-01 09:57

I\'ve been searching the net for different things about the win32 API, but it seems all information on it is rather sparse.

I am looking to create a simple window that s

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 10:32

    Using the windows API and the standard control ListView you can do a table using the style LVS_REPORT

    documentation link - unfortunatelly with no code :( -

    About List-View Controls

    I've found this good article Windows Programmierung: List View the explanation is in german language but a google translation together with the code should be enough to understand it. From the article, to create the window:

    #include "commctrl.h"
    
    InitCommonControls();
    hwndList = CreateWindow(WC_LISTVIEW, "", 
             WS_VISIBLE|WS_BORDER|WS_CHILD | LVS_REPORT | LVS_EDITLABELS, 
             10, 10, 300, 100, 
             hWnd, (HMENU)ID_LIST, hInst, 0);
    

    then it is explained how to create the columns in the method

    int CreateColumn(HWND hwndLV, int iCol, char *Text, int iWidth)
    

    how to insert an item (one column)

    int CreateItem(HWND hwndList, char *Text)
    

    or insert item with two columns

    int Create2ColItem(HWND hwndList, char *Text1, char *Text2)
    

    etc...

提交回复
热议问题