如何获取VB.NET控件的坐标 [英] How do I get the coordinates of the VB.NET controls

查看:451
本文介绍了如何获取VB.NET控件的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我在vb.net上做一个结算应用程序。该帐单应印在一张6x10英寸的预打印纸上。我创建了一个vb.net表格,一些字段排列在不同的位置。这些字段应打印在预先打印的表格上的确切位置上在形式上。

实际上可以调整要打印的字段(即要在纸上打印的特定字段的位置)。如何获得每个控件的坐标值。问题是表格的大小不是真实世界纸张的大小。任何人请帮助我。

提前感谢。



我尝试过:



您好,我现在正在vb.net上进行结算申请。该帐单应印在一张6x10英寸的预打印纸上。我创建了一个vb.net表格,一些字段排列在不同的位置。这些字段应打印在预先打印的表格上的确切位置上在形式上。

实际上可以调整要打印的字段(即要在纸上打印的特定字段的位置)。如何获得每个控件的坐标值。问题是表格的大小不是真实世界纸张的大小。任何人请帮助我。

提前感谢。

Hi,now i'm doing a billing application in vb.net. the bill should be printed on a pre-printed sheet of size 6x10 inches.I have created a vb.net form and some fields were arranged in various position.These fields should be printed on the pre-printed sheet on the exact position where they were in the form.
Actually the field to printed can be adjusted (i.e. the position where the particular field to be printed on the paper).how to get the co-ordinate values of the each controls.The problem is the size of the form is not the size of real world paper.Anybody please help me.
thanks in advance.

What I have tried:

Hi,now i'm doing a billing application in vb.net. the bill should be printed on a pre-printed sheet of size 6x10 inches.I have created a vb.net form and some fields were arranged in various position.These fields should be printed on the pre-printed sheet on the exact position where they were in the form.
Actually the field to printed can be adjusted (i.e. the position where the particular field to be printed on the paper).how to get the co-ordinate values of the each controls.The problem is the size of the form is not the size of real world paper.Anybody please help me.
thanks in advance.

推荐答案

停止使用表单上的控件,并使用 PrintDocument类 [ ^ ] - 它允许y ou准确指定在哪里以及如何打印:颜色,位置,字体,粗体,方向......并且它直接用于所选打印机的纸张!
Stop using controls on a form, and use the PrintDocument class[^] instead - it allows you to specify exactly what goes where, and how it should be printed: color, location, font, boldness, direction, ... and it works on "directly" the paper for the selected printer!


您不需要控件的位置AT ALL。它们不会为你服务,实际上会妨碍你做什么。



按照Griff的建议,只需使用PrintDocument类,然后在你需要的地方准确地绘制文本。请注意,可能需要一些反复试验才能将每个字段准确地放在需要在页面上显示的位置。
You don't need the position of the controls AT ALL. They will serve you no purpose and actually hinder what you what be doing instead.

Follow Griff's advice and just use the PrintDocument class and draw the text exactly where you need it. Be warned, it may take some trial and error to get each and every field place exactly where it needs to go on the page.


这篇关于如何获取VB.NET控件的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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