IDL编写程序启动等待界面.doc

上传人:scccc 文档编号:13588299 上传时间:2022-01-19 格式:DOC 页数:7 大小:130.50KB
返回 下载 相关 举报
IDL编写程序启动等待界面.doc_第1页
第1页 / 共7页
IDL编写程序启动等待界面.doc_第2页
第2页 / 共7页
IDL编写程序启动等待界面.doc_第3页
第3页 / 共7页
亲,该文档总共7页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《IDL编写程序启动等待界面.doc》由会员分享,可在线阅读,更多相关《IDL编写程序启动等待界面.doc(7页珍藏版)》请在三一文库上搜索。

1、很多时候程序启动时需要花一定的时间进行界面初始化、配置文件读 取等操作,需要用户等待,此时如果有个带漂亮图片或程序版权信息的界面在那 放着会让人感觉程序启动中,马上就起来了。从IDL实现上讲,无非就是显示一个不带菜单,不带标题栏的 widget_base,里面显示了一张图片。- 下面以一个常规的界面程序为例,注意代码中的调用部分。启动界面程序主界面代码如下:;$ld: show_splash_scree n.pro 4 2008-01-30 21:13:44Z mpiper $ +J;Shows an image without a win dow border on the scree n.

2、J;returns widget identifier of top-level base;param image in type=2 or 3 dime nsional array an image to;display;keyword true in opti on altype=in teger, 0-3default=0 order of;ban ds, 0 if 8-bit image;keyword order in opti on altype=boolea n orie ntati on of image;keyword title in opti on altype=stri

3、 ng title of win dow to;display in iconJ ;启动界面fun cti on show_splash_scree n, i mage, true=true, order=ordercompile_opt idl2on _error, 2true_local = n _eleme nts(true) eq 0 ?0 : truesz = size(image, /structure)if (true_local eq 0 and sz.n,_dimensions ne 2) then $message, TRUE keyword must be set to

4、1,2, 3 $+ for 24-bit imageif (true_local ne 0 and sz.n,_dimensions ne 3) then $message, TRUE keyword must be set to 0 for 8-bit imagexi nd = (true_local ne 1) ? 0 : 1yi nd = (true_local eq 0) or (true_local eq 3) ? 1 : 2;屏幕分辨率计算device, get_scree n_size=scree n_size;界面偏移量xoffset = (scree n_size0 - sz

5、.dime nsion sx in d) / 2yoffset = (scree n_size1 - sz. dime nsio nsyi nd) / 2tlb = widget_base(tlb_frame_attr=4, /column, $xpad=0, ypad=0, xoffset=xoffset, yoffset=yoffset)draw = widget_draw(tlb, xsize=sz.dime nsion sx in d, $ysize=sz.dime nsionsyin d)widget_co ntrol, tlb, /realizewidget_co ntrol, d

6、raw, get_value=windwset, windtv, image, true=true_local, order=keyword_set(order)return, tlbend;启动界面示例代码Jpro splash_example;读取启动界面要显示的数据file = filepath(rose.jpg, SUBDIRECTORY=examples,data)data = read_image(file);开始启动界面*splash_base = show_splash_scree n( data,/true)J;创建程序内容,初始化界面、程序、数据等,注意,程序界面的tlb先

7、是要隐藏的tlb = WIDGET_BASE($/column, $map = 0,$ ;隐藏mbar =result,$title =test_butto n)JWIDGET_CONTROL,tlb,/realizemenu = WIDGET_BUTTON(result, value =文件(&F)fmenu = WIDGET_BUTTON(me nu, value = V打开);menu关键字mMe nu = WIDGET_BUTTON(me nu, value =进入,/me nu)tMenu = WIDGET_BUTTON(mMe nu, value 二二级,/me nu)separa

8、tor 关键字eMenu = WIDGET_BUTTON(menu, value 二退出,/SEPARATOR)ubase = WIDGET_BASE(tlb,/row)dbase = WIDGET_BASE(tlb,/row,/frame)Jb = WIDGET_BUTTON(ubase,value =按钮,tooltip = 创建的 button)b = WIDGET_BUTTON(ubase,value =菜单,$tooltip = 菜单加对号)h = WIDGET_BUTTON(ubase,value = BINDGEN(2,40)Jbit =WIDGET BUTTON(ubase,v

9、alue =filepath(colorbar.bmp,SUBDIRECTORY=resource,bitmaps),/bitm ap);单选 butt onexbase = WIDGET_BASE(dbase,/EXCLUSIVE,/colum n, /frame)eb1 = WIDGET_BUTTON(exbase,valu=对,uName = right,/NO_RELEASE ) eb2 = WIDGET_BUTTON(exbase,valu=错,uName = error,/NO_RELEASE ) ;选择第一个按钮widget_co ntrol,eb1,/SET_BUTT On;复

10、合选择buttonn exbase = WIDGET_BASE(dbase,/NONEXCLUSIVE,/colum n)eb1 = WIDGET_BUTTON( nexbase,value =e nvi)eb2 = WIDGET_BUTTON( nexbase,value =idl);选择第一个按钮widget_co ntrol,eb1,/SET_BUTT On;创建显示组件wDraw = Widget_Draw(tlb,xsize = 600,ysize = 400);等待2秒wait,2;销毁启动界面*Widget_c on trol, splash_base,/destroy;计算界面

11、居中;屏幕分辨率计算device, get_scree n_size=scree n_sizegeo Info = widget_i nfo(tlb,/geo);界面偏移量xoffset = (scree n_size0 - geo In fo.xSize) / 2 yoffset = (scree n_size1 - geo In fo.ySize) /2 Widget_Co ntrol,tlb, xoffset = xoffset, $ yoffset = yoffset;显示程序主界面widget_co ntrol,tlb,/map;后面其他功能代码end知识点总结:1、界面组件布局;2、菜单、按钮(单选、复选)按钮;3、启动界面;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1