0
我看到一個eclipse編輯器(e4 css spy),它圍繞打開的shell繪製一個小框架。
它在屏幕上繪製框架,過度炮彈。
邊框留在屏幕上,當貝殼移開時。在屏幕上使用java swt在外殼上繪圖?
我應該使用什麼API直接在屏幕上繪製,沒有窗口?
我看到一個eclipse編輯器(e4 css spy),它圍繞打開的shell繪製一個小框架。
它在屏幕上繪製框架,過度炮彈。
邊框留在屏幕上,當貝殼移開時。在屏幕上使用java swt在外殼上繪圖?
我應該使用什麼API直接在屏幕上繪製,沒有窗口?
它創建了一個新的非矩形外殼:
Shell selectedShell = ... get the shell to highlight
Rectangle bounds = .. get bounds relative to absolute display
// create the highlight; want it to appear on top
Shell highlight = new Shell(selectedShell, SWT.NO_TRIM | SWT.MODELESS | SWT.NO_FOCUS | SWT.ON_TOP);
highlight.setBackground(display.getSystemColor(SWT.COLOR_RED));
Region highlightRegion = new Region();
highlightRegion.add(0, 0, 1, bounds.height + 2);
highlightRegion.add(0, 0, bounds.width + 2, 1);
highlightRegion.add(bounds.width + 1, 0, 1, bounds.height + 2);
highlightRegion.add(0, bounds.height + 1, bounds.width + 2, 1);
highlight.setRegion(highlightRegion);
highlight.setBounds(bounds.x - 1, bounds.y - 1, bounds.width + 2, bounds.height + 2);
highlight.setEnabled(false);
highlight.setVisible(true); // not open(): setVisible() prevents taking focus
從org.eclipse.e4.tools.css.spy.CssSpyDialog
取出並重新格式化爲清晰。