Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Formatting QmGrid - row height, Font, Color
#6
Function dialog_grid_cell_color_icon
Code:
Copy      Help
\Dialog_Editor

DlgGrid g
__ImageList il

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 QM_Grid 0x56031041 0x0 0 0 224 114 "0x2,0,0,0,0x0[]A,,,[]B,,,"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "*" "" "" ""

str controls = "3"
str qmg3x
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG goto gInit
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto gNotify
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;_______________________

;gInit

g.Init(hDlg 3)
il.Load("$qm$\il_dlg.bmp")
g.SetImagelist(il)
SendMessage g LVM_SETEXTENDEDLISTVIEWSTYLE LVS_EX_SUBITEMIMAGES LVS_EX_SUBITEMIMAGES

str csv=
;A1,B1
;A2,B2
;A3,B3

g.FromCsv(csv ",")

ret
;_______________________

int row col

;gNotify
NMHDR* nh=+lParam
sel nh.idFrom
,case 3
,sel nh.code
,,case NM_CUSTOMDRAW goto gCustomDraw
,,case LVN_GETDISPINFOW goto gGetDispInfo
ret

;_______________________

;gCustomDraw
NMCUSTOMDRAW* cd=+lParam
NMLVCUSTOMDRAW* cd2=+lParam
int R ;;the return value
sel cd.dwDrawStage
,case CDDS_PREPAINT
,R=CDRF_NOTIFYITEMDRAW ;;notify to draw items
,
,case CDDS_ITEMPREPAINT ;;now draw item
,R=CDRF_NEWFONT|CDRF_NOTIFYSUBITEMDRAW ;;notify to draw subitems
,
,case CDDS_ITEMPREPAINT|CDDS_SUBITEM ;;now draw subitem
,row=cd.dwItemSpec; col=cd2.iSubItem
,if(row=1 and col=1)
,,cd2.clrText=0xff
,,cd2.clrTextBk=0xc0e0c0

ret DT_Ret(hDlg R)

;_______________________

;gGetDispInfo
NMLVDISPINFOW& di=+nh
LVITEMW& u=di.item
if u.mask&LVIF_IMAGE
,row=u.iItem; col=u.iSubItem
,if(row=1 and col=1)
,,u.iImage=6
,else u.iImage=I_IMAGENONE

ret


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)