It's ok if using TextOut instead of DrawText.
Hi David, I tried with "\x63", "\x64". "\x72", but it's not work, may be OS problem. My OS is win11 insider version.
From 9.4, DrawCloseButton is changed to use Marlett font to draw "x" and button hover state using "c", "d", "r" character, but in my Win11 laptop, it is not displayed correctly, but using glyph code "\uF063" . "\uF064" and "\uF072" can display in expectation.
I'm working on a file browser, I want to draw folder without icon, and draw file with icon in tree view.
Use inherit way is ok for my scenario, only need to override OnLButtonDown.
Hi David, Thanks for your advices. For this way, overrid OnLButtonDown is simply and ok, but for OnTBNHotItemChange has some complexity, I need to avoid send UWM_POPUPMENU message for menu without menuitems.
Better way is only change in OnTBNHotItemChange handler and OnLButtonDown handler: 1. in OnTBNHotItemChange, change //Always use PostMessage for USER_POPUPMENU (not SendMessage). PostMessage(UWM_POPUPMENU, 0, 0); to //Always use PostMessage for USER_POPUPMENU (not SendMessage). if (::GetSubMenu(m_topMenu, m_hotItem)) PostMessage(UWM_POPUPMENU, 0, 0); 2. in OnLButton, add code before "return 0": if(GetSubMenu(m_topMenu, m_hotItem) == NULL) GetParent().SendMessageW(WM_COMMAND, GetMenuItemID(m_topMenu,...
And need to change code in OnTBNHotItemChange to send UWM_POPUPMENU message only is POPUP like this : if(::GetSubMenu(m_topMenu, m_hotItem)) //Always use PostMessage for USER_POPUPMENU (not SendMessage). PostMessage(UWM_POPUPMENU, 0, 0);
David, I found a way to get WM_COMMAND message: change show popup code in OnPopupMenu() of CMenuBar as below: UINT id = 0; if (m_popupMenu) { int xPos = isRightToLeft ? rc.right : rc.left; id = static_cast<UINT>(::TrackPopupMenuEx(m_popupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, xPos, rc.bottom, *this, &tpm)); }else GetParent().SendMessageW(WM_COMMAND, GetMenuItemID(m_topMenu, m_hotItem), 0); when menu's property POPUP is FALSE, this menu will be menu item of menubar and m_popupMenu is...
Hi David, Pls see picture. In picture, I add a menu (ABC) into menubar, and no any menu item, and I set POPUP property as FALSE in resource editor. I want to handle clicked event to do my work, I tried to override OnCommand to handle, but no WM_COMMAND sent. I used win32++ version is 9.40.
For example: 1. Create a menu in resource file, and with two menu: "Menu A" and "Menu B". 2. All menu have no menu item, and POPUP is false 3. I want to handle click on "Menu A" or "Menu B". I have a try in OnCommand, but I cann't get message.
Thank David. I have tried this, but IFileDialog is followed OS system setting. I cann't change it in app, maybe I need to change my design to let my app follow system setting only.
I want to show CFolderDialog to select a folder, and show dialog in light mode or dark mode base on settings. But I can not show it in dark mode even I trying to customize it using technology in CDarkAboutDialog of DarkModeFrame sample.
In dark mode sample, main menu is owner drawed, but border is white color and is not consistent with system dark menu. Can I changed this? If anwser is YES, I suggest add border color and separator color into menu theme.
Thanks David, I got my want base on your advices.
Hi David, I following your advices to modify TitlebarFrame sample as below: 1. modify CMenuBar m_menubar2 to CToolBar m_menubar2; 2. Comment m_menubar2.SetupMenuBar(GetFrameMenu()); in OnCreate to compile successfully 3. Run sample is successful, but min/max/close/window button is not visible.
Hi David, In TitlebarFrame sample, when select mini-frame mode, menubar can be placed in titlebar. I want to placed toolbar (system default) instead of menubar in titlebar. How should I do? Thanks.
Got it. Thanks!
I like mini mode/full mode for main frame like TitlebarFrame sample, and I like dark/light mode switching like darkmode sample. I want to leverage dark mode support for mini/full mode. How can I?
I like mini mode/full mode for main frame like TitlebarFrame sample, and I like dark/light mode switching like darkmode sample. I want to leverage dark mode support for mini/full mode. How can I?
I like mini mode/full mode for main frame like TitlebarFrame sample, and I like dark/light mode switching like darkmode sample. I want to leverage dark mode support for mini/full mode. How can I?
I'm trying TextFileReader sample to learn how to use CScrollView and I have a question about my needs: I want to scroll content from second line, that's mean first line will be sticked there. Welcome any advices if you have experience on this. Thanks.
Add below statement in OnNCHitTest method (after 451 line): if (m_hoveredButton == TitlebarButton::Maximize) return HTMAXBUTTON;
Add below statement after line 451 (in OnNCHitTest method): if (m_hoveredButton == TitlebarButton::Maximize) return HTMAXBUTTON;
Add below statement after line 451 : if (m_hoveredButton == TitlebarButton::Maximize) return HTMAXBUTTON;
In my test app, GetWindow(GW_OWNER) return main frame as owner window, it's not MyView.
Hi David, Thanks for your comment. In my scenario, GetWindow(GW_OWNER) can not retrieve owner window, so I have to pass MyView window pointer to popup.
Hi, I setup a window with cs.style = WS_POPUP in PreCreate method, and in another window (for example MyView) create it using Create(this) method. For example. mypopup = Create(this). And this pointer is pointer of MyView. Then I show this popup window and process mouse event. I want to send message to parent window, so I think I can use GetParent() to get it. But , returned parent window is not MyView. Why?
Hi David, Thanks lot. It's work perfectly now.
Hi David, Thanks. I'm finding solution about how to autohide popup window when mouse click outside popup window. Would you give me some advices? This is major problem when I create a popup window (using WS_POPUP).
Hi David, Bar control has been ok for me, now I need a popup window to show file tree. Did you mean popup menu can be used to display (or emulate) a file tree? If yes, would you give me some advices or sample? Thanks.
Hi David, Sorry I don't clearly describe my needs before. I'm creating a custom control : BreadCrumbBar. This control is similar as vs code source editor's bar (between tab bar and editor). The control display current file's full path, when mouse hover any part of path, the text of path is high light. When mouse down, a popup window (hold a file tree view) will display (overlap edit area), and this window should be hide when clicked mouse button in outside window. Below is screenshot of vs code:...
My expectation: 1. Show at any location like popup menu. 2. No title bar. 3. Auto hide when mouse leave popup window.
My expectation: 1. Show at any location like popup menu. 2. No title bar. 3. Auto hide when mouse leave popup window.
My expectation: 1. Show at any location like popup menu. 2. No title bar. 3. Auto hide when mouse leave popup window.
I can create popup menu and show menu at any location. Now, I want to show a popup window and show this window at any location and I don't want use Dialog. Who can give me some advices and sample code? Thanks.
System menu width is not correct when first click on window icon. My os is win11, build sample by vs2019 , vs2022.
Thanks for David's samples. How can I set text color (and MenuTheme) for menubar item in Titlebar sample? I can do this in TitlebarFrame demo, but SetMenuTheme and CustomDrawMenuBar only work on CFrame.
David, I meet a new problem when using CListView. Would you give me some advices? I create a CListView with LVS_LIST style, and call SetColumnWidth to change item width, but width is not changed.
David, Thanks lots. Plan C is best for me, and all are perfect.
David, Thanks. I adopt drawing all and return CDRF_SKIPDEFAULT. It's work, but have one issue: 1. Only header's item background can be draw, can not draw full header background, so other space (excerpt header item) should remain white background. How to paint full width background of header? Would you give me some advise?
Hi, David I'm trying this approach, BUT, it's only work with text color, background CAN NOT to be changed. I don't know why and how. Below is my sample code: LRESULT CView::OnNotify(WPARAM, LPARAM lparam) { LPNMCUSTOMDRAW lplvcd = (LPNMCUSTOMDRAW)lparam; switch (lplvcd->hdr.code) { case NM_CUSTOMDRAW: { switch (lplvcd->dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: { ::SetTextColor(lplvcd->hdc, RGB(255, 0, 0)); ::SetBkColor(lplvcd->hdc, RGB(0, 0, 0)); ::FillRect(lplvcd->hdc,...
Hi, I can change CListView's background, text and text background color, but I cann't find way to change column's header color. How to change them? Thanks.
Hi, David Thanks for your advise.
If I replaced wxx_gdi.h file using v8.9.1 in v8.9, sub menu arrow will not exclude from dc. It's ok when I switch back to v8.9.0.
Tested with v8.9.0, it is ok. Maybe bug of v8.9.1.
Tested with v8.9.0, it is ok. It seem v8.9.1 bug.
Same source, compiled by v880, owner draw menu is correct. But is not correct when compiled by v891. Is it bug of v891 ? Pls see screenshot.png in attachment, Print menu has sub menu. I can exclude submenu arrow in v880, but i cann't in v891. You can try my demo with v880/v891 at vs 2019 community edition.
Hi, David I'm trying to custom draw title with extend client rect to include original title bar. But menubar always position on client-rect's topleft. I want to set menubar's top is on anywhere. Is it possible? Thanks.
https://github.com/grassator/win32-window-custom-titlebar
You can refer this to customize Title Bar, but you need more work to modify CFrame class to re-position menubar, toolbar. I have a successful trying without menubar and toolbar. It's very good if David enhance theme support using this approach.
Add Command Palette support
Solved.
I try to owner draw radio button appearance. But I cann't get it. I tested in DialogResizing demo: 1. Modify mydialog:: OnInitDialog to add m_radioA.SetButtonStyle(BS_AUTORADIOBUTTON | BS_OWNERDRAW, TRUE); 2. Override OnMessageReflect to handle DrawItem message case WM_DRAWITEM: { LPDRAWITEMSTRUCT pDIS = (LPDRAWITEMSTRUCT)lparam; CRect rc = pDIS->rcItem; CDC dc = pDIS->hDC; dc.SolidFill(RGB(32, 32, 32), rc); } return TRUE; But, the drawitem is not called, and radiobutton no any visual appearance,...
Hi David, Thanks for your comment. I have try this article's demo before, but have some bugs are not fixed and no maintance. From my view, win32++ is a high quality framework and actively maintain by you. I trust win32++, so I hope win32++ can provide some modern and high quality addon out of standard win32 control.
Currently, win 10 have dark mode support, but native win32 app can not support it. Even we can use win32++ theme, but windows title bar can not colorize correct. It's better if win32++ can provide a frame window with color customization like c# UWP: var titleBar = ApplicationView.GetForCurrentView().TitleBar; // Set active window colors titleBar.ForegroundColor = Windows.UI.Colors.White; titleBar.BackgroundColor = Windows.UI.Colors.Green; titleBar.ButtonForegroundColor = Windows.UI.Colors.White;...
Or vs-code-like command palette is enough. But I want auto close when lost focus.
I want to build a menu like below image. Would you get some advices from you? Thanks!