|
안녕하세요 만해 입니다.
제가 야후의 Cpp Buidler 뉴스 그룹에 얼마전에 가입 했었는데요
저한테 오는 기사 중에 Black Magic 이란 제목의 기사가 와서요
이게 뭔지 궁금해서
혹 아시는분은 좀 알려 주세요
밑의 내용은 제한테 온 기사 전문입니다.
Now, the "black magic" code I use:
bool HelpBtn = false;
void __fastcall TfrmMainMenu::ImgHelpMouseMove(TObject *Sender,
TShiftState Shift, int x, int y)
{
if(HelpBtn)
{
ImgHelp->Picture->LoadFromFile(HelpPicOn);
HelpBtn = false;
}
}
void __fastcall TfrmMainMenu::FormMouseMove(TObject *Sender,
TShiftState Shift, int x, int y)
{
if(!HelpBtn)
{
ImgHelp->Picture->LoadFromFile(HelpPicOff);
HelpBtn = true;
}
}
The way it works is that all of my images on the form are dark, until I move the mouse over them and they highlight. When I move the mouse back over the form the image goes dark again. The only problems is that sometimes after a modal window has popped up, and you have clicked the mouse somewhere in it that is not over the image that brought it up, when you close this window your mouse can end up on top of another image in the menu and since you didn't move over the form, both the original selection and the one the mouse ends up on are highlighted. It can be confusing to the user. If you move the mouse back over the form, both images go back to normal. See what I mean about 'hoaky'. It does work though, and pretty well. It would just be nice if they(Borland) provided us with an ON and OFF mouse event like some of the other languages do.
|