Can a rectangle justify text?

bonedoc
04-30-2006, 08:50 PM
I am setting up a print layout. I am using rectangles to wrap the text. It works great. But....it does not look real great. Is there a way to justify the text so it looks nice and square? I have been using this sort of setup:

Dim Rec1 as New rectangleF
x=100F
y=100F
Width = 100F
height = 100F
e.Graphics draw reactangle(text1......rec1)

jo0ls
05-02-2006, 06:49 PM
Use a stringformat in the drawstring, and set its alignment property:

'
Dim x As Single = 100.0F
Dim y As Single = 100.0F
Dim Wid As Single = 100.0F
Dim Hei As Single = 100.0F
Dim Rec1 As New RectangleF(x, y, Wid, Hei)
Dim sf As StringFormat = StringFormat.GenericTypographic
sf.Alignment = StringAlignment.Far ' horizontal
sf.LineAlignment = StringAlignment.Near ' vertical
e.Graphics.DrawRectangle(Pens.AntiqueWhite, Rec1.X, Rec1.Y, Rec1.Width, Rec1.Height)
e.Graphics.DrawString("test", Me.Font, Brushes.BurlyWood, Rec1, sf)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum