Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For showing simulation, i want to put a ruler on my form. is there any tool avalaible or i have to put an image of ruler?
Posted
Updated 4-Nov-11 15:08pm
v3

You should use Picturebox for it i dont know any workable tool for you on ToolBox.Maybe you should search for an API
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 4-Nov-11 19:38pm    
And yes, never use PictureBox -- it can be used in principle but won't add any functionality compared to just Control with OnPaint; using PictureBox is a known common mistake.
--SA
SercanOzdemir 4-Nov-11 19:45pm    
If it is so necessary than always you can use it.No problem!
As I can understand, the Ruler is just a visual element. Make it by sub-classing of System.Windows.Forms.Control, override its OnPaint method for rendering, make rendering depending on the size of a parent control, call System.Windows.Forms.Control.Invalidate of your Ruler instance when resizing, presentation option modification and all other events where the loop of this control should be changed.

See http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Wonde Tadesse 4-Nov-11 21:06pm    
5+ for your answer
Sergey Alexandrovich Kryukov 4-Nov-11 21:15pm    
Thank you, Wonde.
--SA
Sweety Khan 6-Nov-11 4:50am    
thanx but still i dont understand from where i should start
Try
MSDN-[Form.Scale Method][^]
For further Reference
MSDN-[Automatic Scaling in Windows Forms] [^]
To Crop or Scale Images you can read
MSDN-[How to: Crop and Scale Images ][^]
 
Share this answer
 
Comments
Sweety Khan 4-Nov-11 15:20pm    
not this scaling. i mean ruler
RaviRanjanKr 4-Nov-11 15:26pm    
so you should edit your question and must have define about ruler. whatever You can go through this -[ http://www.codeproject.com/KB/miscctrl/ruler.aspx ] article which might help you to learn how to Implement it.
Sergey Alexandrovich Kryukov 4-Nov-11 19:36pm    
I think the question is clear enough in first place -- I provided a solution, please see.
--SA
Wonde Tadesse 4-Nov-11 21:06pm    
5+ for reference.
RaviRanjanKr 5-Nov-11 2:21am    
Thanks Wonde :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900