| | |
create buttons configured from xml file
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 1
Reputation:
Solved Threads: 0
Hello,
I am trying to create a form in C# that will get its buttons configured from a xml file. Here is a sample of my xml file:
<?xml version="1.0" ?>
- <LauncherConfig>
- <GeneralOptions>
<Name>FORM_NAME</Name>
<BackgrounColor>Gray</BackgrounColor>
<PercentOpaque>50</PercentOpaque>
<StayOnTop>True</StayOnTop>
<Orientation>Horizontal</Orientation>
</GeneralOptions>
- <Group1>
<GroupName_Lable>GPS/Mapping</GroupName_Lable>
<Horizontal_Number_Rows>1</Horizontal_Number_Rows>
<Verticle_Number_Columns>1</Verticle_Number_Columns>
- <Button1>
<ButtonLabel>OZI</ButtonLabel>
<UnselectedButtonTextColor>FFFFFF</UnselectedButtonTextColor>
<SelectedButtonTextColor>000000</SelectedButtonTextColor>
<UnselectedButtonColor>CC0000</UnselectedButtonColor>
<SelectedButtonColor>333399</SelectedButtonColor>
<ApplicationToLaunch>"C:\Program Files\OziExplorer\OziExp.exe"</ApplicationToLaunch>
<ButtonSizeWidth>55</ButtonSizeWidth>
<ButtonSizeHeight>31</ButtonSizeHeight>
</Button1>
What I would like to do is on form run, check the xml for the number of buttons to create, get their size, color etc and structure the form around those buttons. I am trying to group the buttons with a label as well.
Another difficult (for me at least) is to change the orientation of the form to be either vertical or horizontal based on the xml config.
If someone can get me started with the auto-creation of the buttons based on the xml sippet, I would greatly appreciate it. I don't have a problem creating the form manually using VS2005 designer, however the on-the fly creation is giving me headaches.
Thanks in advance for any help
I am trying to create a form in C# that will get its buttons configured from a xml file. Here is a sample of my xml file:
<?xml version="1.0" ?>
- <LauncherConfig>
- <GeneralOptions>
<Name>FORM_NAME</Name>
<BackgrounColor>Gray</BackgrounColor>
<PercentOpaque>50</PercentOpaque>
<StayOnTop>True</StayOnTop>
<Orientation>Horizontal</Orientation>
</GeneralOptions>
- <Group1>
<GroupName_Lable>GPS/Mapping</GroupName_Lable>
<Horizontal_Number_Rows>1</Horizontal_Number_Rows>
<Verticle_Number_Columns>1</Verticle_Number_Columns>
- <Button1>
<ButtonLabel>OZI</ButtonLabel>
<UnselectedButtonTextColor>FFFFFF</UnselectedButtonTextColor>
<SelectedButtonTextColor>000000</SelectedButtonTextColor>
<UnselectedButtonColor>CC0000</UnselectedButtonColor>
<SelectedButtonColor>333399</SelectedButtonColor>
<ApplicationToLaunch>"C:\Program Files\OziExplorer\OziExp.exe"</ApplicationToLaunch>
<ButtonSizeWidth>55</ButtonSizeWidth>
<ButtonSizeHeight>31</ButtonSizeHeight>
</Button1>
What I would like to do is on form run, check the xml for the number of buttons to create, get their size, color etc and structure the form around those buttons. I am trying to group the buttons with a label as well.
Another difficult (for me at least) is to change the orientation of the form to be either vertical or horizontal based on the xml config.
If someone can get me started with the auto-creation of the buttons based on the xml sippet, I would greatly appreciate it. I don't have a problem creating the form manually using VS2005 designer, however the on-the fly creation is giving me headaches.
Thanks in advance for any help
Creating controls in runtime is very easy task, just use XMLReader class in System.XML namespace to read your xml file and define your button properties and then create button control with specified properties.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Other Threads in the C# Forum
- Previous Thread: need help for distributed Application
- Next Thread: Adding in escape characters into a string
| Thread Tools | Search this Thread |
.net access algorithm api array asp.net barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf xml






