As a warmup for a more complex project in C#, I have started to code a C++/CLI library to allow simple access of C# applications to features of DirectWrite. (I am aware that there are such helper libraries already out there but I was not able yet to get them to work with in Visual Studio 2015 and with Windows 10.)
So far so good. A first test run showed the text in the target window but not as I would have expected for ClearType display. A screenshot of the displayed text can be found here.
My understanding of the relating MSDN documentation is that ClearType is enabled by default. The title bar text of the window is obviously set up with text in ClearType. I guess I missed a setting in the DWrite factory but I do not know which.
Thank you for your response. You had indeed a good idea but I am afraid that this is not likely the reason:
You can see from the screenshot, the character 'g' is shown completely where other characters like the adjacent are not shown completely.
The text has been sent to DX as one single block, without the explicit specification of leading. I would assume then that DX selects a sufficient leading.
Meanwhile, I have made several more tests with my application but I have not found a way yet to improve the text display. However, I do not give up. ClearType works well on my computer; any application - except mine - is using it successfully.
I have collected my little test in a ZIP file which can be loaded from this location. I am currently using Windows 10 and Visual Studio Community 2015.
I had downloaded that example yesterday - It's really HUGE! And - unfortunately - it fails to build. I am receiving error message "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2048,5): error MSB3774: Could not find SDK "Microsoft.VCLibs, Version=14.0".".
There are several comments about this issue in the net but only very few solution proposals. I tried one and ran the repair of my Visual Studio but the building problem remained.
I will now start to work myself through the code and try to find answers to my specific problem. That will take a while since I do not know if the problem is caused by any System or VS settings or just by my code.
Some of the members here are quite selective about which forums they visit, and it's quite possible that the people who would maybe know the answer never come here. Your problem has nothing to do with C++/CLI but is about DirectX, so a question in the Graphics forum may catch someone's eye. You could also try a search of the Articles section to see if anyone has written about it.
I built your project and played with it a bit but was not able to eliminate the issue. I consulted some of our DX code and things are very similar. We do create a DC render target instead of an HWND render target and set the flags to be GDI compatible but everything else looks similar. Our content is hosted within a WPF window so that's another difference.
Is this a high-DPI issue by chance? I run at 125% and didn't try your app at 100% (96 dpi). Perhaps some sizes need to be scaled differently.
I see that things stretch as the window is resized. So perhaps the drawing is extra compressed which causes the bitmap to be resampled?
Sorry I'm not much more help. I certainly feel your pain though.
I have now tested with several different font sizes. Looks ok at 36pt. Real bad result at 12pt: Even the two lines of text (rendered as one single text block) seem to have different sizes, see screenshot. This is definitively not ClearType.
I guess now I missed somewhere to enable ClearType and will give a close look to the sample Richard MacCutchan indicated to me.
Stretching of the text block upon resizing of the window is an undesired effect caused by the very simple design of the test, should be done better in a 'real' application.
I am getting flicker while painting a border on control, bannerbar(its derived from CWnd only). So the case if control is getting focus , border should get paint otherwise not.
I am handling OnsetFocus and OnKillfocus and calling Paintborder() in which I checked if banner got focus(by checking m_BannerHasFocus flag) i will call parent->InavlidateRect() here i passed banner rect as argument.
In Onpaint I am taking PS_DOT pen (if its have focus) and PS_NULL if don' have focus.
I am getting flicker while its getting/loosing focus Even i pass FALSE parameter in InvalidateRect, which will not erase background.
Please help me out. I pasted source code here. Thanks
void CBannerBar::OnSetFocus(CWnd* pOldWnd)
// TODO: Add your message handler code here
m_BannerHasFocus = true;
// TODO: Add your message handler code here
m_BannerHasFocus = false;
//Invalidate the control in order to hide the focus rectangle.
CWnd* pParent = GetParent();
if (!rect.IsRectEmpty() && pParent != NULL)
CPaintDC dc(this); // device context for painting
// create a brush of the background color and paint the window with it
CBrush brush (BACK_COLOR);
CDC* pDC = GetWindowDC();
COLORREF dColour = GetSysColor(COLOR_HIGHLIGHT);
dColour = RGB(255, 0, 0);
CPen pen(m_BannerHasFocus ? PS_DOT : PS_NULL, 1, dColour);
CPen* penOld = (CPen*)pDC->SelectObject(&pen);
pDC->LineTo(rect.right - 1, rect.top);
pDC->LineTo(rect.right - 1, rect.bottom - 1);
pDC->LineTo(rect.left, rect.bottom - 1);
// Do not call CBaseWnd::OnPaint() for painting messages
Good news for us C++/CLI devs! (a small but proud group)
A comment by Adam Welch [MSFT] in the vcblog post titled: Debug Visualizers in Visual C++ 2015[^] states that Microsoft is working on updating the Mixed Mode debugger to support debug visualizers. This is something I've personally requested for YEARS.
So I'm very happy to see that news and thought I'd pass it along here.
Solve this. I have a malware spyware on this computer right now and a Samsung dealer with remote support put it here. It is in internet explorer my curser, files, net mass downloading,making other profiles and making your screen look normal. I found it in internet explorer's setting and right clicked and got some words that didn't make sense I followed it to a site that was and is still hooked to this computer probably watching me write this comment. I am not important, why do they want to spy on me? I watched it and got into their files where they write C++ code into everything. I had the internet off. My android phone off. When I turned my phone on it popped up a big red warning so I turned it off really fast, then waited 10 min turned it on and hit lookout really quick and blocked everything. Well I finally turned my phone back on and it is in there. I think it is a window's product because admittedly my windows is not genuine .They keep file logs of everything. They watch and listen to you. They have a bunch of squares they called emulation. they have a console veiw where they put enabled words into the code. They have a search and a Rendering box at the bottom At the top it says Elements,Network,Sources,Timeline and Profiles. I was so busy trying to get my profile back away from them I was actually reading the script that popped up when I clicked help telling me how to hack someones computer using C++ and code words. They have call stacks,DOM breakpoints,XHR breakpoints,Event listener breakpoints,It tells you how to go to the computers profile page and make names similar so the user won't know and take system control and ownership and permissions away. When the caught me I kept opening more windows and pushing buttons and deleting stuff etc. But they shut me down and I turned my computer back to an earlier time and they are still here. They caught me watching them I was trying to delete the extra accounts they made and they shut me down. but it had all the products they use to infect you could click on the one you needed and It had windows xp, vista, 7, 10 Linux, x box 360, x box one, Firefox opera, that new quota is them too.Android, The name of the company had a help website for big businesses. I wish I could have gotten the name it started with a bunch of xx's I have an old windows xp notebook I let my Grandson play on and I fiddled with it this morning until it became diseased I found the port and I am actually watching it now but it is way less suffocated than the one on my Window's 7 and android phone. Lookout did not log it and I have not asked for my stuff back yet but I know it is on my phone even with it being blocked every way possible. Any ideas on how to get this off? I tried to post this to comments in CW but it would not let me. I am really not a paranoid nut. I guess gmail is safe for now.
I am a 60 year old woman with no computer skills. I put it under this heading because it was using C++ to hack peoples computers. I was typing fast so I could list everything I was seeing before they found out and blocked it again. I looked up white space so I guess that was an insult on my post being not grammatically correct.Instead of being a jerk you could have used your"jerk space" to tell me where I should have posted it.