/// <summary> /// 切换窗体的方法 /// </summary> /// <param name="obj"></param> /// <param name="ea"></param> void btn_function_Click(object obj, EventArgs ea) { if (obj.Equals(pictureBox_buttonSelectDisk)) { shareForm.Hide(); //syncForm.Hide(); cloudDiskForm.Show(); ButtonSelected = pictureBox_buttonSelectDisk; //pictureBox_buttonSelectDisk.BackColor = SelectedColor; pictureBox_buttonShare.BackColor = Color.Transparent; label_share.BackColor = Color.Transparent; pictureBox_buttonNet.BackColor = Color.Transparent; label_sync.BackColor = Color.Transparent; } if (obj.Equals(pictureBox_buttonShare)) { //syncForm.Hide(); cloudDiskForm.Hide(); shareForm.Show(); ButtonSelected = pictureBox_buttonShare; pictureBox_buttonSelectDisk.BackColor = Color.Transparent; label_disk.BackColor = Color.Transparent; //pictureBox_buttonShare.BackColor = SelectedColor; pictureBox_buttonNet.BackColor = Color.Transparent; label_sync.BackColor = Color.Transparent; } if (obj.Equals(pictureBox_buttonNet)) { cloudDiskForm.Hide(); shareForm.Hide(); //syncForm.Show(); ButtonSelected = pictureBox_buttonNet; pictureBox_buttonSelectDisk.BackColor = Color.Transparent; label_disk.BackColor = Color.Transparent; pictureBox_buttonShare.BackColor = Color.Transparent; label_share.BackColor = Color.Transparent; //pictureBox_buttonNet.BackColor = SelectedColor; } }
/// <summary> /// 设置按钮按下事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureBox_buttonSetting_Click(object sender, EventArgs e) { settingForm = new SettingForm(); //settingForm.TopLevel = false; //settingForm.Parent = this; settingForm.startSetting(); DialogResult dialogResult = settingForm.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { /* 临时保存工作目录,防止回退 */ string tempPath = cloudDiskForm.Current_Path; Stack <string> backStack = cloudDiskForm.BackStack; Stack <string> forwardStack = cloudDiskForm.ForwardStack; cloudDiskForm.updateFileTree(); FileTree fileTree = cloudDiskForm.File_Tree; cloudDiskForm = new CloudDiskForm(this, null); cloudDiskForm.TopLevel = false; panel_mainForm.Controls.RemoveByKey(cloudDiskForm.Name); cloudDiskForm.BackStack = backStack; cloudDiskForm.ForwardStack = forwardStack; cloudDiskForm.Current_Path = tempPath; cloudDiskForm.setUserInfo(userInfo); panel_mainForm.Controls.Add(cloudDiskForm); cloudDiskForm.Show(); /* 还原目录树的展开状态 */ cloudDiskForm.File_Tree = fileTree; cloudDiskForm.updateDirectoryTree(); } //settingForm.Show(); //this.Enabled = false; }