开发者

How can I develop scale like measure it add on in Firefox

I want measuring tool in project that will be same as measure it in Firefox (add-on). How to开发者_运维技巧 do this?


To get such a think to work you'll need an application that runs as a tray icon or something like that. Then you open your application and tell him, that you'd like to measure.

Now, you'll go and put a transparent window onto the whole screen(s) and wait for a mouse move event. Within the mouse move event, you'll check the mouse button state. If it is going to be hit you know the starting position and you can draw some kind of user-control at this position and if the user releases the mouse button, you're going to stop the resizing of your user-control.

The user-control itself should be semi-transparent and checking for the resizing and/or paint events, to draw the ruler lines around the border.

Last but not least you can show some kind of tooltip or labelcontrol in relation to the position and size of your user-control and screen bounds to give some status informations.

To get a good starting point about how to get the transparent overlay part done, you can take a look into ObjectListView Overlay.


--EDIT--

One solution could be:

  1. Create a separate transparent windows form
  2. Upon certain key press, for instance Ctrl+Shift+R, show your app with lower transparency level; so that user can see the background.
  3. Draw ruler upon form load
  4. You may allow user to move the ruler window with mouse click.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜