c# 求实现图片定位的代码,单击一个文本框,picturebox空间的图片就定位在需要指定的位置

有windows应用程序上的代码吗?

<html>
<head>
<script tpye="text/javascript">
function MoveToMouseEvent()
{
var img = document.getElementById("img1");
alert(img.id+":"+event.x + "::" + event.y);
img.style.left = event.x +"px";
img.style.top = event.y +"px";
}

</script>
</head>
<body >
<input type="text" onclick="MoveToMouseEvent()"/>
<img id="img1" src="" style="width:100px;height:100px;position:absolute;"/>

</body>

</html>
你把img换成picturebox,位置你可以随便指定,这个例子是指定的鼠标出发事件的坐标
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-07-13
this.picturebox.Location = new Point(x, y);

X,Y 为你想要设置的坐标

WinForm

--------------c# Code----------------
相似回答