椭圆的变化x/y-coordinate
Change x/y-coordinate of ellipse
作为一个更大项目的一部分,我正在尝试弄清楚如何移动一个对象(在本例中为椭圆)。这是我的代码中给我带来麻烦的部分:
//updating the position of the ellipse
let updatePoints (form : Form) (coords : vector3Dlist ) dtheta showtime =
let mutable fsttuple = 0
let mutable sndtuple = 0
for i in 0..coords.Length-1 do
fsttuple <- (int (round (fst coords.[i])))
sndtuple <- (int (round (snd coords.[i])))
(fillEllipseform.Paint.Add(fun draw->
let brush=new SolidBrush(Color.Red)
draw.Graphics.FillEllipse(brush,fsttuple,sndtuple,10.0f,10.0f)))
form.Refresh ()
该函数使用坐标列表来获取新的 x 和 y 值。这给了我语法错误 "possible overload"。我想我想做这样的事情:
fillEllipseform.X <- fsttuple
我该如何更改 x/y-coordinates?当涉及到椭圆时,.NET 库对于 F# 示例非常有限。
您的问题是 FillEllipse
需要一个 Brush
,然后是 4 个 int
或 4 个 float32
。目前您传递的是混合物,因此不确定选择哪个重载。
如果您选择 float32
并且没有四舍五入(不确定 vector3Dlist
的类型是什么),那么工作版本将如下所示:
//updating the position of the ellipse
let updatePoints (form : Form) (coords : vector3Dlist ) dtheta showtime =
let mutable fsttuple = 0.0f
let mutable sndtuple = 0.0f
for i in 0..coords.Length-1 do
fsttuple <- fst coords.[i]
sndtuple <- snd coords.[i]
(fillEllipseform.Paint.Add(fun draw->
let brush=new SolidBrush(Color.Red)
draw.Graphics.FillEllipse(brush,fsttuple,sndtuple,10.0f,10.0f)))
form.Refresh ()
作为一个更大项目的一部分,我正在尝试弄清楚如何移动一个对象(在本例中为椭圆)。这是我的代码中给我带来麻烦的部分:
//updating the position of the ellipse
let updatePoints (form : Form) (coords : vector3Dlist ) dtheta showtime =
let mutable fsttuple = 0
let mutable sndtuple = 0
for i in 0..coords.Length-1 do
fsttuple <- (int (round (fst coords.[i])))
sndtuple <- (int (round (snd coords.[i])))
(fillEllipseform.Paint.Add(fun draw->
let brush=new SolidBrush(Color.Red)
draw.Graphics.FillEllipse(brush,fsttuple,sndtuple,10.0f,10.0f)))
form.Refresh ()
该函数使用坐标列表来获取新的 x 和 y 值。这给了我语法错误 "possible overload"。我想我想做这样的事情:
fillEllipseform.X <- fsttuple
我该如何更改 x/y-coordinates?当涉及到椭圆时,.NET 库对于 F# 示例非常有限。
您的问题是 FillEllipse
需要一个 Brush
,然后是 4 个 int
或 4 个 float32
。目前您传递的是混合物,因此不确定选择哪个重载。
如果您选择 float32
并且没有四舍五入(不确定 vector3Dlist
的类型是什么),那么工作版本将如下所示:
//updating the position of the ellipse
let updatePoints (form : Form) (coords : vector3Dlist ) dtheta showtime =
let mutable fsttuple = 0.0f
let mutable sndtuple = 0.0f
for i in 0..coords.Length-1 do
fsttuple <- fst coords.[i]
sndtuple <- snd coords.[i]
(fillEllipseform.Paint.Add(fun draw->
let brush=new SolidBrush(Color.Red)
draw.Graphics.FillEllipse(brush,fsttuple,sndtuple,10.0f,10.0f)))
form.Refresh ()