我正在尝试以编程方式将SWT按钮设置为“按下”状态。 这是可能的吗?以编程方式将SWT按钮设置为按下状态?
更新:
我所试图实现 - 被渲染绘制按钮,在它的选中状态到一个图像。
Image buttonimg_mouseover = new Image(getDisplay(), 100, 100);
Button button = new Button(parent.parent, SWT.PUSH);
button.setAlignment(SWT.CENTER);
button.setImage(arrowimg);
button.setSize(100, 100);
button.setSelection(true); // doesn't work
GC gcbutton = new GC(buttonimg_mouseover); //draw an image of the button
button.print(gcbutton);
您是否需要将其置于“按下”状态,还是要运行它所连接的动作? – sciguy1121
我只想渲染处于按下状态的按钮,一次 - 我不想触发相关的方法。 – Skip
按钮有哪些样式位? 'SWT.PUSH','SWT.CHECK','SWT.TOGGLE'或其他什么? – Baz