vb.net中的尺寸线 [英] dimension lines in vb.net
问题描述
嗨
我正在尝试构建如下的小应用程序
Picturebox 1024,768
鼠标按下事件[激活开始图形]
鼠标移动事件[绘制橡皮筋线]
鼠标上移事件[实际上画出界线]
用户在鼠标移动事件中拉线时出现问题
我希望显示尺寸线,例如:| --------- 1.00米--------- ||
或其部分| --------- 0.010米---------- |
我将picbox.clientrectangle.height分为25
therfor允许绘制25线性米的线
问题是当我将鼠标中的线向下拖动时,增量为
到高,我需要它增加毫米数
但是我只有40个像素才能增加1000英里,所以这行不通
显然有一种解决方法,否则就不会有cad等程序
请有人指教
谢谢
约翰< small</small><<<<></big>
Hi
I am trying to build a small application as follows
Picturebox 1024,768
Mouse down event [activate start drawing]
Mouse move event [draw rubberband line]
Mouse up event [actually draw the line]
Problem as the user pulls the line in the mouse move event
i wish to display a dimension line eg: |---------1.00 metre---------|
or parts thereof |---------0.010 metre----------|
I have divided the picbox.clientrectangle.height into 25
therfor allowing a 25 linear metres line to be drawn
the problem is as i drag the line in the mouse down the increments are
to high i need it to increment by millimetres
but i have only 40 pixels to increment 1000 miilmetres so this wont work
there is obviously a way around this else there wouldnt be programes like cad etc
please can someone advise
thanks
john<small></small><<big></big>
推荐答案
首先,我放弃了这张图片框,然后处理您自己的绘画事件.图片框无法帮助您. CAD之类的程序缺少某些东西-可以将像素转换为毫米的比例.除非确定一毫米中有多少像素,否则无法执行此操作.一旦有了它,任何程序都不能以小于一个像素的值递增,则鼠标位置将以整数形式给出.我猜想CAD程序要比您使用更多的像素.
First of all, I''d ditch the picture box and just handle your own paint event. The picture box is not helping you. A program like CAD has something you lack - a scale that turns pixels in to mm. Until you decide how many pixels in a mm, there''s no way to do this. Once you have that, no program can increment by values less than one pixel, your mouse position is given in whole numbers. I guess the CAD program has more pixels to work with than you do.
这篇关于vb.net中的尺寸线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!