在 Silverlight 中以编程方式设置 TranslateX 或 Canvas.SetLeft 属性
所以问题是,我试图让那个圆圈与数字对齐。当我在混合中执行此操作时,它显示我有一个 Left (23),我尝试以编程方式执行此操作 Canvas.SetLeft(thePanel,23) 它会超出。更好的是,如果有人知道 silverlight 中有这样的控件,请告诉我。其作用是,当用户单击一个数字时,绿色圆圈会转到该数字,因此看起来用户已选择它。
So Here is the Problem, I am trying to get that circle to align on the number. When I do that in blend it shows me I have a Left (23), I try to do that programmaticly Canvas.SetLeft(thePanel,23) it overshoots. Better yet, if anyone knows of a control like this in silverlight let me know. What this does is when the user clicks on a number the green circle is suppose to go to that number so it looks like the user has selected it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Circle 对象上,您必须设置圆的 Radius 和 TranslateTransform 属性。假设您的圆的半径为 15:
以及处理圆的 X 和 Y 坐标的属性,
在 Silverlight 中,您可以获取用户在画布上单击的位置,在面板的单击事件上设置此代码,然后设置圆心到用户单击的位置:
现在,如果您希望它们始终落在固定位置,您可以设置条件,如果用户单击某个数字,则将圆心设置为该数字的中心数字,或者只是更改圆的 X 值以移动到所需的位置。
On your Circle object you have to set the Radius of the circle and the TranslateTransform attribute. Lets say your Circle has a radius of 15:
and properties to handle the Circle's X and Y coordinates,
and in Silverlight you can get where the user has clicked on a Canvas, setting this code on the Click Event of the panel, and set the center of the circle to where the user has clicked:
Now, if you want them to always fall in fixed positions, you can set conditions that, if a user clicks around a number, then set the center of the circle to the center of the number, or just change the X value of your circle to move to the desired position.