Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6828893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:26:11+00:00 2026-05-26T22:26:11+00:00

I’m currently in the second stage of development for a data management project I’m

  • 0

I’m currently in the second stage of development for a data management project I’m involved with; at the moment, we’re in the stage of revamping the GUI (we’re going for an office 2007-themed GUI).

At the moment I’ve only got experience with Dialog-based MFC projects, from which this migrates from, where we drew controls onto the dialog, then got handles to them using the GetDlgItem command, using the IDs of the controls.

Now, we’re using SDI, instead of a dialog-based project, and thus, it’s required to procedurally create the controls. I’ve had no problems creating and showing controls in the ChildView area; however, the text is very low quality and aliased. I googled the problem, but was unable to find anything particularly pertinent to the problem, indeed, the only thing which bore any real relevance was using GDI+ to draw anti-aliased text, which is fine for simple text, but I need MFC controls such as CEdit and CListBox.

Here is an image to help illustrate my problem:
enter image description here

I am creating both the static GDI+ text and the MFC control in the OnPaint function, as follows:

void CChildView::OnPaint() 
{
    CPaintDC dc(this); // device context for painting
    Gdiplus::Graphics graphics(dc);

    static Gdiplus::FontFamily* fontFamily = new Gdiplus::FontFamily( _T("Segoe UI") );
    static Gdiplus::Font* font = new Gdiplus::Font( fontFamily, 12, Gdiplus::FontStyle::FontStyleRegular, Gdiplus::Unit::UnitPixel );
    static Gdiplus::SolidBrush* solidBrush = new Gdiplus::SolidBrush( Gdiplus::Color::RoyalBlue );

    Gdiplus::PointF point( 10, 10 );
    graphics.SetTextRenderingHint( Gdiplus::TextRenderingHint::TextRenderingHintAntiAlias );
    graphics.DrawString( _T("Hello, World!"), 13, font, point, solidBrush );

    // TODO: Add your message handler code here
    CEdit* pEditBox = new CEdit();
    pEditBox->CreateEx( WS_EX_CLIENTEDGE, _T("EDIT"), _T("Why is this text so poor?"), WS_BORDER | WS_CHILD | WS_VISIBLE, CRect(100, 100, 300, 200), this, UINT_MAX-9 );


    // Do not call CWnd::OnPaint() for painting messages
}

At the moment, I am wondering if it necessary to derive each of the controls and change their rendering methods to use GDI+ antialiased text. Hopefully their is an easier way to resolve this problem.

I will be extremely grateful for any help/advice.

Thanks in advance!

EDIT: Just for reference, I used to following to resolve my problem:

    CFont* pFont = new CFont();
    pFont->CreatePointFont( 120, _T("Segoe UI") );
    CEdit* pEditBox = new CEdit();
    pEditBox->CreateEx( WS_EX_CLIENTEDGE, _T("EDIT"), _T("Test Edit"), WS_BORDER | WS_CHILD | WS_VISIBLE, CRect(100, 100, 300, 200), this, UINT_MAX-9 );
    pEditBox->SetFont( pFont );

Alternatively, the following allows for the default font for the window to be used:

CEdit* pEditBox = new CEdit();
pEditBox->CreateEx( WS_EX_CLIENTEDGE, _T("EDIT"), _T("This text is no longer poor"), WS_BORDER | WS_TABSTOP | WS_CHILD | WS_VISIBLE, CRect(100, 100, 300, 200), this, UINT_MAX-9 );

if( ::IsWindow( pEditBox->GetSafeHwnd() ) )
{
    ::SendMessage( pEditBox->GetSafeHwnd(), WM_SETFONT, (WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), FALSE );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:26:11+00:00Added an answer on May 26, 2026 at 10:26 pm

    Change the font used by the edit box, it’s just the default one that looks so ugly.

    If you want to get the “standard” font, see e.g. SystemParametersInfo with SPI_GETNONCLIENTMETRICS argument. Of course, you can use any other font if you want to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I want to construct a data frame in an Rcpp function, but when I
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.