jack niekerk
asked on
ROTATE TEXT IN VB6 TO PRINTER
This is what I do normal:
Printer.ScaleMode = 6 'milimeter
Printer.CurrentX = col
Printer.CurrentY = row
Printer.FontName = FontType(fntType)
Printer.Fontsize = fntSize
Printer.Print text
But on certain forms I need to rotate part off text either 90 or 180 degrees.
What would be syntax to do so??
Printer.ScaleMode = 6 'milimeter
Printer.CurrentX = col
Printer.CurrentY = row
Printer.FontName = FontType(fntType)
Printer.Fontsize = fntSize
Printer.Print text
But on certain forms I need to rotate part off text either 90 or 180 degrees.
What would be syntax to do so??
ASKER
Will start searching for this kind off syntax, keep u informed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, did made the changes from me. to printer. wil print plain horizontal line on printer with text, on screen it will create angles, what do I wrong?
Regards Jack
Regards Jack
Did you change every instance of me to printer?
sFont = "Times New Roman"
For cnt = 1 To Len(sFont)
lf.lfFaceName(cnt) = Asc(Mid$(sFont, cnt, 1))
Next cnt
lf.lfHeight = 48
For cnt = 0 To 3600 Step 200
lf.lfEscapement = cnt
hNewFont = CreateFontIndirect(lf)
hOldFont = SelectObject(Printer.hdc, hNewFont)
Printer.CurrentX = 2000
Printer.CurrentY = 2000
Printer.Print "Text at an angle"
SelectObject Printer.hdc, hOldFont
DeleteObject hNewFont
Next cnt
By the way, I seem to have left some redundant code in my original post.
sFont = "Times New Roman"
For cnt = 1 To Len(sFont)
lf.lfFaceName(cnt) = Asc(Mid$(sFont, cnt, 1))
Next cnt
lf.lfHeight = 48
For cnt = 0 To 3600 Step 200
lf.lfEscapement = cnt
hNewFont = CreateFontIndirect(lf)
hOldFont = SelectObject(Printer.hdc, hNewFont)
Printer.CurrentX = 2000
Printer.CurrentY = 2000
Printer.Print "Text at an angle"
SelectObject Printer.hdc, hOldFont
DeleteObject hNewFont
Next cnt
By the way, I seem to have left some redundant code in my original post.
ASKER
Ok, got it working now, problem was printerdriver
Glad to hear it's working.
Best of luck,
James
Best of luck,
James
Fortunately one of the things it does give you is a "hDC" property, which lets you access the printing "device context", allowing you to roll your own add-on printing routines using the GDI API functions. It's a while since I've done this, and I don't have a copy of VB6 to hand, but I think you need to declare the DrawString function from the GDI library, which lets you specify things like the position, the font, the size, the angle, and of course the text to be drawn.
Good luck!