本文介绍了如何使用带小数或双精度的标签位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

当我在标签位置工作时遇到问题,我正在使用以下框架:x = vt + x0和y = 1/2 * a * t + v0 * t + y0
因为我使用的T很小,所以其中的x或y大部分时间都小于1(例如0.76).我正在使用这些框架来更改标签的位置,但是它不起作用,因为我应该在以下代码中写一个int:label1.Location = new point(intA,intB);

但是x,y是双精度或十进制.我该如何解决此问题,我的意思是还有其他代码可以更改标签的位置,但可以使用双精度或十进制或其他方式来解决此问题吗?

我之前问过这个问题,但我知道没有什么可以将点用作小数.
所以我想要它,因为我想创建一个运动模拟"项目.我确定您已经在一些电视游戏中看过这些项目..他们如何用哪种代码编写它们?

谢谢
doostl;)

Hi everybody!

when i worked with a label location i faced with a problem, i was working with these frames : x = vt + x0 and y = 1/2 * a * t + v0 * t + y0
that in it the x or y are most of the time less than 1 (e.g 0.76) because the T that i used was so small . i was using these frames to change the location of a label but it doesn''t work because i should write a int at this code : label1.Location = new point (intA , intB);

but the x , y was a double or a decimal . how can i solve this problem , i mean is there any other code to change the location of a label but gets a double or a decimal or other way to solve this?

I asked this question before and I understood there is no what to use a point as a decimal.
So I want it because I wanted to make a "Motion Simolation" Project. I am sure you''ve seen these project in some tv games or so.. How they write them with which kind of code??

thanks
doostl ;)

推荐答案



label.Location = new Point((int)x, (int)y);
// or
label.Top = (int)y; label.Left = (int)x;



但是,当x和y大约为0时,这将导致标签不移动.



But when x and y are around 0 this will result in a non moving label.


这篇关于如何使用带小数或双精度的标签位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 04:48