TApplication에는, 힌트에 관한 메소드가 많고, THintWindow에는 힌트 객체의 정보를 가지고 있습니다.
예를 들어서, 힌트가 바뀌지 않는 경우에는, Application->HideHint, Application->ShowHint를 하시면, 바뀐 힌트로 출력됩니다.
아래 루틴은, 제가 사용하는 힌트 루틴인데, 5개의 아바타가 있고, 그 아바타에 가만히 마우스를 올려두면, 아이디 등급등이 출력되는 기능입니다.
//---------------------------------------------------------------------------
void __fastcall TPiece_Room::_imAvatarMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
int itCount, itCursor = crDefault, itStartX;
bool blVisible = false;
String stHint;
TPoint tpPosition;
if(Y >= 8 && Y <= 8 + 30) {
for(itCount = 0; itCount < (MaxUser > MAX_USER_ROOM ? MAX_USER_ROOM : MaxUser); itCount ++) {
itStartX = 23 + (41 * itCount);
if(X >= itStartX && X <= itStartX + 35) {
if(User[itCount] < 0 || User[itCount] >= MAX_USER) continue;
stHint = Format("%-s\n[%-s]", ARRAYOFCONST((
(String)Main->USER[User[itCount]].ID,
(String)ClassIndexToClassString(Main->USER[User[itCount]].Class)
)));
if(stHint != _imAvatar->Hint) {
_imAvatar->Hint = stHint;
GetCursorPos(&tpPosition);
Application->ActivateHint(tpPosition);
}
blVisible = true;
itCursor = crHandPoint;
}
}
}
if(!blVisible) {
_imAvatar->Hint = "";
Application->HideHint();
}
if(_imAvatar->Cursor != itCursor)
_imAvatar->Cursor = (TCursor)itCursor;
}
//---------------------------------------------------------------------------
chickensoup 님이 쓰신 글 :
: 챠트에서 좌표값을 구해서 힌트로 보여주려고 합니다.
: 좌표값은 구했는데, 한번만 보여지고 마우스를 무브할때마다 보여지지는 않습니다.
: 마우스 움직이면 바로바로 힌트가 바뀌었으면 합니다.
: 소스를 첨부하오니, 조언 부탁드립니다.
:
: void __fastcall TForm1::Chart1MouseMove(TObject *Sender, TShiftState Shift,
: int X, int Y)
: {
: double xx,yy;
: Chart1->Series[0]->GetCursorValues(xx,yy);
:
: AnsiString xxx,yyy;
: xxx = IntToStr(int(xx));
: yyy = IntToStr(int(yy));
:
: Chart1->Hint = xxx + "," + yyy;
:
: }
|