我一直在查看在线文档,我还没有找到在运行时更新按钮或标签图像的方法。我试图在按钮布局中显示缩略图。在保持布局的同时,缩略图需要根据可用的图像进行更新。
例如,当用户单击" next“时,我有一个带有”前一个“按钮、三个显示缩略图的按钮和一个”下一步“按钮的布局,三个按钮更改为显示下三个缩略图。他们需要被按钮,以允许正常的,汉弗,按鼠标互动。因此,当用户单击缩略图时,该图像将被触发。
任何帮助都是非常感谢的。
发布于 2015-07-16 03:25:33
我找到了我想要的答案。在查找感觉文件中,我定义了一个属性:"BackgroundImage“类型为"Image”
<WidgetLook name="MyLook/Thumbnail">
<Property name="CursorImage" value="MyImageSet/cursorOn" />
<Property name="CursorPassThroughEnabled" value="true" />
<PropertyDefinition name="BackgroundImage" redrawOnWrite="true" initialValue="MyImageSet/defaultImage" type="Image"/>
<Property name="Size" value="{{1, 0}, {1, 0}}" />
<ImagerySection name="frame">
<FrameComponent>
<ImageProperty name="BackgroundImage" />
<VertFormat type="Stretched" />
<HorzFormat type="Stretched" />
</FrameComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="frame" />
</Layer>
</StateImagery>
</WidgetLook>然后,在代码中使用定义的属性设置图像:
CEGUI::DefaultWindow* thumbnail = static_cast<CEGUI::DefaultWindow*>( parrentWindow->getChild( "Thunbnail_1" ));
thumbnail->setProperty( "BackgroundImage", "MyImageSet/movieClipIcon" );https://stackoverflow.com/questions/31421924
复制相似问题