快捷导航

[MaxScripts] 一个TAB选项卡界面的代码

[复制链接]
2013-12-13 21:34 / 查看: 15559 / 回复: 36
V5CG提示您:本文由jxp2002发表,如需商业用途或转载请与jxp2002联系授权,谢谢配合!
jxp2002
积分:19
最新注册
01.jpg

一个TAB选项卡界面的代码
  1. --Destroy the dialog if it is already open
  2. try(destroyDialog testR)catch()

  3. --Create a rollout
  4. rollout testR "Test" width:300
  5. (
  6. --Add a dot net tab control
  7. dotNetControl tabs "system.windows.forms.tabControl" width:(testR.width-30) height:25
  8. --Add a sub rollout.
  9. subRollout subRoll "Sub" width:(testR.width-30) height:80 offset:[0,-5]

  10. --Function to show all properties, methods and events for any dotNet object
  11. fn showProps obj=
  12. (
  13.   clearListener()
  14.   format "Properties:\n"
  15.   showProperties obj
  16.   format "\nMethods:\n"
  17.   showMethods obj
  18.   format "\nEvents:\n"
  19.   showEvents obj
  20. )

  21. --Add rollouts to the subRollout based on which tab is currently selected.
  22. fn addTabRollout index=
  23. (
  24.   --Remove any existing rollouts first.
  25.    for x in subRoll.rollouts do removeSubRollout subRoll x
  26.   
  27.   sub=case index of
  28.   (
  29.    default:
  30.    (
  31.     rollout sub01 "Sub 01"
  32.     (
  33.      button testBt "test Button"
  34.      on testBt pressed do (messageBox "You pressed the button" title:"Alert!")
  35.     )
  36.    )
  37.    1:
  38.    (
  39.     rollout sub01 "Sub 02"
  40.     (
  41.      button testBt "test Button"
  42.      on testBt pressed do (messageBox "You pressed the button" title:"Alert!")
  43.     )
  44.    )
  45.    2:
  46.    (
  47.     rollout sub01 "Sub 03"
  48.     (
  49.      button testBt "test Button"
  50.      on testBt pressed do (messageBox "You pressed the button" title:"Alert!")
  51.     )
  52.    )
  53.   )
  54.   addSubRollout subRoll sub
  55. )

  56. --Tab initilization function.
  57. fn initTabs tab labels:#() =
  58. (
  59.   --Clear any existing tabs incase we do an update of them at some point.
  60.   tab.tabPages.clear()
  61.   --Set the size mode so that we can control their width.
  62.   tab.sizeMode=tab.sizeMode.fixed
  63.   --Set the width of every tab.
  64.   tab.itemSize=dotnetObject "System.Drawing.Size" ((tab.width/labels.count)-2) 25
  65.   
  66.   --Loop through all the labels that we pass to the function and add a tab by the same name.
  67.    for x in labels do tab.tabPages.add x
  68. )

  69. --When the mouse button is released on a tab get the selected tab and pass it to our addTabRollout function.
  70. on tabs MouseUp senderArg arg do
  71. (
  72. --   showProps arg
  73.   addTabRollout senderArg.SelectedIndex
  74. )

  75. --When the rollout opens initilize the tab control
  76. on testR open do
  77. (
  78. --   showProps tabs
  79.   
  80.   initTabs tabs labels:#("Main", "Settings", "User")
  81.   addTabRollout 0
  82. )
  83. )
  84. --Create the dialog
  85. createDialog testR
复制代码
加入土豪吧,爽!
Modo -2013-12-17 13:46:03 | 显示全部楼层
楼主,你从来不用熬夜的吧!
风云男子 -2013-12-17 16:07:54 | 显示全部楼层
找到榜样了~
无药可救 -2013-12-18 14:17:42 | 显示全部楼层
小手一抖,积分到手!不过这里没积分的我也顶楼主~我就是特地来顶楼主的!
sxyzy -2013-12-19 12:08:18 | 显示全部楼层
淡定,淡定,淡定……
~太傻~ -2013-12-19 15:50:31 | 显示全部楼层
简洁,明了,然后执行效率还很高。这样的代码就是我们应该追求的吧?我估计
獨絔へ凊戨 -2013-12-19 21:04:18 | 显示全部楼层
楼主你为什么放弃治疗?院里哪个大夫把你放出来的?
慕朵朵 -2013-12-20 10:51:28 | 显示全部楼层
真是郁闷啊!
dopost -2013-12-20 12:03:37 | 显示全部楼层
这个还不错!!!
shenyg -2013-12-20 15:00:31 | 显示全部楼层
坐等教程啊。谢谢
wzh789 -2013-12-20 16:38:19 | 显示全部楼层
楼主,你从来不用熬夜的吧!
迷失在寂寞中 -2013-12-20 21:34:35 | 显示全部楼层
过来看看的,喜欢
陌上纤虹 -2013-12-20 21:55:19 | 显示全部楼层
我楼主朋友,我就是特地来顶楼主的!,嘿嘿
liujjun -2013-12-21 15:42:32 | 显示全部楼层
谢谢楼主
TACO -2013-12-21 20:49:22 | 显示全部楼层
楼主,你从来不用熬夜的吧!
粒砂 -2013-12-22 15:49:44 | 显示全部楼层
请教下楼主,这个是用什么做的啊?
喜多多 -2013-12-23 10:13:06 | 显示全部楼层
沙发!沙发!
chriszg -2013-12-23 11:39:36 | 显示全部楼层
小伙子很不错
Pisces -2013-12-23 13:40:51 | 显示全部楼层
哈。。 看到了。。。 多交流哈。
sunkezai -2013-12-23 15:42:19 | 显示全部楼层
我是个凑数的。。。
神仙姐姐 -2013-12-23 17:26:53 | 显示全部楼层
感谢V5CG提供这么多机会,我相信会越来越好的
jydg -2013-12-23 17:41:58 | 显示全部楼层
现在的程序越来越狂了。
天成1 -2013-12-24 16:43:32 | 显示全部楼层
楼主你为什么放弃治疗?院里哪个大夫把你放出来的?
midea2 -2013-12-24 17:22:44 | 显示全部楼层
路过,支持一下啦
FOFO -2013-12-24 19:05:09 | 显示全部楼层
哈。。 看到了。。。 多交流哈。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则