🔒 Locked
TextOut
Advertisement
Original Post
HI everybody!
I can''t figure out how to get the width (in pixels) of a string that I print to the Screen using the GDI-Function TextOut.
Is there a way to do this??
Thanx for your help... Andreas
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
I did what you told me to do, but this code crashes my program:
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
Edited by - Melo on July 11, 2000 8:10:59 AM
void GUI_OutTextRCT (RECT *lpRect,
char* string,
LPDIRECTDRAWSURFACE lpDDS,
DWORD Color,
HFONT Font)
{
HDC dc;
lpDDS->GetDC (&dc);
SetTextColor (dc, Color);
SetBkMode (dc, TRANSPARENT);
SelectObject (dc, Font);
DrawText (dc, string, strlen (string), lpRect, DT_CENTER);
}
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
Edited by - Melo on July 11, 2000 8:10:59 AM
I am developing a GUI and I have two problems:
1) I try to center the Text to a Button (that''s what the function above is for).
2) The text inside a TextBox should scroll, if the String is larger then the TextBox-Rect.
I''ll keep trying
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
1) I try to center the Text to a Button (that''s what the function above is for).
2) The text inside a TextBox should scroll, if the String is larger then the TextBox-Rect.
I''ll keep trying
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
OH BOY! I'M SO STUPID!!
I forgot:
Problen #1 is solved now - any suggestions for #2 ?
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
Edited by - Melo on July 11, 2000 9:18:18 AM
I forgot:
lpDDS->ReleaseDC (dc);
Problen #1 is solved now - any suggestions for #2 ?
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
Edited by - Melo on July 11, 2000 9:18:18 AM
Can you help me with the 2nd question, please?
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement