如何在Windows窗体上显示标尺? [英] how can i show a ruler on my windows form?

查看:91
本文介绍了如何在Windows窗体上显示标尺?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了显示模拟,我想在表格上放一把尺子.

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?

推荐答案

据我所知,标尺只是视觉元素.通过System.Windows.Forms.Control的子类来实现,重写其OnPaint方法进行渲染,根据父控件的大小进行渲染,在调整大小时调用Ruler实例的System.Windows.Forms.Control.Invalidate,演示选项修改以及所有其他事件,其中此控件的循环应更改.

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

—SA
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


尝试
MSDN- [Form.Scale方法] [ ^ ]
进一步参考
MSDN- [Windows窗体中的自动缩放] [ ^ ]
要裁剪或缩放图像,您可以阅读
MSDN- [如何:裁剪和缩放图像] [ ^ ]
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 ][^]


您应该使用Picturebox,但我不知道ToolBox上有任何可行的工具.也许您应该搜索API
You should use Picturebox for it i dont know any workable tool for you on ToolBox.Maybe you should search for an API


这篇关于如何在Windows窗体上显示标尺?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆