From: Dimitri Kowaletschew on
Hello,

I am not sure if anybody readt my post because I posted it when the
thread seemed to be already solved.
It isn't... I am still struggeling...
So here is my message again. Perhaps anybody has an idea where I am
going wrong...

There are several places in my code where I could set the size, but the
one function that actually does set the size doesn't want any parameters
that define the Unit of the font size...
Does anybody see where else I should define UnitPixel?

Thank you
Dimi

' Initializations
GdipCreateFromHDC lhdc, graphics ' Initialize the graphics class -
required for all drawing

borderCount = 2

GdipSetSmoothingMode graphics, SmoothingModeAntiAlias

' Set the Text Rendering Quality
'GdipSetTextRenderingHint graphics, TextRenderingHint

' Create a font family object to allow us to create a font
' We have no font collection here, so pass a NULL for that parameter

GdipCreateFontFamilyFromName obj.FontName, 0, fontFam
GdipIsStyleAvailable fontFam, FS, IsAvailable

If IsAvailable = 0 Then
Dim Msg As String
Msg = "Font family " & _
obj.FontName & _
" NOT available under GDI+"
MsgBox Msg
Exit Sub
End If
' Create the font from the specified font family name
' >> Note that we have changed the drawing Unit from pixels to points!!
FS = FontStyleRegular 'not really needed since it's zero
If obj.FontBold Then FS = FS + FontStyleBold
If obj.FontItalic Then FS = FS + FontStyleItalic
If obj.FontStrikethru Then FS = FS + FontStyleStrikeout
If obj.FontUnderline Then FS = FS + FontStyleUnderline

GdipCreateFont fontFam, 0, FS, GpUnit.UnitPixel, curFont
' Create the StringFormat object
' We can pass NULL for the flags and language id if we want
GdipCreateStringFormat 0, LocaleID, strFormat


' Justify each line of text
GdipSetStringFormatAlign strFormat, Alignment Mod 3

' Justify the block of text (top to bottom) in the rectangle.
GdipSetStringFormatLineAlign strFormat, Int(Alignment \ 3)

GdipCreatePath FillModeWinding, path

GdipAddPathString path, _
sText, -1, _
fontFam, _
FS, _
24, _
rct, _
strFormat

LSet box = rct

rct2 = SetGradientRectF(box,
LinearGradientMode.LinearGradientModeVertical, 1, True)
GdipCreateLineBrushFromRect rct2, _
StartColor(3), _
EndColor(3), _
GradientMode(3), _
WrapModeTileFlipX, brush
GdipSetLineGammaCorrection brush, Gamma(3)

If brush Then
GdipFillPath graphics, brush, path
GdipDeleteBrush brush
End If
From: Patrice on
Hi,

"Doesn't want" means ? (does the app crash or it runs but doesn't have any
effect ?)

What if you check the return value ? curFont doesn't seems to be used
following its creation. I'm not familiar with this API (wine ?) but in most
of them you have to "select" the font to use once created...

If you change something else (such as the font family) but another font
family is ude it would confirm that you create the font but doesn't use it
once created...

Sorry for the poor help.


--
Patrice

From: Patrice on
Get rid of non needed code and include the declares you are using. This way
others will be able to run, reproduce and possibly debug the minimal amount
of code needed to duplicate this problem in no time compared with having to
get those missing declares (and one of those you use could be the
cullprit)...

(Sorry I thought I was in another group and was surprised by the close to
the metal GDI calls.)

--
Patrice