eclems
Messages postés104Date d'inscriptionsamedi 23 décembre 2000StatutMembreDernière intervention 9 mai 2013
-
1 août 2010 à 12:22
eclems
Messages postés104Date d'inscriptionsamedi 23 décembre 2000StatutMembreDernière intervention 9 mai 2013
-
3 août 2010 à 10:08
apres plusieurs recherche comment fait on pour afficher un menupopup en dessous d1 tlabel lorsque l on clique dessus
et comment fait ton pour changer de couleur lorsque l'on survole le tlabel
Cirec
Messages postés3833Date d'inscriptionvendredi 23 juillet 2004StatutModérateurDernière intervention18 septembre 202250 1 août 2010 à 14:54
ben tu poses un TPopupMenu sur la fiche .. tu le complètes comme tu veux .. et dans l'inspecteur d'objets tu sélectionnes le Label et tu cliques à droite de la propriété "PopupMenu" (sur la petite flèche) et tu sélectionnes le PopupMenu et voilà
le popupmenu s'ouvre en faisant un contextuel sur le Label
si tu veux qu'il souvre au clique gauche il faut mettre ce code dans le OnClick du Label:
procedure TExoSeeLabel._DrawText(var Rect: TRect; Flags: Longint);
var
Text: string;
begin
Text := GetLabelText;
// if (Flags and DT_CALCRECT <> 0) and ((Text = '') or FShowAccelChar and
// (Text[1] = '&') and (Text[2] = #0)) then Text := Text + ' ';
if not ShowAccelChar then Flags := Flags or DT_NOPREFIX;
Flags := Flags or DT_END_ELLIPSIS or DT_PATH_ELLIPSIS;
Flags := DrawTextBiDiModeFlags(Flags);
Canvas.Font := Font;
if not Enabled then
begin
OffsetRect(Rect, FXLShadowSpace, FXLShadowSpace);
Canvas.Font.Color := $00B7B7B7;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
OffsetRect(Rect, -FXLShadowSpace, -FXLShadowSpace);
Canvas.Font.Color := $005F5F5F;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
end
else
begin
if FShadowCOLOR<>clNone then
begin
OffsetRect(Rect, FXLShadowSpace, FXLShadowSpace);
Canvas.Font.Color :=FShadowCOLOR;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
OffsetRect(Rect, -FXLShadowSpace, -FXLShadowSpace);
Canvas.Font.Color :=Font.Color;
end;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
end;
end;
//------------------------------------------------------------------------------
procedure TExoSeeLabel.Paint;
const
Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
WordWraps: array[Boolean] of Word = (0, DT_WORDBREAK);
var
Rect: TRect;
DrawStyle: Longint;
begin
with Canvas do
begin
Rect := ClientRect;
//if Assigned(FOnDrawXOCLABEL)then FOnDrawXOCLABEL(Self,Rect,Canvas,FXOCPosition,Caption,Is_SelecTed)
//else begin
if not Transparent then
begin
Brush.Color := Self.Color;
Brush.Style := bsSolid;
FillRect(Rect);
end;
Brush.Style := bsClear;
DrawStyle := DT_EXPANDTABS or WordWraps[WordWrap] or Alignments[Alignment];
_DrawText(Rect, DrawStyle);
end;
end;
//end;
//------------------------------------------------------------------------------
procedure TExoSeeLabel._SetShadowCOLOR(Val:TColor);
begin
FShadowCOLOR:=val;
Invalidate;
end;
//------------------------------------------------------------------------------
procedure TExoSeeLabel._Set__ColorOVER(Val:TColor);
begin
F__ColorOVER:=Val;
Invalidate;
end;
//------------------------------------------------------------------------------
procedure TExoSeeLabel._SetXLShadowSpace(Val:Integer);
begin
FXLShadowSpace:=val;
Invalidate;
end;
//------------------------------------------------------------------------------
procedure TExoSeeLabel.FFFontChanged(var Message: TMessage);
begin