|
-
Mar 31st, 2002, 05:21 AM
#1
Thread Starter
Junior Member
Ack! Okay, think you're good...?
Hi guys,
I've been through all my books and all over the Web. There must be an answer to this---it seems so simple---but I can't find it.
I'm writing a program to make 2D chess diagrams for webpages. The user will place the pieces on the form, then save the diagram as a GIF. The board colors (one for the light squares, one for the dark squares) will be user-selectable.
For my diagram editor, I've set up an array of 64 labels, one for each square. I have a True Type chess font that includes:
_ The chess-piece characters
_ "Mask" characters whose filled areas are the shape of the negative space around each type of piece.
In other words, if you start with a white picture box, add the piece character, then add its mask character, you get a piece surrounded by a square of the mask character's ForeColor property. (This allows the piece's unfilled areas to remain uncolored, which is important.)
Assuming I can assemble the diagram, I have an ActiveX control that can save the picture box as a GIF.
My problem is, how the heck do you print (draw) two text characters to the same area of a picture box?
I tried a pixel-level API routine that copied the contents of one picture box to another. It allowed me to set a transparent color (which I set to white, so the white space around the piece character didn't cancel out the mask character.)
It looked great on-screen. However, when I tried to copy the result, I found that it just changed the display, not the destination box's actual Picture property! When I tried to copy it or save it as a GIF, I got just the first character that was in the box. (And I did make sure I'd copied the destination box's Image property to its Picture property, because it was a text-Print.)
I'm assuming this is a commonly-done thing---otherwise, why would someone make a font with both sets of characters?
If I can make this any clearer, let me know (though I've probably typed too much already). Thanks!!
Cheers, Ander
-
Mar 31st, 2002, 08:49 AM
#2
Good Ol' Platypus
You must SavePicture the .Image property of the control (pictureboxes only).
Alternatively, what you can do is use the TextOut API call, but then you'll have to change your labels to pictureboxes. This is the move I'd most recommend.
To use TextOut, in your case, you'd do this:
VB Code:
TextOut ChessBoard(41).hDC, [topX], [topY], "A", Len("A") 'Len("A") = 1
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|