自绘下拉框演示

光庆 8月前 757

Code AardioLine:39复制
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
    • import win.ui;
    • /*DSG{{*/
    • var winform = win.form(text="aardio form";right=367;bottom=199)
    • winform.add(
    • combobox={cls="combobox";left=40;top=40;right=336;bottom=64;items={"啊撒旦法萨芬";"asdfasf";"asfdas啊撒旦法萨芬"};mode="dropdown";style=528;z=1}
    • )
    • /*}}*/
    • winform.combobox.wndproc = function(hwnd,message,wParam,lParam){
    • select( message ) {
    • case 0x002B/*_WM_DRAWITEM*/ {
    • import console
    • var tag = {
    • INT CtlType;
    • INT CtlID;
    • INT itemID;
    • INT itemAction;
    • INT itemState;
    • int hwndItem;
    • ptr hDC;
    • struct rect = ::RECT();
    • int itemData;
    • };
    • ..raw.convert(topointer(lParam),tag);
    • var font = ..gdi.getFont(owner.hwnd)
    • if tag.itemState&1 {
    • ..gdi.fillRect(tag.hDC,0xFF8888,tag.rect);
    • } else {
    • ..gdi.fillRect(tag.hDC,0xFFFFFF,tag.rect);
    • }
    • tag.rect.left += 5;
    • ..gdi.drawText(tag.hDC,font,winform.combobox.items[tag.itemID+1],tag.rect,4/*_DT_VCENTER*/|0x20/*_DT_SINGLELINE*/);
    • }
    • }
    • }
    • winform.show();
    • ::SendMessageInt(winform.combobox.hwnd,0x153,0,30);
    • ::SendMessageInt(winform.combobox.hwnd,0x153,-1,30);
    • win.loopMessage();


    最新回复 (2)
    • netfox 8月前
      1 2

    • amin 8月前
      0 3
      厉害啦!
    返回