Author: Tomas Rutkauskas
Is it possible to create a flat or borderless combo box? If so, how would I go
about it.
Answer:
1 { ... }2 TNoBorderComboBox = class(TComboBox)
3 protected4 procedure WMPaint(var Msg: TMessage); message WM_PAINT;
5 end;
6 7 procedure TNoBorderComboBox.WMPaint(var Msg: TMessage);
8 var9 C: TControlCanvas;
10 R: TRect;
11 begin12 inherited;
13 C := TControlCanvas.Create;
14 try15 C.Control := Self;
16 with C do17 begin18 Brush.Color := clBtnFace;
19 R := ClientRect;
20 FrameRect(R);
21 InflateRect(R, -1, -1);
22 FrameRect(R);
23 end;
24 finally25 C.Free;
26 end;
27 end;