VB6:星形点的颜色部分

发布于 2024-08-02 23:56:45 字数 363 浏览 2 评论 0原文

我找到了使用VB6绘制星星的API函数:我需要的是根据数据驱动的参数对星星的每个点的部分进行着色:因此,如果传递的参数是1,我想对所选星星的部分进行着色红点直至其长度的 1/10(从恒星围绕的圆的周长开始测量);如果是 2、星点绿色的 2/10 等。

我找到了 API 函数 CreatePolygonRgn 因此我可以更改特定星点的整体颜色,但对如何仅使用一个 X 和 Y 参数定义多边形感到困惑:如果我更改 X 和对于给定的星点,我得到的结果似乎没有意义 TKIF 查尔斯·吉奇

I have found API functions to draw a star using VB6: what I need is to colour sections of each point of the star according to data-driven parameters: thus if the parameter passed is 1, I want to colour the part of the selected star point red up to 1/10th of its length measured from the circunference of the circle around which the star is built; if 2, 2/10ths of the star point green, etc.

I have found the API function CreatePolygonRgn so I can change the colour of the whole of a particular star point but baffled as to how a polygon can be defined using only one X and Y parameter: if I change the X and Y for a given star point, I get results that don't seem to make sense
TKIF
Charles Geach
se

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌化 2024-08-09 23:56:45

优秀的 vbAccelerator 提供了一些 VB6 代码。我自己没有测试过这个。请注意,points() 是一个数组,尽管它看起来好像您只传递了第一个元素,但实际上您是在向 API 调用授予对 >整个数组。 CreatePolygonRgn 的第一个参数不是单个参数点,而是点的数组。

我希望这可以帮助您了解正在发生的事情,并且您可以编写您的明星代码。

Type POINTAPI
  X As Long
  Y As Long
End Type
Declare Function CreatePolygonRgn Lib "gdi32" _
  (lpPoint As POINTAPI, ByVal nCount As Long, _
   ByVal nPolyFillMode As Long) As Long

Sub Test()
  Const ALTERNATE = 1 ' ALTERNATE and WINDING are '
  Const WINDING = 2   ' constants for FillMode. '

   Dim points(1 To 5) as POINTAPI
   ' fill in points .. '
   CreatePolygonRgn(points(1), 5, WINDING)
End Sub

The excellent vbAccelerator gives some VB6 code. I haven't tested this myself. Be aware that points() is an array, and even though it looks like you are only passing the first element, you are actually giving the API call access to the whole array. The first argument to CreatePolygonRgn is not a single point, but an array of points.

I hope that helps you understand what's going on, and you can get your star code written.

Type POINTAPI
  X As Long
  Y As Long
End Type
Declare Function CreatePolygonRgn Lib "gdi32" _
  (lpPoint As POINTAPI, ByVal nCount As Long, _
   ByVal nPolyFillMode As Long) As Long

Sub Test()
  Const ALTERNATE = 1 ' ALTERNATE and WINDING are '
  Const WINDING = 2   ' constants for FillMode. '

   Dim points(1 To 5) as POINTAPI
   ' fill in points .. '
   CreatePolygonRgn(points(1), 5, WINDING)
End Sub
只涨不跌 2024-08-09 23:56:45

我不想乱搞 API 调用,而是想建议一种替代方案。在我看来,您(最多)将拥有 11 个外观不同的星星(0 到 10)。如果这是我的项目,我会使用您选择的图形应用程序创建 11 个图像。然后,根据变量的值,有选择地显示您想要的图像。

Instead of messing around with API calls, I would like to suggest an alternative. It sounds to me like you will have (at most) 11 different looking stars (0 to 10). If this were my project, I would create 11 images using a graphics application of your choice. Then, depending on the value of the variable, selectively show whichever image you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文