|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using MycroXaml.Parser;
namespace Demo
{
public class Startup
{
protected Parser mp;
[STAThread]
static void Main()
{
new Startup();
}
public Startup()
{
mp=new Parser();
StreamReader sr;
string text;
XmlDocument doc;
sr=new StreamReader("ColorPicker.mycroxaml");
text=sr.ReadToEnd();
sr.Close();
doc=new XmlDocument();
try
{
doc.LoadXml(text);
}
catch(Exception e)
{
Trace.Fail("Malformed xml:\r\n"+e.Message);
}
Form form=(Form)mp.Load(doc, "Form", this);
form.ShowDialog();
}
public void OnScrolled(object sender, EventArgs e)
{
TrackBar RedScroll = (TrackBar)mp.GetInstance("RedScroll");
TrackBar GreenScroll = (TrackBar)mp.GetInstance("GreenScroll");
TrackBar BlueScroll = (TrackBar)mp.GetInstance("BlueScroll");
PictureBox ColorPanel = (PictureBox)mp.GetInstance("ColorPanel");
ColorPanel.BackColor = System.Drawing.Color.FromArgb((byte)RedScroll.Value, (byte)GreenScroll.Value, (byte)BlueScroll.Value);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.