create buttons configured from xml file

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 1
Reputation: deadskunk is an unknown quantity at this point 
Solved Threads: 0
deadskunk deadskunk is offline Offline
Newbie Poster

create buttons configured from xml file

 
0
  #1
Dec 28th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: create buttons configured from xml file

 
0
  #2
Dec 29th, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC