FormBrowser 類
1: public partial class FormBrowser : Form
2: {
3: FormMain _MyParentForm;
4: string MyUrl;
5:
6: public FormBrowser(FormMain MyParentForm, string Args)
7: {
8: InitializeComponent();
9: string[] args = Args.ToString().Split('@'); // 取得參數列並以@為分隔符號產生字串陣列
10: if (args.Length == 3)
11: {
12: this.Text = string.Format("{0} {1}[{2}]", args[0], args[1],args[2]);
13: MyUrl = args[2];
14: }
15: else
16: {
17: this.Text = String.Format("[{0}]", MyUrl);
18: MyUrl = Args;
19: }
20:
21: _MyParentForm = MyParentForm;
22: }
23:
24: private void FormBrowser_Load(object sender, EventArgs e)
25: {
26:
27: webBrowser1.Navigate(MyUrl);
28: }
29: }
使用該類
1: //
2: string StationName = getStationName(((Button)sender).Tag.ToString());
3: string arg = String.Format("{0}@{1}@{2}", StationName,((Button)sender).Text, ((Button)sender).Tag.ToString());
4: FormBrowser fB = new FormBrowser(this, arg);
5: fB.Show();
6:
7: /* 將 FormBrowser 嵌入
8: {
9: SetParent(fB.Handle, pnlBrowser.Handle);
10: //ResizeControlHwnd(fB.Handle, mParnet);
11: tabCtlMain.SelectTab(2);
12: }*/
沒有留言:
張貼留言