Solved

C++ MFC | Rounded Text Box

Posted on 2015-01-02
1
410 Views
Last Modified: 2015-01-15
Hi Experts,
I would like to achieve a text box (edit box) with rounded corners in MFC. Can someone please help me achieve the same using MFC? This is with VS 2010.

Thanks and regards,
Karrtik
0
Comment
Question by:Karrtik Iyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 40548513
Hi Karrtik Iyer,

sorry, I would have written earlier but I was in holiday. If this is still an issue for you maybe I can help you.

Below you can find the code for a class CRoundedEditCtrl which can be used like a CEdit. It should be enough to add these files to you projects, include the header i.e. in the header of a dialog class where you want to use them and subclass your edit controls (this is i.e. done automatically if you use ClassWizard, just replace the generated CEdit in header to CRoundedEditCtrl).

The CRoundedEditCtrl is borderless, I hope this is ok, I found drawing a border in a nice way is difficult, tests I made always looked ugly. But as a goodie there's a SetColors function to change text- and background-color.

Hope this helps,

ZOPPO
RoundedEditCtrl.cpp
RoundedEditCtrl.h
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question