473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

StringFormatFlags.DirectionRightToLeft

Hello all,

I've found several posts that indicate the DirectionRightToLeft flag is
intended for right to left alphabets and shouldn't be used for
justification, but in my testing I've found that it does a better job of
right justifying text than the alternative. In the function below I draw
some text in four possible combinations of StringAlignment (Near and Far)
and Direction (RightToLeft and nothing, which is LeftToRight). What I've
found is that DirectionRightoleft and Far gives the same result (left
alignment) as lefttoright and Near. But DirectionRighttoLeft and Near does
a better job of right alignment than Lefttoright and Far.

Can anyone explain to me what the difference between these settings is and
why I shouldn't use RightToLeft for right justification?

thanks

Marc Pelletier
public void TestLabel( int x, int y, string value )
{
Pen redPen = new Pen( new SolidBrush( Color.Red ) );
redPen.Width = 1.0F;
SolidBrush blackBrush = new SolidBrush( Color.Black );
Font labelFont = new Font("Arial", 10);
StringFormat labelFormat = new StringFormat(
StringFormatFlags.DirectionRightToLeft );
labelFormat.Alignment = StringAlignment.Near;
g.DrawString(value, labelFont, blackBrush, new Point( x, y ),labelFormat
);
g.DrawLine( redPen, x, y, x, y+1 );
labelFormat.Alignment = StringAlignment.Far;
g.DrawString(value, labelFont, blackBrush, new Point( x, y+10
),labelFormat );
g.DrawLine( redPen, x, y+10, x, y+11 );
labelFormat = new StringFormat( );
labelFormat.Alignment = StringAlignment.Near;
g.DrawString(value, labelFont, blackBrush, new Point( x+100, y
),labelFormat );
g.DrawLine( redPen, x+100, y, x+100, y+1 );
labelFormat.Alignment = StringAlignment.Far;
g.DrawString(value, labelFont, blackBrush, new Point( x+100, y+10
),labelFormat );
g.DrawLine( redPen, x+100, y+10, x+100, y+11 );
}
Nov 16 '05 #1
1 5642
Marc Pelletier <no******@please.com> wrote in
news:Xn*********************@207.46.248.16:
Can anyone explain to me what the difference between these settings is
and why I shouldn't use RightToLeft for right justification?


Well, I guess I can now. I'm sure there are other side effects, but when
using RightToLeft to display a negative number the negative sign is
displayed on the right side of the text. So -1.2 would be written as 1.2-,
which doesn't do it for me.

cheers

Marc Pelletier
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
5
by: Maulin Vasavada | last post by:
Hi all, I am having difficulties in understanding DataGrid,DataSet,DataTable etc classes that work to have DataGrid work. I am looking for UML diagram that depicts relations between those...
0
by: John Richardson | last post by:
I have a DataGridLabelColumn I've made by overriding a DataGridColumnStyle object. (based on an MSDN article by Chris Sano). In the Paint method, I use a StringFormat object, and pass that to a...
2
by: pmcguire | last post by:
I have derived a ComboBoxColumnStyle that inherits DataGridColumnStyle. It works fine except for one behavior. If the user selects a new value from the ComboBox's pulldown list on a brand new...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
3
by: Mad Scientist Jr | last post by:
Can someone post a clear example of how to change the background color of an individual datagrid cell for a Windows desktop app? (preferably in vb.net) I found some code on how to do this when...
12
by: Aaron Smith | last post by:
Cor, I found a previous message from you on the newsgroups with code for a DataGridComboColumnStyle.. This one seems to work a lot better than the one that I wrote, however I'm having a couple...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
0
by: Fabio | last post by:
Hi all! I need to implement the RightToLeft feature in a Graphics.DrawString(). I set the StringFormatFlags.DirectionRightToLeft to the StringFormat but... I don't see any difference between the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.