Пример #1
0
        void InitCanvas()
        {
            cav = new Canvas(128, 64);

            Canvas.FillRect r1 = new Canvas.FillRect(0, 0, 128, 64, Color.Green);
            cav.AddItem(0, r1);

            Canvas.FillRect r2 = new Canvas.FillRect(10, 10, 80, 40, Color.Gray);
            r2.Flush = true;
            cav.AddItem(0, r2);

            pic = new Canvas.PicBox(32, 0, 64, 64);
            cav.AddItem(0, pic);

            Canvas.FillEllipse e1 = new Canvas.FillEllipse(20, 10, 20, 20, Color.Yellow);
            cav.AddItem(0, e1);

            Canvas.FillEllipse e2 = new Canvas.FillEllipse(21, 11, 18, 18, Color.Red);
            e2.Flush = true;
            cav.AddItem(0, e2);

            txTime      = new Canvas.TextBox(10, 10, 100, 40, "", "宋体", 9, Color.Black);
            txTime.Wrap = true;

            cav.AddItem(0, txTime);

            //test = new TestItem(50,40);
            //cav.AddItem(0, test);
        }
Пример #2
0
        void BeforeRender(string page, Canvas cav, Graphics g)
        {
            if (page == "1")
            {
                Canvas.TextBox t = cav.FindItem("TIME") as Canvas.TextBox;
                if (t != null)
                {
                    t.Text = DateTime.Now.ToString("hh:mm:ss");
                }
            }

            if (page == "2")
            {
                Canvas.PicBox pic = cav.FindItem("PIC") as Canvas.PicBox;

                switch (DateTime.Now.Second % 2)
                {
                case 0: pic.Image = img1; break;

                case 1: pic.Image = img2; break;
                }
            }

            g.Clear(Color.Blue);
        }