GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
Go Back  Xtreme Visual Basic Talk > > > GDIPLUS: how can i draw a string?


Reply
 
Thread Tools Display Modes
  #1  
Old 11-24-2016, 02:46 PM
Cambalinho_83's Avatar
Cambalinho_83 Cambalinho_83 is offline
Senior Contributor
 
Join Date: Feb 2008
Location: somewhere in space
Posts: 1,296
Default GDIPLUS: how can i draw a string?


i'm trying draw a string on hBitmap(long):
Code:
Public Sub DrawText(text As String)
    Dim lnghdc As Long
    Dim a As GpStatus
    lnghdc = CreateCompatibleDC(0)
    SelectObject lnghdc, hBitmap
    a = GdipCreateFromHDC(lnghdc, hGraphics)
    If (a <> Ok) Then MsgBox "error"
    Dim graphics As Long, brush As Long
    Dim fontFam As Long, curFont As Long
    Dim rcOrigin As RECTF
    Dim str As String, strlen As Long
    str = text
    strlen = Len(str)
    str = StrConv(str, vbUnicode)
    Call GdipCreateSolidFill(Red, brush)
    
    a = GdipCreateFontFamilyFromName(StrConv("Arial", vbUnicode), 0, fontFam)
    Debug.Print a
    Call GdipCreateFont(fontFam, 12, FontStyleUnderline + FontStyleBold, UnitPoint, curFont)
    rcOrigin.Left = 0
    rcOrigin.Top = 0
    Call GdipMeasureString(graphics, str, strlen - 1, curFont, rcOrigin, 0, rcOrigin, 0, 0)
    Call GdipFillRectangles(graphics, brush, rcOrigin, 1)
    Call GdipDrawString(graphics, str, -1, curFont, rcOrigin, 0, brush)
    Call GdipDeleteFont(curFont)
    Call GdipDeleteFontFamily(fontFam)
    Call GdipDeleteBrush(brush)
    Call GdipDeleteGraphics(graphics)
      
End Sub
by some reason the text isn't showed. and i get the error 14(something about the font).
can anyone explain to me?
Reply With Quote
  #2  
Old 01-25-2017, 04:47 PM
mms mms is offline
Ultimate Contributor
 
Join Date: Jul 2002
Location: Hamilton, Ontario
Posts: 1,859
Default

Did you ever figure this out?

Which line gives you error 14?
Reply With Quote
Reply

Tags
call, dim, rcorigin, str, curfont, string, brush, strlen, lnghdc, vbunicode, text, draw, error, fontfam, unitpoint, rcorigin.left, gdipmeasurestringgraphics, rcorigin.top, gdipdrawstringgraphics, gdipdeletefontcurfont, font, 14something, explain, fontstylebold, reason


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string? GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
 
GDIPLUS: how can i draw a string?
GDIPLUS: how can i draw a string?
 
-->