dbTalk Databases Forums  

Rotated Text fields or labels

comp.databases.ms-access comp.databases.ms-access


Discuss Rotated Text fields or labels in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default Rotated Text fields or labels - 03-04-2011 , 05:56 PM






I need to create a form with up to 100 text boxes or labels. Don't care which
I use as the data will be static. I will have a table that gives the top and
left position, the maximum height & width and the angle as well as the
ControSource or Caption. The size of the label needs to be adjusted to the
size of the data it contains. Stephen Leban's has a couple of routines to
help with that, but his rotation routines apparently are very hungry with
memory. Any idea please?
Phil

Reply With Quote
  #2  
Old   
James A. Fortune
 
Posts: n/a

Default Re: Rotated Text fields or labels - 03-07-2011 , 09:48 PM






On Mar 4, 6:56*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
I need to create a form with up to 100 text boxes or labels. Don't care which
I use as the data will be static. I will have a table that gives the top and
left position, the maximum height & width and the angle as well as the
ControSource or Caption. The size of the label needs to be adjusted to the
size of the data it contains. Stephen Leban's has a couple of routines to
help with that, but his rotation routines apparently are very hungry with
memory. Any idea please?
Phil
Two options come to mind:

1) Create a XAML file from Access and show your form in a browser
2) Create a PDF file from Access and show your form in Acrobat Reader.

It should be a piece of cake for either. Both support vector graphics
and transformations. The transformations were quite easy for me to
learn because the same technique was used in an XWindows course I took
before PDF files were even conceived. Some techniques have been
around longer than most people realize :-).

The WPF book I have shows much of what XAML can do:

WPF Programmer's Reference: Windows Presentation Foundation with C#
2010 and .NET 4
Wiley/Wrox 2010
Rod Stephens
ISBN: 978-0-470-47722-9

Don't let the C# part scare you. The preponderance of examples are
just XAML.

For PDF output, to get the width in points that a particular string
will have for a given font and font size, you'll need to use font
metrics information. I usually put the character widths (usually
expressed as a number of thousandths for Adobe fonts) for commonly
used fonts into an Access table and have a function calculate the
string width. If the string width is too large to fit in the allotted
space, I can use the point size of the allotted space to scale down
the font size proportionately if space is at a premium since decimal
font sizes such as 7.325 are allowed :-). Note that Stephen Lebans
simply used API functions to get his string widths since his examples
were limited to the Windows environment. I try to limit how much text
resizing is done (and to what degree, zoom notwithstanding) since the
aesthetics can suffer if you have a lot of different sized fonts all
over your output. If you use a monospaced font such as Courier, the
metrics are easy, but font scaling might make it look like you are
using different sized typewriters for the non-fixed portion of your
output :-). Rotating text involves setting a new origin and then
rotating the coordinates. Then put out text normally. It's good to
do your text rotating inside a 'q' ... 'Q' block since PDF graphics
commands can become embarrassing if you don't scope your coordinate
transformations.

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: Rotated Text fields or labels - 03-08-2011 , 03:25 AM



On 08/03/2011 03:48:31, "James A. Fortune" wrote:
Quote:
On Mar 4, 6:56*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
I need to create a form with up to 100 text boxes or labels. Don't care w
hich
I use as the data will be static. I will have a table that gives the top
and
left position, the maximum height & width and the angle as well as the
ControSource or Caption. The size of the label needs to be adjusted to th
e
size of the data it contains. Stephen Leban's has a couple of routines to
help with that, but his rotation routines apparently are very hungry with
memory. Any idea please?
Phil

Two options come to mind:

1) Create a XAML file from Access and show your form in a browser
2) Create a PDF file from Access and show your form in Acrobat Reader.

It should be a piece of cake for either. Both support vector graphics
and transformations. The transformations were quite easy for me to
learn because the same technique was used in an XWindows course I took
before PDF files were even conceived. Some techniques have been
around longer than most people realize :-).

The WPF book I have shows much of what XAML can do:

WPF Programmer's Reference: Windows Presentation Foundation with C#
2010 and .NET 4
Wiley/Wrox 2010
Rod Stephens
ISBN: 978-0-470-47722-9

Don't let the C# part scare you. The preponderance of examples are
just XAML.

For PDF output, to get the width in points that a particular string
will have for a given font and font size, you'll need to use font
metrics information. I usually put the character widths (usually
expressed as a number of thousandths for Adobe fonts) for commonly
used fonts into an Access table and have a function calculate the
string width. If the string width is too large to fit in the allotted
space, I can use the point size of the allotted space to scale down
the font size proportionately if space is at a premium since decimal
font sizes such as 7.325 are allowed :-). Note that Stephen Lebans
simply used API functions to get his string widths since his examples
were limited to the Windows environment. I try to limit how much text
resizing is done (and to what degree, zoom notwithstanding) since the
aesthetics can suffer if you have a lot of different sized fonts all
over your output. If you use a monospaced font such as Courier, the
metrics are easy, but font scaling might make it look like you are
using different sized typewriters for the non-fixed portion of your
output :-). Rotating text involves setting a new origin and then
rotating the coordinates. Then put out text normally. It's good to
do your text rotating inside a 'q' ... 'Q' block since PDF graphics
commands can become embarrassing if you don't scope your coordinate
transformations.

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com

Thanks James

The PDF route is not on, as I want to be able to drag the controls round the
form, rotate them and store the positions and angles after I have moved them.
I need to be able to see what I am doing and I presume your method produces a
snapshot after you have finished moving all the controls i.e. you then
produce the PDF file. I don't know enough about XAML to know whether I could
do that then save the information back into an Access table. If you see my
posting on 6th March "BringToFront", you will see that everything has been
solved except how to alter Stephen Lebans "JustifyText and RotateText"
ActiveX control to include the BackStyle property. Need to be able to set
this to tranparent othewise overlapping controls where the text is at a large
angle from the vertical or horizontal (say 45 degrees) obscure the text of
the "underneath" control.

Would appreciate any more help, but could you reply to the "BringToFront"
thread as both threads are on the same topic

Many thanks

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.