Susan Bricker wrote:
Hi. I have Access 2003 and I am finding that the font in the text
displayed in Msgbox displays it too small. Is there anyway to increase
the font size of that text?
Regards,
SueB
*** Sent via Developersdex http://www.developersdex.com ***
Print Programming in Windows
Jeff Potts
R & D Books, Miller Freeman, Inc.
Lawrence, Kansas 66046
Copyright 2000
ISBN 0-87930-585-1
contains some very interesting ideas about using Windows API functions
to play with fonts. The handle to a window, to a Device Context and to
a font all seem to have wondrous possibilities. I became interested in
these techniques with the hopes of jazzing up the fonts in Access
reports since a user was complaining that she could export a query to
Excel and get the output to look better than an Access report.
An example from the book:
</StartQuote>
Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
ByVal lpString As String, ByVal nCount As Long) As Long
There's not much to the routine. Both the x and y parameters specify
the location at which to place the text, the hdc parameter is the
destination device context, lpString is the string of text you want to
print, and cbString holds the number of characters you want to display.
Both the x and y parameters use the measurements specified by
SetMappingMode() when positioning the text. Since we are using the
default setting for coordinate mapping (MM_TEXT), everything will be
measured in device pixels. As with most API routines, a nonzero
indicates a successful call and a zero (or false) indicates some sort
of error. The most common error that could occur when calling this
routine is passing the function an invalid HDC.
....
(Visual Basic)
Sub PrintTextRandom(phdc As Long, hfont As Long, margins As RECT, _
x As Integer, y As Integer, str As String)
Dim oldfont As Long
Dim ret As Long
oldfont = SelectObject(phdc, hfont)
ret = TextOut(phdc, margins.left + x, margins.top, str, Len(str))
ret = SelectObject(phdc, oldfont)
End Sub
As you can see, this function is fairly simple. Basically, I select
the font into the HDC, print the text using TextOut(), and put the
previous font handle back into the HDC. With extensive printing of
text, this method of selecting of the font in-and-out of the HDC coud
degrade performance. On the other hand, it acts as a safeguard against
selecting an object into an HDC and forgetting to put it back. As
we've discussed previously, this is the fast-track to losing system
resources.
</EndQuote>
James A. Fortune