Click here to Skip to main content
15,878,945 members
Articles / Multimedia / GDI+
Article

Ruler Application

Rate me:
Please Sign up or sign in to vote.
3.43/5 (14 votes)
14 Sep 2004 127.4K   4.5K   48   8
Ruler tool application.

Sample Image - Ruler_Application.png

Introduction

This is a simple application for folks who are working on UI stuff. So you can measure and align your controls in Pixels, Inches and Centimeters.

Background

You can move it around the screen by simply dragging it, you can resize the ruler by pulling its edges, and you can flip it by double clicking it.

For further control over the application, use its context menu.

Using the code

Just open the project in Visual Studio, build it, and here you go, enjoy your measurements.

The code itself is pretty strait forwarded. Ruler_Paint - Paint event handler drawing the ruler in one of three flavors defined by Checked property of corresponding menu items. It also draws coordinates of the ruler and its length. Mouse event handlers are responsible for moving and resizing application window. Keyboard event handler allows additional control over the location and size of the window. And finally, each menu item has its own click routine.

The only dialog is About form. It has no logic whatsoever but just displaying some helpful information.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Dan Randolph20-Oct-21 12:05
Dan Randolph20-Oct-21 12:05 
QuestionDoubt in flip direction Pin
jinesh sam7-Nov-14 4:26
jinesh sam7-Nov-14 4:26 
AnswerRe: Doubt in flip direction Pin
Eugene Lepekhin7-Nov-14 5:58
Eugene Lepekhin7-Nov-14 5:58 
GeneralRe: Doubt in flip direction Pin
jinesh sam7-Nov-14 6:48
jinesh sam7-Nov-14 6:48 
GeneralSuggestion Pin
Radgar9-Sep-09 6:22
Radgar9-Sep-09 6:22 
GeneralJeff Key's Ruler tool Pin
Thomas Freudenberg14-Sep-04 22:12
Thomas Freudenberg14-Sep-04 22:12 
Somehow your tool reminds me of Jeff Key's Ruler tool[^]. Unsure | :~

Regards
Thomas


Disclaimer:
Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.

GeneralRe: Jeff Key's Ruler tool Pin
Jeffrey Scott Flesher27-Nov-04 19:56
Jeffrey Scott Flesher27-Nov-04 19:56 
GeneralMaybe rename to "Ruler Control" or "Rule Control" Pin
NormDroid14-Sep-04 21:30
professionalNormDroid14-Sep-04 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.