Author: Eran
Date: 14:11:52 11/18/01
Go up one level in this thread
On November 18, 2001 at 12:27:51, Bo Persson wrote: >On November 17, 2001 at 17:31:49, Eran wrote: > >> >>I program a chess window interface in MFC. After I successfully created >>draggable chess pieces from bitmap resources, I had problems with the >>transparency surrounding the chess pieces. When I called the function as show >>below, >> >>::TransparentBlt((HDC) &dc, org.x, org.y, size.x, size.x, (HDC) &dcMem, >> org.x, org.x, size.x, size.y, RGB(255, 255, 255)); >> >>the transparency looked fine if I never dragged them from their origin squares. >>When I dragged a piece, the transparent region (a rectangle shape contains a >>piece in center) surrounding it cut off from the area of the board and the >>region followed the piece around like a shadow. That was a problem. Since I >>could not find a solution in MFC, I dived into a more complicated Win32 >>programming codes in the WinBoard 4.2.3 source files. I could not find it there >>either. I tried with icons instead of bitmap resources but failed to show up on >>client area of the View class. MFC is pretty inflexible. >> >>If you know how to do it or if you have correct MFC codes (I prefer clear codes >>with good explanations), please let me know. >> >>I would appreciate your help a great deal. >> >>My developing program is MS Visual C++ 6.0 Professional with latest update. > >If you are using an MCF View to display your board, there is also a CImageList >class that implements Drag'n'Drop for images! > >After loading the image list with pieces and masks, all you have to do is > >in OnLButtonDown() > ImageList.BeginDrag(Index); > ImageList.DragEnter(this,coordinate); > >in OnMouseMove() > ImageList.DragMove(new_coordinate) > >in OnLButtonUp() > ImageList.EndDrag(); > ImageList.DragLeave(this); > > >Just remember the square from OnLButtonUp() and you are there! > > >Bo Persson >bop2@telia.com > > > >>Thank you, >>Eran >>My new email address: eran_k1@bezeqint.net >>Please do not email any message to my old email address (mrerk@barak-online.net)
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.