?
Solved

C++ MFC | Rounded Text Box

Posted on 2015-01-02
1
Medium Priority
?
439 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 2000 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Make the most of your online learning experience.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Six Sigma Control Plans
Suggested Courses

801 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