内容提要:;functionTHotTrackImage.DoPaletteChange:Boolean;varParentForm:TCustomForm;Tmp:TGraphic;beginResult:=...
;
function THotTrackImage.DoPaletteChange: Boolean;
var
ParentForm: TCustomForm;
Tmp: TGraphic;
begin
Result := False;
Tmp := FPicture;
if Visible and (not (csLoading in ComponentState)) and (Tmp <> nil) and
(Tmp.PaletteModified) then
begin
if (Tmp.Palette = 0) then
Tmp.PaletteModified := False
else
begin
ParentForm := GetParentForm(Self);
if Assigned(ParentForm) and ParentForm.Active and Parentform.HandleAllocated then
begin
if FDrawing then
ParentForm.Perform(wm_QueryNewPalette, 0, 0)
else
PostMessage(ParentForm.Handle, wm_QueryNewPalette, 0, 0);
Result := True;
Tmp.PaletteModified := False;
end;
end;
end;
end;
function THotTrackImage.GetCanvas: TCanvas;
begin
Result := FPicture.Canvas;
end;
function THotTrackImage.GetPalette: HPALETTE;
begin
Result := FPicture.Palette;
end;
{procedure THotTrackImage.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ReSearch;
var
P:TPoint;
I:Integer;
TempHK:TControl;
begin
for I:=0 to Parent.ControlCount-1 do
begin
TempHK:=Parent.Controls[I];
if TempHK is THotTrackImage then
begin
if not THotTrackImage(TempHK).FSearching1 then
begin
P.X:=X;
P.Y:=Y;
P:=THotTrackImage(TempHK).ScreenToClient(ClientToScreen(P));
THotTrackImage(TempHK).MouseDown(Button,Shift,P.X,P.Y);
Exit;
end;
end;
end;
end;
begin
if not FSearching1 then
begin
FSearching1:=True;
try
if (X>=0)and(X<FPicture.Width)and(Y>=0)and(Y<FPicture.Height) then
begin
if FPicture.Canvas.Pixels[X,Y]=FPicture.Canvas.Pixels[0,0] then
begin
ReSearch;
end else
begin
inherited;
end;
end else
begin
ReSearch;
end;
finally
FSearching1:=False;
end;
end;
end;}
{procedure THotTrackImage.MouseMove(Shift: TShiftState; X, Y: Integer);
procedure ReSearch;
var
P:TPoint;
I:Integer;
TempHK:TControl;
begin
for I:=0 to Parent.ControlCount-1 do
begin
TempHK:=Parent.Controls[I];
if TempHK is THotTrackImage then
begin
if not THotTrackImage(TempHK).FSearching then
begin
P.X:=X;
P.Y:=Y;
P:=THotTrackImage(TempHK).ScreenToClient(ClientToScreen(P));
THotTrackImage(TempHK).MouseMove(Shift,P.X,P.Y);
Exit;
end;
end;
end;
end;
procedure Slicen;
var
I:Integer;
TempHK:TControl;
begin
for I:=0 to Parent.ControlCount-1 do
begin
TempHK:=Parent.Controls[I];
if TempHK<>Self then
begin
THotTrackImage(TempHK).SetHoted(False);
end;
end;
end;
begin
if not FSearching then
begin
FSearching:=True;
try
if (X>=0)and(X<FPicture.Width)and(Y>=0)and(Y<FPicture.Height) then
begin
if FPicture.Canvas.Pixels[X,Y]=FPicture.Canvas.Pixels[0,0] then
begin
SetHoted(False);
ReSearch;
end else
begin
SetHoted(True);
Slicen;
inherited;
end;
end else
begin
SetHoted(False);
ReSearch;
end;
finally
FSearching:=False;
end;
end;
end;}
{procedure THotTrackImage.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
procedure ReSearch;
var
P:TPoint;
I:Integer;
TempHK:TControl;
begin
for I:=0 to Parent.ControlCount-1 do
begin
TempHK:=Parent.Controls[I];
if TempHK is THotTrackImage then
begin
if not THotTrackImage(TempHK).FSearching2 then
begin
P.X:=X;
P.Y:=Y;
P:=THotTrackImage(TempHK).ScreenToClient(ClientToScreen(P));
THotTrackImage(TempHK).MouseUp(Button,Shift,P.X,P.Y);
Exit;
end;
end;
end;
end;
begin
if not FSearching2 then
begin
FSearching2:=True;
try
if (X>=0)and(X<FPicture.Width)and(Y>=0)and(Y<FPicture.Height) then
begin
if FPicture.Canvas.Pixels[X,Y]=FPicture.Canvas.Pixels[0,0] then
begin
ReSearch;
end else
begin
inherited;
end;
end else
begin
ReSearch;
end;
finally
FSearching2:=False;
end;
end;
end;}