首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Degrafa变色器

Degrafa变色器
EN

Stack Overflow用户
提问于 2008-12-25 13:42:31
回答 1查看 700关注 0票数 1
代码语言:javascript
运行
复制
<degrafa:LinearGradientFill id="bluedream">
    <degrafa:GradientStop color="#6ab5d0"/>
    <degrafa:GradientStop color="#388aae"/>
</degrafa:LinearGradientFill>

<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
    <degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>

我有降级代码的问题,我已经定义了一组不同的梯度,当用户在组合框中选择不同的颜色时,color_preset.fill会动态变化。

我用fill="using_variable"替换了fill="{bluedream}",并导致编译错误消息:‘fill’的初始化器:com.degrafa.core.IGraphicsFill类型的值不能用文本表示。

有没有一个解决方案来使用这个代码作为颜色变更器?

EN

Stack Overflow用户

发布于 2008-12-28 04:48:31

示例中的fill属性指向id为"bluedream“的LinearGradientFill。您可以用不同的渐变(或纯色或其它填充)替换填充,也可以更改渐变填充本身的颜色:

代码语言:javascript
运行
复制
<degrafa:LinearGradientFill id="bluedream">
    <degrafa:GradientStop color="{your_combobox.selectedItem}"/>
    <degrafa:GradientStop color="{your_other_combobox.selectedItem}"/>
</degrafa:LinearGradientFill>

<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
     <degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>

我还没有运行该代码,但它应该可以工作。这个想法是用你的dropdown的selectedItem来改变GradientStop的颜色(假设它是一个字符串)。这个示例做了一些非常类似的事情,只是使用了颜色选择器而不是下拉列表:http://degrafa.org/source/CS4IconPreviewer/CS4IconPreviewer.html

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/392808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档