原生Tab选项卡图标扩展库

netfox 9月前 1297

Code AardioLine:88复制
  • 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.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
    • namespace win.ui.ctrl.tab.icon;
    • import fsys;
    • import gdip.bitmap;
    • import win.imageList;
    • import util.metaProperty;
    • util.metaProperty.extend(..win.ui.ctrl.tab,{
    • setIcon = function( index,icoindex ){
    • if(index > #owner.items) return;
    • var n = icoindex-1;
    • if (n < 0) return;
    • if (owner.iconList && !owner.iconList.getIcon(n)) return;
    • var tci = owner.getItem(index);
    • tci.pszText = owner.getItemText(index)
    • tci.iImage = n;
    • owner.setItem(index,tci);
    • }
    • add = function(tParam){
    • var tci = ..win.ui.ctrl.tab.TCITEM();
    • tci.pszText = tParam.text;
    • tParam.text = null;
    • tParam.parent = owner ;
    • tParam.mode="child";
    • tParam.exmode="none";
    • tParam.border="none"
    • tParam.title=false;
    • if( !(tParam.right && tParam.bottom) ){
    • var rc = owner.getClientRect();
    • tParam.right = rc.right;
    • tParam.bottom = rc.bottom;
    • }
    • var wf = ..win.form(tParam);
    • if(!wf) return null,"创建窗口失败";
    • var index = ..table.push(owner._forms ,wf)-1;
    • var imageList = owner.imageList;
    • if (imageList && ..table.isArray(imageList)){
    • var icon = ..win.imageList(20,20);
    • for(i=1;#imageList;1){
    • var iconFile = imageList[i];
    • if (..fsys.getExtensionName(iconFile) == "ico"){
    • icon.addIcon(iconFile);
    • }else{
    • icon.addBitmap(..gdip.bitmap(iconFile).copyHandle(20,20));
    • }
    • }
    • imageList = icon;
    • }
    • owner.iconList = imageList;
    • var icoIndex;
    • if (tParam.ico){
    • icoIndex = tParam.ico-1;
    • }else {
    • icoIndex = index;
    • }
    • if (imageList && imageList.getIcon(icoIndex)){
    • owner.sendMessage(0x1303 /*_TCM_SETIMAGELIST*/,0,imageList[["handle"]]:imageList);
    • tci.iImage = icoIndex;
    • }
    • ::SendMessageByStruct(owner.hwnd ,0x133E/*_TCM_INSERTITEMW*/, index,tci);
    • ::SendMessage(owner.hwnd,0x5/*_WM_SIZE*/);
    • owner.modifyStyle(0x40 /*_TCS_FIXEDWIDTH*/);
    • owner.lastForm = wf;
    • wf._onDestroyInTabs = function(){
    • var i = ..table.find(owner.parent._forms,wf);
    • if(i) owner.parent.remove(i);
    • }
    • if(!index){
    • owner.form = wf;
    • owner.form.show(true);
    • owner.adjustRect();
    • }
    • else {
    • wf.show(false);
    • owner.adjustRect();
    • }
    • return wf;
    • }
    • })
    • /*****intellisense(!ui_tab.)
    • imageList = imageList图像列表对象,或者包含图标,图片的数组
    • setIcon(__/*选项卡索引*/,/*图标索引*/); = tab选项卡设置图标
    • end intellisense*****/

    下载附件,放到

    Code AardioLine:1复制
  • 1.
    • lib\win\ui\ctrl

    或者自定义库的命名空间,放在lib下,导入即可

    上传的附件:
    最新回复 (4)
    • axuanup 9月前
      0 2

      恭候大哥多时了

    • cyzn_lfss 9月前
      0 3
      算是有求有应了吧
    • 光庆 9月前
      0 4
      好东西!如果一鹤升级一下扩展库就更方便了
    • netfox 8月前
      0 5
      光庆 好东西!如果一鹤升级一下扩展库就更方便了

    返回