1. Trang chủ
  2. » Giáo án - Bài giảng

Chapter 11 Advanced Topics in Windows Forms

14 287 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 14
Dung lượng 157,28 KB

Nội dung

1 Week 10 Chapter 11. Advanced Topics in Windows Forms Chapter 12. Enhancing Usability Chapter 15: Crystal Report Chapter 11. Advanced Topics in Windows Forms  11.1 Drag-Drop (P523)  11.2 MDI (P543) 2 11.1 Drag-Drop (P523)  Windows users fall into two general categories:  use the keyboard  use the mouse  Drag and drop: same as cutting and pasting using keyboard 11.1 Drag-Drop (P523) Sequence of events  Dragging is initiated (call DoDragDrop for the source )  The DoDragDrop method takes two parameters:  data  allowedEffects  A new DataObject object is automatically created.  Raises the GiveFeedback event. (display a custom mouse pointer during the drag)  Control with AllowDrop =True can receive drop.  DragEnter raised (mouse pass).  GetDataPresent :make sure that the format of the data  Effect property is used to display the appropriate mouse pointer.  DragDrop: extracts the data from the DataObject 3 11.1 Drag-Drop (P523) Source control Target control +MouseDown -TXT1.DoDragDrop (textBox1.Text, DragDropEffects.Copy ) AllowDrop=true +DragEnter if (e.Data.GetDataPresent (DataFormats.Text)) e.Effect = DragDropEffects.Copy; +DragDrop TXT2.Text = (string)e.Data.GetData ( DataFormats.Text); Drag-Drop: demo: Textbox  Using Textbox  Step1: DragEnter event  Step2: DragDrop event  Step3: MouseDown event 4 Drag-Drop: demo: PictureBox  AllowDrop  DragEnter  DragDrop  KeyState 11.1 Drag-Drop (P523) - demo: treeview  Example: Drag-Drog in Treeview  treeView1_ItemDrag  treeView1_DragEnter  treeView1_DragDrop  treeview1.PointToClient(new Point(e.X, e.Y));  treeview1.GetNodeAt(apoint);  Clone node;  } 5 form tree Xform Yform Xcontrol Ycontrol Point_form(Xform,Yform) Point_control(Xform,Yform) C. PointToClient(Point_form ) 11.1 Drag-Drop (P523) - demo: Listview  Make new collection  Array  ArrayList  List<generic> 6 11.2 MDI  parent form/child form model.  Has a single parent form  The parent form organizes and arranges all of the child documents that are currently open. 11.2 MDI  What is an MDI Form?  Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. 7 11.2 MDI  How do I create an MDI Parent form ?  Creating an MDI Parent Form  IsMDIContainer=true  How do I create an MDI Child form ?  Creating MDI Child Forms  Set MdiParent to parent form 11.2 MDI  How do I change the Background color of an MDI Parent form?  private void MDIParent1_Load(object sender, EventArgs e)  {  foreach (Control c in this.Controls) {  try  {  MdiClient m = (MdiClient)c;  m.BackColor = Color.Red;  }  catch (Exception ex)  {}  }  } 8 11.2 MDI  Identifying the Active Child Form  Form aForm;  aForm = this.ActiveMDIChild; 11.2 MDI  Arranging MDI Child Forms  this.LayoutMdi(System.Windows.Forms.Mdi Layout.Cascade); 9 11.2 MDI  Window List Menu  MenuStrip component  Set the MdiWindowListItem property to the menu item 11.2 MDI  How do I check if an MDI Child form already exists, so that we don't show the same form twice?  foreach (Form f in this.MdiChildren)  {  if (f.Text == "Window 2")  {  this.ActivateMdiChild(f);  return;  }  }  Form f1 = new Form();  f1.MdiParent = this;  f1.Show(); 10 Chapter 12. Enhancing Usability  Lesson 2: Using User Assistance Controls and Components  The ProgressBar Control  StatusStrip Control  ToolTip Component  ErrorProvider Component  HelpProvider Component Chapter 12. Using User Assistance Controls and Components  The ProgressBar Control  Visually indicate progress for a time- consuming operation.  Maximum, Minimum, Value, Step progressBar1.Minimum = 0; progressBar1.Maximum = 100; progressBar1.Step = 1; for (int i = 0; i < 101; i++) { CopyFiles(i); progressBar1.PerformStep(); } [...].. .Chapter 12 Using User Assistance Controls and Components StatusStrip Control Display status information about the application ToolStripStatusLabel Text Chapter 12 Using User Assistance Controls and Components ToolTip Component To set a tooltip in the Designer To set a tooltip in code toolTip1.SetToolTip(button1, "This button activates the self-destruct sequence"); 11 Chapter 12 Using User... condition results for a control in the form Turn on errorProvider1.SetError(TextBox1, "Value must be numeric"); Turn off errorProvider1.SetError(TextBox1, ""); Chapter 15: Report 12 Chapter 15: Crystal Report Crystal Report File Crystal Report Viewer Chapter 15: Crystal Report 1 Create Type Dataset 2 Create Crystal Report Template Menu Project -> Add new item -> Crystal Report ->Using Report Wizard->choose... Crystal Report ->Using Report Wizard->choose Typed-Dataset>… 3 Create CrystalReport Viewer 4 Code to connect objects… Example 13 Chapter 15: Crystal Report Typed Dataset Class Crystal Report.Rpt Dataset Crystal Report Viewer Chapter 15: Crystal Report //Create and Fill data into Dataset ds CrystalReport1 c = new CrystalReport1(); c.SetDataSource(ds); crystalReportViewer1.ReportSource = c; 14 . ""); Chapter 15: Report 13 Chapter 15: Crystal Report  Crystal Report File  Crystal Report Viewer Chapter 15: Crystal Report  1. Create Type Dataset  2. Create Crystal Report Template  Menu. Dataset Dataset Crystal Report. Rpt Crystal Report Viewer Class Chapter 15: Crystal Report  //Create and Fill data into Dataset ds   CrystalReport1 c = new CrystalReport1();  c.SetDataSource(ds);  crystalReportViewer1.ReportSource. 1 Week 10 Chapter 11. Advanced Topics in Windows Forms Chapter 12. Enhancing Usability Chapter 15: Crystal Report Chapter 11. Advanced Topics in Windows Forms  11.1

Ngày đăng: 13/05/2014, 12:19

TỪ KHÓA LIÊN QUAN

w