首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> 關於C語言

ZedGraph 基礎教程 (2) - InitialSampleDemo 繼承結構與基類構造函數詳解

     編輯:關於C語言

繼承關係圖

InitialSampleDemo → DemoBase → ZedGraphDemo(介面)

ZedGraphDemo 介面定義

String Description, String Title, ZedGraphControl ZedGraphControl, ICollection Types

DemoBase 擴展與構造函數

  • 實作介面四屬性。
  • 新增 PaneBase Pane、MasterPane MasterPane。
  • 四個多載構造函數,最終呼叫 Init 初始化 ZedGraphControl。
public DemoBase(string description, string title, DemoType type) {
    ArrayList types = new ArrayList();
    types.Add(type);
    Init(description, title, types);
}
// ... 其他多載同理
private void Init(string description, string title, ICollection types) {
    this.description = description;
    this.title = title;
    this.types = types;
    control = new ZedGraphControl();
}

InitialSampleDemo 構造函數

public InitialSampleDemo() : base("Code Project Initial Sample", "Initial Sample", DemoType.Tutorial)

傳入描述、標題、類型枚舉,完成基類初始化。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved