void AfterRender(string page, Canvas cav, Graphics g) { if (page == "1") { g.FillEllipse(new SolidBrush(Color.Red), new Rectangle(10, 10, 30, 30)); } else if (page == "2") { g.FillEllipse(new SolidBrush(Color.Green), new Rectangle(10, 10, 30, 30)); } else if (page == "3") { g.DrawLine(new Pen(Color.Red), 0, 0, 100, 100); } }
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); }
static public void AssignCanvas(int Index,Canvas cav) { lock (cav) { switch (CardType) { case 1: case 3: Graphics g = GetGraphics(Index); cav.Draw(g, 0, 0,1); break; } } }
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); }
void AfterPageRender(Canvas cav, Graphics g) { if (AfterRender != null) AfterRender(Pages.Keys.ToArray()[curPage], cav, g); }
void BeforePageRender(Canvas cav, Graphics g) { if (BeforeRender != null) BeforeRender(Pages.Keys.ToArray()[curPage], cav, g); }