Einzelnen Beitrag anzeigen

Nils_13

Registriert seit: 15. Nov 2004
2.647 Beiträge
 
#7

Re: Listbox-Scrollbalken einfärben?

  Alt 30. Dez 2006, 13:22
Hm...

Du könntest es ja mit einer eigenen Klasse versuchen. Ich kenn mich da aber leider nicht mehr weiter aus, weil man hier wahrscheinlich nivht class(TScrollBar) benutzen sollte. Da werden die andere Programmierer aus diesem Forum wahrscheinlcih besser helfen können. Ich kann nur diesen Kleinkram sagen:
Einbauen: OnClick, OnMouseDown, OnMouseUp (nicht der Scrollbutton) und OnThumbClick, OnThumbMouseDown, OnThumbMouseUp für den Scrollbutton. Dann kommt man der Sache schon etwas näher.

Das Design sieht aber schonmal ganz gut aus!

Sry, dass es jetzt so lang wird, aber ich will es auch nicht kürzen. Ein Ausschnitt aus der XiScrollBar, hoffentlich hilft dir das weiter:
Delphi-Quellcode:
TXiTrackBar = class(TCustomControl)
  private
    FBackColor: TColor;
    FTickColor: TColor;
    FDisabledTickColor: TColor;
    FSlideBorderColor: TColor;
    FSlideFaceColor: TColor;
    FSlideGradColor: TColor;
    FDisabledSlideBorderColor: TColor;
    FDisabledSlideFaceColor: TColor;
    FDisabledSlideGradColor: TColor;
    FThumbBorderColor: TColor;
    FThumbFaceColor: TColor;
    FThumbGradColor: TColor;
    FOverThumbBorderColor: TColor;
    FOverThumbFaceColor: TColor;
    FOverThumbGradColor: TColor;
    FDownThumbBorderColor: TColor;
    FDownThumbFaceColor: TColor;
    FDownThumbGradColor: TColor;
    FDisabledThumbBorderColor: TColor;
    FDisabledThumbFaceColor: TColor;
    FDisabledThumbGradColor: TColor;

    FColorScheme: TColorScheme;
    FPosition: Integer;
    FMin: Integer;
    FMax: Integer;
    FFrequency: Integer;
    FOrientation: TTrackBarOrientation;
    FTickMarks: TTickMark;
    FTickStyle: TTickStyle;
    FSmoothCorners: Boolean;
    FOnChange: TNotifyEvent;

    FThumbState: TBtnState;
    FSlideRect: TRect;
    FThumbRect: TRect;
    FAbsLength: Integer;
    FAbsPos: Integer;
    FThumbWidth: Integer;
    FThumbLength: Integer;

    procedure SetColors(Index: Integer; Value: TColor);
    procedure SetPosition(Value: Integer);
    procedure SetMin(Value: Integer);
    procedure SetMax(Value: Integer);
    procedure SetFrequency(Value: Integer);
// procedure SetThumbLength(Value: Integer); // -
// procedure SetThumbWidth(Value: Integer); // -
    procedure SetTickStyle(Value: TTickStyle);
    procedure SetTickMarks(Value: TTickMark);
    procedure SetOrientation(Value: TTrackBarOrientation);
    procedure SetSmoothCorners(Value: Boolean);
    procedure SetColorScheme(Value: TColorScheme);
    function PointInRect(X, Y: Integer; R: TRect): Boolean;
  protected
    procedure Paint; override;
    procedure MouseEnter(var msg: TMessage); message CM_MOUSEENTER;
    procedure MouseLeave(var msg: TMessage); message CM_MOUSELEAVE;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure MouseMove (Shift: TShiftState; X, Y: Integer); override;
    procedure Resize; override;
    procedure CMEnabledChanged (var msg: TMessage); message CM_ENABLEDCHANGED;
  public
    constructor Create(AOwner: TComponent); override; // +
    destructor Destroy; override; // +

    procedure GradientFillRect(Canvas: TCanvas; Rect: TRect;
                StartColor, EndColor: TColor; Direction: TFillDirection);
    function GetColorScheme: TStringList;
  published
    property BackColor: TColor index 0 read FBackColor write SetColors;
    property TickColor: TColor index 1 read FTickColor write SetColors;
    property DisabledTickColor: TColor index 2 read FDisabledTickColor write SetColors;
    property SlideBorderColor: TColor index 10 read FSlideBorderColor write SetColors;
    property SlideFaceColor: TColor index 11 read FSlideFaceColor write SetColors;
    property SlideGradColor: TColor index 12 read FSlideGradColor write SetColors;
    property DisabledSlideBorderColor: TColor index 13 read FDisabledSlideBorderColor write SetColors;
    property DisabledSlideFaceColor: TColor index 14 read FDisabledSlideFaceColor write SetColors;
    property DisabledSlideGradColor: TColor index 15 read FDisabledSlideGradColor write SetColors;
    property DisabledThumbBorderColor: TColor index 16 read FDisabledThumbBorderColor write SetColors;
    property DisabledThumbFaceColor: TColor index 17 read FDisabledThumbFaceColor write SetColors;
    property DisabledThumbGradColor: TColor index 18 read FDisabledThumbGradColor write SetColors;
    property ThumbBorderColor: TColor index 20 read FThumbBorderColor write SetColors;
    property ThumbFaceColor: TColor index 21 read FThumbFaceColor write SetColors;
    property ThumbGradColor: TColor index 22 read FThumbGradColor write SetColors;
    property OverThumbBorderColor: TColor index 30 read FOverThumbBorderColor write SetColors;
    property OverThumbFaceColor: TColor index 31 read FOverThumbFaceColor write SetColors;
    property OverThumbGradColor: TColor index 32 read FOverThumbGradColor write SetColors;
    property DownThumbBorderColor: TColor index 40 read FDownThumbBorderColor write SetColors;
    property DownThumbFaceColor: TColor index 41 read FDownThumbFaceColor write SetColors;
    property DownThumbGradColor: TColor index 42 read FDownThumbGradColor write SetColors;
    property SmoothCorners: Boolean read FSmoothCorners write SeTSmoothCorners;
    property ColorScheme: TColorScheme read FColorScheme write SetColorScheme;
    property Position: Integer read FPosition write SetPosition;
    property Min: Integer read FMin write SetMin;
    property Max: Integer read FMax write SetMax;
    property Frequency: Integer read FFrequency write SetFrequency;
    property TickStyle: TTickStyle read FTickStyle write SetTickStyle;
    property TickMarks: TTickMark read FTickMarks write SetTickMarks;
    property Orientation: TTrackBarOrientation read FOrientation write SetOrientation;
    // Eigenschaften:
    property Align;
    property Anchors;
    property BorderWidth;
    property Constraints;
    property Ctl3D;
    property Cursor;
    property DragCursor;
    property DragKind;
    property DragMode;
    property Enabled;
    property HelpContext;
  // property HelpKeyword;
  // property HelpType;
    property Hint;
    property ParentShowHint;
    property PopupMenu;
    property ShowHint;
    // property TabOrder;
    // property TabStop;
    property Tag;
    property Visible;
    // Ereignisse:
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
    property OnClick;
    property OnDblClick;
    property OnMouseUp;
    property OnMouseDown;
    property OnMouseMove;
   // property OnMouseEnter;
   // property OnMouseLeave;
end;
  Mit Zitat antworten Zitat