Click here to Skip to main content
15,910,872 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a query regarding reading Image Property for button from a XML file.

I read XML files to Generate Screens using System.Windows.Forms.Controls. The XML file is read and properties are set using Reflection

A sample representation of it is given below

<Control type="System.Windows.Forms.Button, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="Button2">
<Property name="TabIndex" value="6"></Property>
<Property name="Size" value="75, 23"></Property>
<Property name="Name" value="Button2"></Property>
<Property name="UseVisualStyleBackColor" value="true"></Property>
<Property name="Text" value="Exit"></Property>
<Property name="Location" value="106, 170"></Property>

Is it possible to specify the Image Property as Given Below
<Property name="Image" value="C:\Data\Image.bmp"></Property>

How can the Image Name read at run time and binded to dynamically generated assembly.

Please advice?

[edit]Code blocks added - OriginalGriff[/edit]
Posted
Updated 13-Feb-11 2:41am
v5

1 solution

Are you asking how to read the value attribute? If so that's surprising since your core application itself generates UI from XML. So surely you should already have an XML parser in place and all ready to use? If not, then how are you parsing the XML or how do you plan to read in the XML?

Now if I misunderstood and you have the XML all parsed out and ready to use, but you are wondering if you can set images on controls, then it really depends on the controls. Many controls do support setting an image as background directly, but not all do. So for some controls you won't be able to do this unless you use derived/custom controls that have been enhanced with an image property.
 
Share this answer
 
v2
Comments
bburhanbohra 14-Feb-11 5:33am    
thnx for ur response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900