Unit ListComb

A unit to allow display of bitmaps in TComoboboxes and TListboxes Use an ImageList to store the pictures: assign the ImageList to the components ImageList property, write something in the Items property and go! Freeware. Copyright @ 1997 by Peter Thörnqvist Contact: NMA96PTH@STUDENT2.LU.SE or DAT97PTH@LUDAT.LTH.SE

Classes

TImageComboBox -
TImageListBox -

Functions

Register - procedure TImageListBox.

Types

TImageAlign
TTextAlign

Constants

Variables


Functions


procedure Register;

procedure TImageListBox.SetImageAlign(Value:TImageAlign); begin if FImageAlign <> Value then begin FImageAlign := Value; ResetItemHeight; RecreateWnd; end; end; procedure TImageLIstBox.SetTextAlign(Value:TTextAlign); begin if FTextAlign <> Value then begin FTextAlign := Value; ResetItemHeight; RecreateWnd; end; end; procedure TImageListBox.SetAllAlign(var Rect:TRect); begin case FImageAlign of tiaLeft: begin ImLeftOff := 4; TxtFlags := DT_LEFT; InflateRect(Rect,-(FWidth + 4) * 2,1); end; tiaCenter: begin ImLeftOff := ((Rect.Right - Rect.Left) div 2) - (FWidth div 2); TxtFlags := DT_CENTER; end; tiaRight: begin ImLeftOff := ((Rect.Right - Rect.Left) - FWidth) - 8; InflateRect(Rect,-4,1); TxtFlags := DT_LEFT; end; end; case FTextAlign of ttaTop: begin ImTopOff := GetItemHeight(Font) + 4; // InflateRect(Rect,1,-4); TxtFlags := TxtFlags or DT_TOP; end; ttaCenter: begin ImTopOff := 4; TxtFlags := TxtFlags or DT_CENTER; end; ttaBottom: begin ImTopOff := 4; // InflateRect(Rect,1,-4); TxtFlags := TxtFlags or DT_BOTTOM; end; end; // ResetItemHeight; // RecreateWnd; end;

Types


TImageAlign=(tiaLeft,tiaCenter,tiaRight);

TTextAlign=(ttaTop,ttaCenter,ttaBottom);
TImageListBox

Constants


Variables