Jabberwocky
Jabberwocky

Reputation: 50768

Windows resource file (.rc) : RTEXT vs. LTEXT with WS_EX_RIGHT style

While doing localisation of dialogs in an .rc file I came upon following difference in the definition of a right aligned static control:

With both resource files the text is displayed right aligned as expected.

Is there a difference between both ways? Or is LTEXT with WS_EX_RIGHT just another way than RTEXT for displaying right aligned text?

I use the current version of Visual Studio 2022.

Actually there seems to be some redundancy. In the resource editor the Align Text property controls whether you get RTEXT, CTEXT or LTEXT and the Right Align Text property controls the presence of the WS_EX_RIGHT style.

enter image description here

Upvotes: 0

Views: 116

Answers (1)

YangXiaoPo-MSFT
YangXiaoPo-MSFT

Reputation: 2130

According to LTEXT control, CTEXT control and RTEXT control, they have SS_LEFT, SS_CENTER and SS_RIGHT respectively.

And according to WS_EX_RIGHT,

Constant/value Description
WS_EX_RIGHT 0x00001000L The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored. Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles.

Upvotes: 0

Related Questions