News | Articles | Libraries | Developer Tools | Books | Forum Links | Search   
Sections:
 

QA: How can I create controls with multiline text?

By Vassili Philippov, September 14, 2001.
Print version

Question

I want to create an edit control with multiline text (or label control, or button control, etc). What should I do for that?

Answer

You should set Multiline flag in style and text in control should contain 'new line' symbols. For different controls you should use either \n or \r\n to divide lines. For button and edit controls use \r\n for all other control types use \n.

Multiline style

Use dialog editor to set multiline style for your controls.
Set multiline style in dialog editor

Multiline text

Here is a sample code that sets multiline text to different controls.

m_edit.SetWindowText(_T("Line one\r\nLine two")); m_label.SetWindowText(_T("Line one\nLine two")); m_check.SetWindowText(_T("Line one\nLine two")); m_radio.SetWindowText(_T("Line one\nLine two")); m_button.SetWindowText(_T("Line one\r\nLine two"));

Sample project

You could download sample project (48 Kb) that shows working with multiline text in different controls.

Discuss

Discuss this article. Here you can write your comments and read comments of other developers.
Rate this article:     Poor Excellent    
 12345 
© 2001-2005 Pocket PC Developer Network, a division of Spb Software House