快速业务通道

开发Eclipse自定义控件 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-19
?????? endLine??=??getItemCount(); ???? for??(int??i??=??beginLine;??i??<??endLine;??i++)??{ ?????? boolean; ?????? if??(i??==??rowSel) ?????? selected??=??true; ?????? onPaint(gc,??i,??cx,??beginy??+??(i??-??beginLine)??*??lineHeight, ???????? selected); ???? } ???? } ?? });

?aà?òa×¢òaμ?ê?′óPaintEvent?D??è?μ?x,y,height,widthê?Dèòa????μ???óò£?x,yê?ò????tμ?×óé????a?-μ?μ?×?±ê?£?ú?ò??μ?3ìDò?D£??aá?D??ü?e??£??ò???è?ù?YDèòa????μ???óò????3?Dèòa????μ?DDêy£????????àó|μ?DD£???2?ê??????????t?????£?ò??3ìDò?Dó?μ?μ?onPaintó?óú????ò?DD?£

?ó??à′£??ò??òaè??ò??μ????t?ìó|?ü?ìé????ü??áD±í????DD?????£?ò??ò????òé??üμ?′|àí?aày£?ê×?èμ±ó??§°′á??òé??üê±£??ò??Dèòa??±?????£?2¢?ò?????éμ?oíD?μ????????£è?1???????ò??-μ?á?áD±íμ??¥2?£??ò???1Dèòaí?ê±1??ˉ1??ˉì??£

addListener(SWT.KeyDown,??new??Listener()??{ ???? public??void??handleEvent(Event??event)??{ ???? switch??(event.keyCode)??{ ???? case??SWT.ARROW_UP:??//??′|àí?òé??ü ?????? if??(rowSel??!=??0)??{ ?????? oldRowSel??=??rowSel; ?????? rowSel--; ?????? if??(oldRowSel??!=??rowSel)??{??//·¢?í???¢è????t???? ???????? ((Canvas)??event.widget).redraw(cx,??(rowSel??+??cy ?????????? /??lineHeight) ?????????? *??lineHeight,??maxX,??lineHeight*2,??false); ?????? } ?????? if??(rowSel??<??-cy??/??lineHeight)??{??//è?1?Dèòa£?1??ˉ1??ˉì? ???????? ScrollBar??bar??=??((Canvas)??event.widget) ?????????? .getVerticalBar(); ???????? bar.setSelection(bar.getSelection()??-??lineHeight); ???????? scrollVertical(bar); ?????? } ?????? selectionChanged();??//??·¢?íselectionChangedê??t ?????? } ?????? break; ???? case??SWT.ARROW_DOWN:??//??down??arror??key ?????? … ?????? break; ???? } ???? } ?? });

?a·¢Eclipse×??¨ò????t(3)

ê±??:2011-02-09 IBM áo?1

?ó??à′£??ò??òaè??ò??μ????t?ìó|êó±ê??áD±í????DD?????£ê×?è?ò??òa????3?êó±ê???Dμ?DDo?£?×¢òaMouseEvent?Dμ?y?μ??ê??à??óú???t×óé???μ?×?±ê£??ò??Dèòa?óé?1??ˉ3?á????tμ?2?·??£

addMouseListener(new??MouseListener()??{ ???? public??void??mouseDoubleClick(MouseEvent??e)??{ ???? } ???? public??void??mouseDown(MouseEvent??e)??{ ???? int??row??=??(e.y??-??cy)??/??lineHeight;??//???????Dμ?DD ???? if??(row??>=??0)??{ ?????? oldRowSel??=??rowSel; ?????? rowSel??=??row; ???? } ???? if??(oldRowSel??!=??rowSel)??{??//?????-?éμ?oíD?μ??????? ?????? ((Canvas)??e.getSource()).redraw(cx,??(e.y??/??lineHeight) ???????? *??lineHeight,??maxX,??lineHeight,??false); ?????? ((Canvas)??e.getSource()).redraw(cx,??(oldRowSel??+??cy ???????? /??lineHeight) ???????? *??lineHeight,??maxX,??lineHeight,??false); ???? } ???? selectionChanged(); ???? } ???? public??void??mouseUp(MouseEvent??e)??{ ???? } ?? });

μ±?ò??μ????t??μ??1μ?ê±£????Dμ?áD±í??DèòaóDDé?ò±íê????tμ?μ??1μ??£μ±??μ??òê§è¥?1μ?ê?£??ò???aà???Dèòa?òμ¥μ?í¨?a???Dμ??????-?£

addFocu

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号