Solved

C++ MFC | Rounded Text Box

Posted on 2015-01-02
1
319 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

912 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now