示例#1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     XmlDocument doc = new XmlDocument();
     doc.Load("settings.xml");
     LCDChip lcd = new LCDChip(doc["LCD"]);
 }
示例#2
0
        public LCDDisplay(XmlNode settings, LCDChip chip)
        {
            this.chip = chip;

            this.InitializeComponent();
            try { this.Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location); }
            catch (Exception) { }
            this.background = ColorTranslator.FromHtml(settings["Background"].InnerText);
            this.foreground = ColorTranslator.FromHtml(settings["Foreground"].InnerText);
            this.fgBrush = new SolidBrush(this.foreground);
            this.cgrom = new CGROM(settings["CGROM"].InnerText);
            this.size = ReadSize(settings["Size"].InnerText);
            this.charSize = ReadSize(settings["CharacterSize"].InnerText);
            this.gapSize = ReadSize(settings["GapSize"].InnerText);
            this.pixelSize = ReadSize(settings["PixelSize"].InnerText);
            this.borderSize = ReadSize(settings["BorderSize"].InnerText);
            this.charFullSize = new Size(this.charSize.Width + this.gapSize.Width, this.charSize.Height + this.gapSize.Height);
            this.charFullPixelSize = new Size(this.charFullSize.Width * this.pixelSize.Width, this.charFullSize.Height * this.pixelSize.Height);
            this.tlOffset = new Size(this.gapSize.Width * this.pixelSize.Width + borderSize.Width, this.gapSize.Height * this.pixelSize.Height + borderSize.Height);
            this.character = new Rectangle(0, 0, this.charSize.Width, this.charSize.Height);

            this.borderTopPen  = new Pen(this.fgBrush, this.borderSize.Height);
            this.borderLeftPen = new Pen(this.fgBrush, this.borderSize.Width );

            this.Size = new Size(
                this.size.Width  * this.charFullPixelSize.Width  + this.tlOffset.Width  + borderSize.Width,
                this.size.Height * this.charFullPixelSize.Height + this.tlOffset.Height + borderSize.Height
            );
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;

            this.blinker.Enabled = true;
            this.blinker.Interval = 400;
            this.blinker.Tick += this.BlinkIt;

            this.Clear();
            this.UpdateColors();
        }