VB6:星形点的颜色部分
我找到了使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
优秀的 vbAccelerator 提供了一些 VB6 代码。我自己没有测试过这个。请注意,
points()
是一个数组,尽管它看起来好像您只传递了第一个元素,但实际上您是在向 API 调用授予对 >整个数组。 CreatePolygonRgn 的第一个参数不是单个参数点,而是点的数组。我希望这可以帮助您了解正在发生的事情,并且您可以编写您的明星代码。
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.
我不想乱搞 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.