A
Avonelle Lovhaug
Part of my .NET CF application are some custom controls which I am
creating with some simple graphics commands (DrawString,
DrawRectangle, etc.) Ever since I started using my new device (an
hx4700 iPAQ) for testing, it has been clear that the text quality is
not nearly as sharp as the text contained on the built-in controls.
Is there anything I can do to improve the quality of text created
using DrawString (or an alternative to DrawString)? I've tried using
the OpenNETCF library and the FontEx class and set ClearType = True,
but that doesn't seem to improve anything. Here's a snippet of code
(not that I think I'm doing anything particularly fancy or
different...)
Dim fnt As FontEx
Dim _pen As PenEx
fnt = New FontEx(FontName, FontSize, FontStyle.Bold)
fnt.ClearType = True
_pen = New PenEx(Color.Black)
g = g.FromControl(m_HeadingPicture)
Dim rc As Rectangle
For iDayOfWeek = 1 To 7
PositionOnPanelX = ((iDayOfWeek - 1) * DayWidth)
strHeading = htHeadings.Item(iDayOfWeek)
'Determine length of text for heading
'TextSize = g.MeasureString(strHeading, m_fontSmall)
TextSize = g.MeasureString(strHeading, fnt)
'Determine position to start, based on length of text and
available space to be displayed
intPositionX = (DayWidth / 2) - (TextSize.Width / 2)
rc = New Rectangle(PositionOnPanelX + intPositionX, 1, DayWidth,
TextSize.Height)
With g
'Draw border
'.DrawRectangle(m_pen, PositionOnPanelX, PositionOnPanelY,
DayWidth - 1, MonthTopAfterTitle - 1)
.DrawRectangle(_pen, PositionOnPanelX, PositionOnPanelY,
DayWidth - 1, MonthTopAfterTitle - 1)
'Write day of the week
'.DrawString(strHeading, m_fontLarge, m_brushText,
PositionOnPanelX + intPositionX, 1)
.DrawString(strHeading, fnt, Color.Black, rc)
End With
g.CopyGraphics(m_HeadingPicture, rc)
Next
--------------------
I didn't include everything (so this probably won't compile or
anything)...I just wanted to show the related code that I'm using in
case there is something obviously flawed in what I am doing. Any
suggestions would be greatly appreciated.
Thanks,
--Avonelle
creating with some simple graphics commands (DrawString,
DrawRectangle, etc.) Ever since I started using my new device (an
hx4700 iPAQ) for testing, it has been clear that the text quality is
not nearly as sharp as the text contained on the built-in controls.
Is there anything I can do to improve the quality of text created
using DrawString (or an alternative to DrawString)? I've tried using
the OpenNETCF library and the FontEx class and set ClearType = True,
but that doesn't seem to improve anything. Here's a snippet of code
(not that I think I'm doing anything particularly fancy or
different...)
Dim fnt As FontEx
Dim _pen As PenEx
fnt = New FontEx(FontName, FontSize, FontStyle.Bold)
fnt.ClearType = True
_pen = New PenEx(Color.Black)
g = g.FromControl(m_HeadingPicture)
Dim rc As Rectangle
For iDayOfWeek = 1 To 7
PositionOnPanelX = ((iDayOfWeek - 1) * DayWidth)
strHeading = htHeadings.Item(iDayOfWeek)
'Determine length of text for heading
'TextSize = g.MeasureString(strHeading, m_fontSmall)
TextSize = g.MeasureString(strHeading, fnt)
'Determine position to start, based on length of text and
available space to be displayed
intPositionX = (DayWidth / 2) - (TextSize.Width / 2)
rc = New Rectangle(PositionOnPanelX + intPositionX, 1, DayWidth,
TextSize.Height)
With g
'Draw border
'.DrawRectangle(m_pen, PositionOnPanelX, PositionOnPanelY,
DayWidth - 1, MonthTopAfterTitle - 1)
.DrawRectangle(_pen, PositionOnPanelX, PositionOnPanelY,
DayWidth - 1, MonthTopAfterTitle - 1)
'Write day of the week
'.DrawString(strHeading, m_fontLarge, m_brushText,
PositionOnPanelX + intPositionX, 1)
.DrawString(strHeading, fnt, Color.Black, rc)
End With
g.CopyGraphics(m_HeadingPicture, rc)
Next
--------------------
I didn't include everything (so this probably won't compile or
anything)...I just wanted to show the related code that I'm using in
case there is something obviously flawed in what I am doing. Any
suggestions would be greatly appreciated.
Thanks,
--Avonelle