Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Custom color for row selection.

Thanks. Though custom drawing is something I'd like to avoid.

Yes, you need Embarcadero C++ Builder XE6 Professional:
https://github.com/winscp/winscp#readme
Guest

Re: Custom color for row selection.

Hi Martin.

Thanks for the info. I assume you are using List view. There was a discussion on this.. code below:
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/5a622069-051a-4616-a51f-cf63a86f4c0d/selection-color-in-listview-win32api-c?forum=windowsuidevelopment

Now I'm also thinking to change the colors globally, but I need to figure it out how these theming stuff works.

Anyway have seen that WinSCP is on GitHub... do you need whole Embarcadero C++ Builder XE6 Professional to build it or would some free option of theirs do the work also?
I would be glad to write this on my own but have no wish to pay another 500eur for another IDE when I already own VS2022.

BrW

case CDDS_ITEMPREPAINT:
    if (ListView_GetItemState(hListView,lplvcd->nmcd.dwItemSpec,LVIS_FOCUSED|LVIS_SELECTED) == (LVIS_FOCUSED|LVIS_SELECTED))
    {
        RECT textRect;
        wchar_t iSubTxt1[64];
        wchar_t iSubTxt2[64];
        HFONT oldFont, newFont;
 
        ListView_GetItemRect(hListView,lplvcd->nmcd.dwItemSpec,&ItemRect,LVIR_BOUNDS);
        bgRgn = CreateRectRgnIndirect(&ItemRect);
        MyBrush = CreateSolidBrush(RGB(100,100,100));
        FillRgn(lplvcd->nmcd.hdc, bgRgn, MyBrush);
        DeleteObject(MyBrush);
 
        SetTextColor(lplvcd->nmcd.hdc, RGB(255,255,255));
 
        newFont = CreateFont(16, 0, 0, 0, FW_NORMAL, TRUE, FALSE, FALSE,
                                EASTEUROPE_CHARSET, 0, 0, CLEARTYPE_NATURAL_QUALITY,
                                DEFAULT_PITCH | FF_DONTCARE, L"Times New Roman");
        oldFont = (HFONT)SelectObject(lplvcd->nmcd.hdc,newFont);
 
        ListView_GetItemText(hListView,lplvcd->nmcd.dwItemSpec,0,iSubTxt1,64);
        SetRect(&textRect, ItemRect.left+5,ItemRect.top, ItemRect.right, ItemRect.bottom);
        DrawText(lplvcd->nmcd.hdc,iSubTxt1,-1,&textRect, DT_LEFT | DT_NOCLIP);
        ListView_GetItemText(hListView,lplvcd->nmcd.dwItemSpec,1,iSubTxt2,64);
        SetRect(&textRect, ItemRect.left+Width/3+5,ItemRect.top, ItemRect.right, ItemRect.bottom);
        DrawText(lplvcd->nmcd.hdc,iSubTxt2,-1,&textRect, DT_LEFT | DT_NOCLIP);
 
        SelectObject(lplvcd->nmcd.hdc,oldFont);
        DeleteObject(newFont);
 
        return CDRF_SKIPDEFAULT;
    }
WaldemarH

Custom color for row selection.

Hi guys.

First thank you for the awesome program.

Second can you give us the option to change the row selection color (font and background).
As if you use dark mode the selection is hardly visible on a low brightness screen.
If you look very, very closely you will see that there are two rows selected on the right screen.

Anyway it's a real pain and any help is welcomed.

Best regards
Waldemar