| |

VerySource

 Forgot password?
 Register
Search
View: 1063|Reply: 3

Find the source code of the self-painting ListCtrl header (CHeaderCtrl)

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-20 21:00:02
| Show all posts |Read mode
Some people on the Internet have mentioned the self-drawing problem of CHeaderCtrl. I tried it many times according to the above, but no success. Now I need a special list header for my work, and I want to have a self-compilable source code.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-28 15:45:02
| Show all posts
I saw the C++ SDK when I was learning, it was useless to me, and I was commented out
Useful for landlord

/*//title
The
hLVHeader = FindWindowEx(hLV_Live, 0,"SysHeader32","");
    //if (hLVHeader != NULL)
//MessageBox(hWnd,"dkskfk","dkdk", MB_OK);
hHeaderDC = GetDC(hLVHeader);
//GetWindowRect(hLVHeader,&rt);
SendMessage(hLVHeader, HDM_GETITEMRECT, 1, (LPARAM)&rt);
FillRect(hHeaderDC,&rt, CreateSolidBrush(RGB(0,255,255)));
TextOut(hHeaderDC,rt.left + (rt.right-rt.left)/2 ,0 ,TEXT("Description:"),7);
The
    ReleaseDC(hWnd, hHeaderDC);*/
Reply

Use magic Report

1

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-8-9 22:00:01
| Show all posts
Reply

Use magic Report

1

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-8-9 22:15:01
| Show all posts
Customize a CMyHeaderCtrl::Public CHeaderCtrl
Overload OnPaint() in CMyHeaderCtrl to draw by yourself

Define a CMyHeaderCtrl m_HeaderCtrl;

Execute after creating CListCtrl
m_HeaderCtrl.SubclassWindow(GetHeaderCtrl()->m_hWnd);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list