|
#1
|
|||
|
|||
|
Combining graphics...?
Hi, Greetings from Canada (just like the Subject said). You guys seem to know a lot about VB. I've checked all the books and sites I could---and even asked a few "experts"---but no one seems to know how to do this... I'm writing a program to make chess diagrams for webpages. I have a chess font, and all I want to do is create a GIF of a diagram composed from the various characters. I have a control that converts a picture box's contents to a GIF, so that's no problem. I just can't figure out how to combine the chess characters with a background color in one picture box. If I just set the picture box's background color, it shows through the unfilled parts of the text characters, too. The chess font does contain a set of black outlines for each piece---so if I could combine a piece character with an outline character, I could control both of their colors with no problem. But how can I print two characters (or images, if I print them to separate picture boxes first) to the _same area_ of a picture box, without one wiping out the other? Alternately, is there a non-crazy way to print the chess-piece characters (or their images) to a picture box, then fill in the colors of the squares around them---without disturbing the "pieces" themselves? Thanks for your help! |
|
#2
|
|||
|
|||
|
Re: Combining graphics...?
> Greetings from Canada (just like the Subject said).
> > You guys seem to know a lot about VB. I've checked all the books and sites > I could---and even asked a few "experts"---but no one seems to know how to > do this... > > I'm writing a program to make chess diagrams for webpages. I have a chess > font, and all I want to do is create a GIF of a diagram composed from the > various characters. > > I have a control that converts a picture box's contents to a GIF, so that's > no problem. I just can't figure out how to combine the chess characters with > a background color in one picture box. > > If I just set the picture box's background color, it shows through the unfilled > parts of the text characters, too. > > The chess font does contain a set of black outlines for each piece---so if > I could combine a piece character with an outline character, I could control > both of their colors with no problem. But how can I print two characters > (or images, if I print them to separate picture boxes first) to the _same > area_ of a picture box, without one wiping out the other? > > Alternately, is there a non-crazy way to print the chess-piece characters > (or their images) to a picture box, then fill in the colors of the squares > around them---without disturbing the "pieces" themselves? Just put the chess board background as the background to your picture box and use the Print() method or TextOut()/DrawText()/ExtTextOut() API's to draw the text (In the chess font) onto the picture box. Enable the AutoRedraw property before doing so though so you don't loose anything you've already drawn. Alternatively render the chess font out to a bitmap and use transparent blitting to draw each piece into it's place on the picture box, you'll find a transparent blitting library on my page that will do this for you and plenty of sample code (Animated transparent blit demo for example) Hope this helps, Mike -- EDais -- - Microsoft Visual Basic MVP - WWW: Http://EDais.earlsoft.co.uk/ Work E-Mail: EDais@btclick.com Other E-Mail: Mike.Sutton@btclick.com |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|