private void tvList_AfterSelect(object sender, TreeViewEventArgs e) { DrawingContext context = new DrawingContext(graphics); using (Pen pen = new Pen(Color.Blue, lineWidth)) { context.Pen = pen; if (e.Node.Nodes.Count > 0) {//�������� pen.Color = Color.Green; Cursor.Current = Cursors.WaitCursor; foreach (TreeNode node in e.Node.Nodes) { IDrawing drawing = node.Tag as IDrawing; if (drawing != null) { drawing.Draw(context); } Thread.Sleep(250); } Cursor.Current = Cursors.Default; } else { IDrawing drawing = e.Node.Tag as IDrawing; if (drawing != null) { drawing.Draw(context); } } } }
private void MainForm_Paint(object sender, PaintEventArgs e) { DrawingContext context = new DrawingContext(e.Graphics); using (Pen p = new Pen(Color.Red, lineWidth)) { context.Pen = p; //��ͼ foreach (WordOutlineDrawing outline in wordOutlines) { outline.Draw(context); } } }