Solved

C++ MFC | Rounded Text Box

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

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 …
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…

758 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