滚动条换肤问题
我正在我的 Flex 应用程序中剥皮滚动条,但遇到了一个问题。 滚动条之间的这个白色方块(查看图像)破坏了我所有的设计,我需要禁用它,使其不可见,更改它的背景颜色,alpha 或类似的东西。
我可以在这里粘贴一些代码,但我认为没有必要。 在 Flex 3 中工作。 有什么想法吗?
替代文本 http://img97.imageshack.us/img97/9206/scrollbar.png< /a>
I'm skinning scrollbar in my flex app and got one problem.
This white square between scrollbars(view the image) ruibs all my design and i need to disable it, make it invisible, change it background color, alpha or smth like this.
I can paste some code here but i think there is no need in it.
Working in Flex 3.
any ideas?
alt text http://img97.imageshack.us/img97/9206/scrollbar.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我实际上在 Flex 框架内部找到了罪魁祸首。
这个正方形(称为
whiteBox
)是在 Container.as 中创建的。摆脱它非常容易,您只需创建一个扩展您要使用的容器的类即可。
画布示例:
然后在您的 MXML 中:
...然后就不再有白色方块了;)
I actually found the culprit looking inside the Flex framework.
This square (called
whiteBox
) is created in Container.as.It's pretty easy to get rid of it, you just have to create a class extending the container you want to use.
Exemple for a Canvas :
Then in your MXML:
...and then no white square anymore ;)
您是否尝试过
在获取滚动条的容器上进行设置?它应该让容器的矩形拾取父级的颜色。
Have you tried setting
on the container that is getting the scrollbars? It should let the rect of the container pick up the color of the parent then.
一个肮脏的伎俩是使用遮罩来隐藏该方块。
像这样的:
刚刚尝试过,它有效。每次调整组件大小时,您只需重新绘制蒙版。最好的办法是创建一个扩展 Canvas 的自定义类并自行完成工作。
编辑:当然,如果值不同,您将需要根据自定义滚动条的权重更改“16”。
One dirty trick would be to use a mask to hide that square.
Something like this :
Just tried it, it works. You'll just have to redraw the mask each time the component is resized. Best thing would be to create a custom class which extends Canvas and do the job itself.
EDIT: Of course, you will want to change "16" by the weight of your custom scrollbars if the value is different.
您已经有了一个很好的答案,但另一种选择是手动管理滚动条。您可以将滚动条放置在应用程序中的任何位置,并将其绑定以滚动您想要的控件。这样做,您可以有效地让垂直滚动条拉伸那些额外的 16 个像素以覆盖白框。请注意,只有在保证始终需要滚动条的情况下我才会这样做。最终看起来会像我在这里绘制的非常糟糕的文字:
You already have a good answer but another alternative is to manually manage your scrollbars. You can put a scrollbar anywhere in your app and bind it to scroll the control you want. Doing this you could effectively get the vertical scroll bar to stretch those extra 16 pixels to cover the whitebox. Note that I would only do this if it were guaranteed to always need a scrollbar. Would kind of end up looking like my really bad text drawing here: