listview umrandung



  • Hi ich hätte gerne meine listview in schöner optik.

    wie hier:

    http://www.codeproject.com/listctrl/listview.asp

    leider bekomme ich es immer nur im flat-style hin. Kann mir einer von euch helfen??

    #include <windows.h>
    #include <commctrl.h>
    #pragma comment(lib,"Comctl32.lib")
    #include <stdlib.h>
    #include <stdio.h>
    HINSTANCE Inst;
    int i = 50; 
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 
    HWND hwnd, hText, hwndEditAlt, g_hText, hListView; 
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, 
                       PSTR szCmdLine, int iCmdShow) 
    { 
    Inst = hInstance;
    
        static TCHAR szAppName[] = TEXT("Progress Bar"); 
        MSG msg; 
    
    	WNDCLASSEX wndclass;
    	HWND hWnd = NULL;
    	memset(&wndclass,'\0',sizeof(WNDCLASSEX));
    	wndclass.lpfnWndProc = (WNDPROC)WndProc;
    	wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    	wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
    	wndclass.hIcon = LoadIcon(NULL,IDI_WINLOGO);
    	wndclass.hInstance = hInstance;
    	wndclass.lpszClassName = szAppName;
    	wndclass.style = CS_VREDRAW | CS_HREDRAW;
    	wndclass.cbSize = sizeof(WNDCLASSEX);
    
    RegisterClassEx(&wndclass);
    
        hwnd = CreateWindowEx(NULL,szAppName,TEXT("LeWi-"),WS_OVERLAPPEDWINDOW,
    							   CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
    							   NULL,NULL,hInstance,NULL);
    
        ShowWindow(hwnd, iCmdShow); 
        UpdateWindow(hwnd); 
    
        while(GetMessage(&msg, NULL, 0, 0)) 
        { 
        TranslateMessage(&msg); 
        DispatchMessage(&msg); 
        } 
    
        return msg.lParam; 
    } 
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    { 
    	LVCOLUMN lvColumn;
    	INITCOMMONCONTROLSEX icc;
    
        switch (message) 
        { 
        case WM_CREATE: 
    
       icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
    		icc.dwICC = ICC_LISTVIEW_CLASSES|ICC_WIN95_CLASSES;
    		if (!InitCommonControlsEx(&icc)) 
    			MessageBox(NULL,"Nie uda³o siê wywo³anie InitCommonControlsEx","Error",MB_OK);
    
    hListView = CreateWindowEx(NULL,WC_LISTVIEW,"ListView",LVS_AUTOARRANGE|LVS_REPORT|WS_CHILD|WS_VISIBLE,
    								   0,0,300,300,
    								   hwnd,0,Inst,NULL);
    lvColumn.mask = LVCF_TEXT|LVCF_WIDTH;
    		lvColumn.cx = 150;
    		lvColumn.pszText = "Elementy";
    		lvColumn.cchTextMax = strlen("Elementy");
    		ListView_InsertColumn(hListView,0,&lvColumn);
    ListView_SetExtendedListViewStyle(hListView,LVS_EX_UNDERLINEHOT|LVS_EX_ONECLICKACTIVATE|LVS_EX_TRACKSELECT);
        return 0; 
    
        case WM_DESTROY: 
            PostQuitMessage (0); 
        return 0; 
        } 
    
    return DefWindowProc (hwnd, message, wParam, lParam); 
    }
    


  • der Link ist fuer pur WinApi warum verwendest du nicht das bsp. dessen link du angegeben hast da ist auch beschrieben wie es funktioniert


  • Mod

    Möchtest Du nur den Rahmen ändern? WS_EX_CLIENTEDGE


Anmelden zum Antworten