Sumber Kode

Owner Draw - ComboBox

  • delphibasics
  • Nov 19' 14
  • Delphi
  • 36
  • 308
  • United States
As with menus (menu items), an application can create an owner-drawn combo box to take responsibility for painting list items. An owner-drawn combo box can list/show information other than text strings - usually some graphical elements.

To create an owner-draw combo box, we set its Style property to csOwnerDrawFixed or csOwnerDrawVariable.
  • If all list items in the combo box are the same height, such as strings or icons, an application can use the csOwnerDrawFixed style.
  • If list items are of varying height, like bitmaps of different size, an application can use the csOwnerDrawVariable style. In this case the application will receive the WM_MEASUREITEM Windows message and the OnMeasureItem event will be fired for each item - to specify the height of list items in the combo box.
Having done this, Windows no longer draws the control. Instead it sends a WM_DRAWITEM message whenever a portion of the control needs to be repainted. The parent window (form) of an owner-drawn combo box (its owner) then fires the OnDrawItem event when a portion of the combo box needs to be painted.

To demonstrate owner-drawing with combo boxes create a combo box full of colors (two variations) and a combo with true-type fonts showing the actual image of the font.

Read more: http://delphi.about.com/od/vclusing/a/drawincombobox.htm

To read more about Owner Drawing in Delphi read: http://delphi.about.com/od/vclusing/a/owner_drawing.htm


Only Delphi source code is included in the archive.

Powered by
Pasar Kode Partner

Share

  • Tags :
comments powered by Disqus

Kode Terkait

How to allow or disallow program shutdown in Delphi

Delete the relocations from a PE file.

Owner Draw - DB Grid

Low Level Utilities - Resource Package

MiscUnits - Resource Package

ImageTypes - Resource Package

Resource Utilities - Resource Package

File Association - Pure Windows API

Stolen Bytes - Change Entry Point

Wipe DOS Stub - Remove DOS Header from PE



Kategori