How many alignments do we need? 
Author Message
 How many alignments do we need?

I wanted to have an alignment property for some of my objects and found
the following:

System.Web.UI.WebControls.HorizontalAlign {Center, Justify, Left, NotSet,
Right}

System.Windows.Forms.HorizontalAlignment {Center, Left, Right}

System.Drawing.ContentAlignment {Bottom{Center, Left, Right}, Middle
{C,L,R}, Top{C,L,R}}

System.Drawing.StringAlignment {Center, Far, Near}

System.Web.UI,WebControls.VerticalAlign {Bottom, Middle, NotSet, Top}

CrystalDeciions.Shared.Alignment {Decimal, DefaultAlign,
HorizontalCenterAlign, Justified, LeftAlign, RightAlign}

I am not going to use ContentAlignment as I would have to do 3 if checks
to find out if I need to left justify. Then I find theHOrizontalAlignment
but there is no VerticalAlignment, what gives? Finally I fall into the
StringAlignment which is going to work the best but Far and Near are
really Right and Left unless you are using a point instead of a
rectangle. So I get to confuse my end users with Alignment and
LineAlignment instead of Vertical and Horizontal. I was going to use my
own enumerations but I need to map back into the Far and Near stuff to
use the StringFormat object.

How come some have a NotSet and others don't? I find this typical of the
Windows API, a consistancy group did not get involved. Love the Crystal
one where the word Align appears in the names of most of the elements
even though it is a given based on the name of the enum.

I have to go back and edit a lot of code to change to the new alignment I
just found in Petzold's book, what a hassle for me. New langauge, new
hassles, just the way it goes. I post this in case I missed another
version of Align that I should use instead. What is everyone else using?



Tue, 14 Dec 2004 00:37:48 GMT  
 How many alignments do we need?
Kevin,

    You gave a list of alignments without any indication of what YOUR
requirements are for an alignment enumeration.  What are you trying to do?

--
               - Nicholas Paldino [.NET MVP]


Quote:
> I wanted to have an alignment property for some of my objects and found
> the following:

> System.Web.UI.WebControls.HorizontalAlign {Center, Justify, Left, NotSet,
> Right}

> System.Windows.Forms.HorizontalAlignment {Center, Left, Right}

> System.Drawing.ContentAlignment {Bottom{Center, Left, Right}, Middle
> {C,L,R}, Top{C,L,R}}

> System.Drawing.StringAlignment {Center, Far, Near}

> System.Web.UI,WebControls.VerticalAlign {Bottom, Middle, NotSet, Top}

> CrystalDeciions.Shared.Alignment {Decimal, DefaultAlign,
> HorizontalCenterAlign, Justified, LeftAlign, RightAlign}

> I am not going to use ContentAlignment as I would have to do 3 if checks
> to find out if I need to left justify. Then I find theHOrizontalAlignment
> but there is no VerticalAlignment, what gives? Finally I fall into the
> StringAlignment which is going to work the best but Far and Near are
> really Right and Left unless you are using a point instead of a
> rectangle. So I get to confuse my end users with Alignment and
> LineAlignment instead of Vertical and Horizontal. I was going to use my
> own enumerations but I need to map back into the Far and Near stuff to
> use the StringFormat object.

> How come some have a NotSet and others don't? I find this typical of the
> Windows API, a consistancy group did not get involved. Love the Crystal
> one where the word Align appears in the names of most of the elements
> even though it is a given based on the name of the enum.

> I have to go back and edit a lot of code to change to the new alignment I
> just found in Petzold's book, what a hassle for me. New langauge, new
> hassles, just the way it goes. I post this in case I missed another
> version of Align that I should use instead. What is everyone else using?



Tue, 14 Dec 2004 01:37:53 GMT  
 How many alignments do we need?


Header control that allows any combination of images, text, and direction
arrows.

Right now I have switched to the StringAlignment enum as I need to use
StringFormat for output and I don't want to convert out of one of the
other enums, or my own, to the one needed for StringFormat.

Some of my users with find StringAlignment.Near = Left and .Far = Right
to be a bit confusing. I wish the StringAlignment would have had a couple
of other entries with the same value such as Near = 1, Left = 1 so you
could pick the one that made the most sense. I understand the near / far
stuff as there is a difference between a rectangle and a point when it
comes to reference location.

The other naming issue is I have an alignment for each of the elements:
text, image and arrow. So I use a StringAlignment enum for my image which
is kind of weird but workable. I could switch to my own enum for image
and arrow and use the StringAlignment only for my text but I would like
to use one alignment enum for all of them to avoid even more confusion.

Quote:
> Kevin,

>     You gave a list of alignments without any indication of what YOUR
> requirements are for an alignment enumeration.  What are you trying to
> do?

> --
>                - Nicholas Paldino [.NET MVP]




Tue, 14 Dec 2004 05:21:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. data alignment (was Re: RISC data alignment, in comp.arch)

2. Need help with alignment problem

3. Why structures and unions needs alignment?

4. Need some help -almost done

5. Help needed doing raw term i/o under Unix

6. Need to know when a CommitTrans is done

7. Need API for doing a Route add

8. Need help doing math functions (exponents, roots, etc)

9. Right Alignment in DataGrid

10. VC7 alignment problem with new[] expressions

11. Member Alignment Problems?

12. ListView horizontal alignment

 

 
Powered by phpBB® Forum Software