在C#中获取Windows窗体上元素的确切位置 [英] get the exact location of element on the windows form in c#

查看:399
本文介绍了在C#中获取Windows窗体上元素的确切位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)我正在尝试获取列表框项目的确切位置(x和y坐标)

是否有任何方法可用于检索Windows窗体上项目的确切位置
请告诉我...
我有2个列表框,其中包含项目
当我将一个项目从listbox1拖到listbox2时,我想在两个我无法做的项目之间画线
如果我得到拖放的项目的位置,则可能是可行的.

1)I am trying to get the exact location(x and y coordinate) of a listboxitem

Is there any method that can be used to retrive the exact location of item on windows form
please tell me...
I have 2 listboxes which contains items in it
when i drag a item from listbox1 to listbox2 i want to draw line between two that draged and dropped item which i am unable to do
and can be possible if i get the position of dragged and dropped item

推荐答案

if control id is txtbox
int x =txtbox.Location=Location.X //for x axis
int y=txtbox.Location=Location.Y //for y axis


这篇关于在C#中获取Windows窗体上元素的确切位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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