Guidance
指路人
g.yi.org
software / rapidq / examples / gui / listbox & ComboBox / owndraw / QListBox OwnerDraw.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'Lance (5/28/03 4:12:23 pm)

     DECLARE SUB DrawItems(Index AS LONG, State AS LONG, r AS QRECT)

     DIM Colors(2) AS LONG
     Colors(0)=&H0000FF
     Colors(1)=&HFF0000
     Colors(2)=&H00FF00

     CREATE Form AS QFORM
      Center
      CREATE ListBox AS QLISTBOX
       Style=1        ' lbOwnerDrawFixed
       AddItems "Red", "Blue", "Green"
       OnDrawItem=DrawItems
      END CREATE
      SHOWMODAL
     END CREATE

     SUB DrawItems
      SELECT CASE State
      CASE 0:        ' Selected Item
       ListBox.FillRect(r.Left, r.Top, r.Right, r.Bottom, Colors(Index))
       ListBox.TextOut(r.Left, r.Top, ListBox.Item(Index), &HFFFFFF, -1)
      CASE 1:        ' Previously Selected Item
       ListBox.FillRect(r.Left, r.Top, r.Right, r.Bottom, ListBox.COLOR)
       ListBox.TextOut(r.Left, r.Top, ListBox.Item(Index), Colors(Index), -1)
      END SELECT
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-5-18  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-05-29 10:01:53