views:

39

answers:

2

i want measuring tool in project that will be same as measure it in firefox(add-on) how to do this.

A: 

--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.
KMan
@KMan he is asking for a similar implementation of that addon in C#. Not developing extensions in Firefox.
blntechie
@bintechie: nevermind.. I get it now; he wants something of similar sort in C#!
KMan
yes i dont want to add it to firefox
girish
@Girish: I updated my answer accordingly.
KMan
A: 

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.

Oliver