📄 mxoutlookbar.pas
字号:
Width := 60;
FImageIndex := -1;
FTransparent := TRUE;
FAutoSize := TRUE;
TabStop := TRUE;
FLargeImageChangeLink := TChangeLink.Create;
FLargeImageChangeLink.OnChange := ImageListChange;
FSmallImageChangeLink := TChangeLink.Create;
FSmallImageChangeLink.OnChange := ImageListChange;
{$IFDEF DELPHI4_UP}
OnCanResize := OnButtonResized;
{$ENDIF}
FResizingEnabled := FALSE;
End;
// *************************************************************************************
// ** TOutlookButton.Destroy, 4/12/01 3:42:05 PM
// *************************************************************************************
Destructor TOutlookButton.Destroy;
Begin
FLargeImageChangeLink.Free;
FSmallImageChangeLink.Free;
Inherited Destroy;
End;
// *************************************************************************************
// ** TOutlookButton.CanFocus, 5/16/01 9:32:48 AM
// *************************************************************************************
{$IFDEF DELPHI4_UP}
Function TOutlookButton.CanFocus: Boolean;
Var
mxOutlookBarHeader: TmxOutlookBarHeader;
_CanFocus: Boolean;
Begin
_CanFocus := Inherited CanFocus;
If Parent Is TmxOutlookBarHeader Then
Begin
mxOutlookBarHeader := ( Parent As TmxOutlookBarHeader );
If _CanFocus Then
Begin
If mxOutlookBarHeader.GetParentBar <> Nil Then
Begin
If mxOutlookBarHeader.GetParentBar.CommonStyle Then
_CanFocus := mxOutlookBarHeader.GetParentBar.HeaderSettings.KeySupport Else
_CanFocus := mxOutlookBarHeader.HeaderSettings.KeySupport;
If _CanFocus Then
_CanFocus := mxOutlookBarHeader.GetParentBar.ActiveHeader = mxOutlookBarHeader;
End;
End;
End;
Result := _CanFocus;
End;
{$ENDIF}
// *************************************************************************************
// ** TOutlookButton.WMSetFocus, 5/11/01 4:36:11 PM
// *************************************************************************************
Procedure TOutlookButton.WMSetFocus( Var Message: TWMSetFocus );
Begin
If Parent Is TmxOutlookBarHeader Then
Begin
If ( Parent As TmxOutlookBarHeader ).GetParentBar <> Nil Then
If ( Parent As TmxOutlookBarHeader ).GetParentBar.ActiveHeader = ( Parent As TmxOutlookBarHeader ) Then
Begin
Windows.SetFocus( TWinControl( Self ).Handle );
Invalidate;
End;
End
Else
Inherited;
End;
// *************************************************************************************
// ** TOutlookButton.WMKillFocus, 5/11/01 4:44:06 PM
// *************************************************************************************
Procedure TOutlookButton.WMKillFocus( Var Message: TWMSetFocus );
Begin
Invalidate;
Inherited;
End;
// *************************************************************************************
// ** TOutlookButton.OnButtonResized, 4/26/01 3:45:56 PM
// *************************************************************************************
{$IFDEF DELPHI4_UP}
Procedure TOutlookButton.OnButtonResized( Sender: TObject; Var NewWidth, NewHeight: Integer; Var Resize: Boolean );
Begin
If FResizingEnabled Then Resize := TRUE Else Resize := Not FAutoSize;
End;
{$ENDIF}
// *************************************************************************************
// ** TOutlookButton.Notification, 4/17/01 3:11:44 PM
// *************************************************************************************
Procedure TOutlookButton.Notification( AComponent: TComponent; Operation: TOperation );
Begin
Inherited Notification( AComponent, Operation );
If Operation = opRemove Then
Begin
If AComponent = LargeImages Then LargeImages := Nil;
If AComponent = SmallImages Then SmallImages := Nil;
If AComponent = PopupMenu Then PopupMenu := Nil;
{$IFDEF DELPHI4_UP}
If AComponent = Action Then Action := Nil;
{$ENDIF}
End;
End;
// *************************************************************************************
// ** TOutlookButton.SetAutoSize, 4/26/01 2:11:55 PM
// *************************************************************************************
Procedure TOutlookButton.SetAutoSize( Value: Boolean );
Begin
If FAutoSize <> Value Then
Begin
FAutoSize := Value;
If Parent Is TmxOutlookBarHeader Then
( Parent As TmxOutlookBarHeader ).DoSettingsChange( ( Parent As TmxOutlookBarHeader ).HeaderSettings );
End;
End;
// *************************************************************************************
// ** TOutlookButton.GetButtonIndex, 4/18/01 3:56:58 PM
// *************************************************************************************
Function TOutlookButton.GetButtonIndex: TButtonIndex;
Begin
Result := TabOrder;
End;
// *************************************************************************************
// ** TOutlookButton.SetButtonIndex, 4/18/01 3:55:21 PM
// *************************************************************************************
Procedure TOutlookButton.SetButtonIndex( Value: TButtonIndex );
Begin
If TabOrder <> Value Then
Begin
TabOrder := Value;
If ( Parent Is TmxOutlookBarHeader ) Then
( Parent As TmxOutlookBarHeader ).AutoSortButtons;
End;
End;
// *************************************************************************************
// ** TOutlookButton.SetTransparent, 4/20/01 1:18:39 PM
// *************************************************************************************
Procedure TOutlookButton.SetTransparent( Value: Boolean );
Begin
If FTransparent <> Value Then
Begin
FTransparent := Value;
RePaint;
If ( Parent Is TmxOutlookBarHeader ) Then
( Parent As TmxOutlookBarHeader ).AutoSortButtons;
End;
End;
// *************************************************************************************
// ** TOutlookButton.SetCaption, 4/17/01 2:52:17 PM
// *************************************************************************************
Procedure TOutlookButton.SetCaption( Value: String );
Begin
If FCaption <> Value Then
Begin
FCaption := Value;
RePaint;
End;
End;
// *************************************************************************************
// ** TOutlookButton.CMMouseEnter, 4/12/01 3:42:07 PM
// *************************************************************************************
Procedure TOutlookButton.CMMouseEnter( Var Message: TMessage );
Begin
FMouseInButton := TRUE;
RePaint;
End;
// *************************************************************************************
// ** TOutlookButton.WMLButtonDown, 5/4/01 1:09:13 PM
// *************************************************************************************
Procedure TOutlookButton.WMLButtonDown( Var Message: TWMLButtonDown );
Begin
Inherited;
End;
// *************************************************************************************
// ** TOutlookButton.CMMouseLeave, 4/12/01 3:42:10 PM
// *************************************************************************************
Procedure TOutlookButton.CMMouseLeave( Var Message: TMessage );
Begin
FMouseInButton := FALSE;
FButtonDown := FALSE;
RePaint;
End;
// *************************************************************************************
// ** TOutlookButton.SetLargeImages, 4/11/01 2:24:43 PM
// *************************************************************************************
Procedure TOutlookButton.SetLargeImages( Value: TCustomImageList );
Begin
If FLargeImages <> Nil Then FLargeImages.UnRegisterChanges( FLargeImageChangeLink );
FLargeImages := Value;
If FLargeImages <> Nil Then
Begin
FLargeImages.RegisterChanges( FLargeImageChangeLink );
FLargeImages.FreeNotification( Self );
End;
ImageListChange( LargeImages );
End;
// *************************************************************************************
// ** TOutlookButton.SetSmallImages, 4/11/01 2:24:43 PM
// *************************************************************************************
Procedure TOutlookButton.SetSmallImages( Value: TCustomImageList );
Begin
If FSmallImages <> Nil Then FSmallImages.UnRegisterChanges( FSmallImageChangeLink );
FSmallImages := Value;
If FSmallImages <> Nil Then
Begin
FSmallImages.RegisterChanges( FSmallImageChangeLink );
FSmallImages.FreeNotification( Self );
End;
ImageListChange( SmallImages );
End;
// *************************************************************************************
// ** TOutlookButton.SetImageIndex, 4/17/01 3:17:05 PM
// *************************************************************************************
Procedure TOutlookButton.SetImageIndex( Value: TImageIndex );
Begin
If FImageIndex <> Value Then
Begin
FImageIndex := Value;
RePaint;
End;
End;
// *************************************************************************************
// ** TOutlookButton.SetImages, 4/11/01 2:24:43 PM
// *************************************************************************************
Procedure TOutlookButton.ImageListChange( Sender: TObject );
Begin
Repaint;
End;
// *************************************************************************************
// ** TOutlookButton.MouseDown, 4/12/01 3:42:16 PM
// *************************************************************************************
Procedure TOutlookButton.MouseDown( Button: TMouseButton; Shift: TShiftState; X, Y: Integer );
Begin
Inherited MouseDown( Button, Shift, X, Y );
If Button = mbLeft Then
Begin
FButtonDown := TRUE;
RePaint;
End;
End;
// *************************************************************************************
// ** TOutlookButton.MouseUp, 4/12/01 3:42:21 PM
// *************************************************************************************
Procedure TOutlookButton.MouseUp( Button: TMouseButton; Shift: TShiftState; X, Y: Integer );
Begin
If Button = mbLeft Then
Begin
FButtonDown := FALSE;
{$IFDEF DELPHI4_UP}
If CanFocus Then SetFocus;
{$ENDIF}
RePaint;
End;
Inherited MouseUp( Button, Shift, X, Y );
End;
// *************************************************************************************
// ** TOutlookButton.TmxOutlookBarHeader, 4/17/01 3:02:16 PM
// *************************************************************************************
Procedure TOutlookButton.CMTextChanged( Var Msg: TMessage );
Begin
Inherited;
RePaint;
End;
// *************************************************************************************
// ** TOutlookButton.CMFontChanged, 4/17/01 3:02:13 PM
// *************************************************************************************
Procedure TOutlookButton.CMFontChanged( Var Msg: TMessage );
Begin
Inherited;
RePaint;
End;
// *************************************************************************************
// ** TOutlookButton.Paint, 4/20/01 2:34:04 PM
// *************************************************************************************
Procedure TOutlookButton.Paint;
Var
ARect: TRect;
Rect_Picture: TRect;
FontHeight: Integer;
Flags: Longint;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -