I have a TTrackBar on my form, but would like it to not have the border around it:
ie. only the blue arrow should be visible - the border (and the content, ie the area that the arrow navigates in) should be invisible (could be solved by setting the color to clBtnFace if need be).
I have tried many things to hide this (in an overridden Create CONSTRUCTOR):
BevelEdges:=[];
BevelInner:=TBevelCut.bvNone;
BevelOuter:=TBevelCut.bvNone;
BevelKind:=TBevelKind.bkNone;
BorderWidth:=0;
Brush.Color:=clBtnFace;
ParentCtl3D:=FALSE;
Ctl3D:=FALSE;
but it doesn't appear to make any difference.
Is there a way to achieve my goal?
I believe you can override the track bar's CNNotify
message method to handle the NM_CUSTOMDRAW
notification when dwDrawStage = CDDS_ITEMPREPAINT
and dwItemSpec = TBCD_CHANNEL
, setting the result to CDRF_SKIPDEFAULT
:
procedure TTrackBar.CNNotify(var Message: TWMNotifyTRB);
begin
if
(Message.NMHdr.code = NM_CUSTOMDRAW)
and
(Message.NMCustomDraw.dwDrawStage = CDDS_ITEMPREPAINT)
and
(Message.NMCustomDraw.dwItemSpec = TBCD_CHANNEL)
then
Message.Result := CDRF_SKIPDEFAULT
else
inherited;
end;
Don't forget to set ShowSelRange = False
and TickStyle = tsNone
.