private void frmMain_Load(object sender, EventArgs e) { WindowState = FormWindowState.Maximized; panel_index.Dock = DockStyle.Fill; string scanMode = ConfigurationManager.AppSettings["scanMode"]; if (scanMode == "image") { frmIndex frmIndex = new frmIndex(); frmIndex.TopLevel = false; frmIndex.FormBorderStyle = FormBorderStyle.None; frmIndex.Dock = DockStyle.Fill; frmIndex.Parent = panel_index; frmIndex.Show(); } else { frmVatInvoice frmVatInvoice = new frmVatInvoice(); frmVatInvoice.TopLevel = false; frmVatInvoice.FormBorderStyle = FormBorderStyle.None; frmVatInvoice.Dock = DockStyle.Fill; frmVatInvoice.Parent = panel_index; frmVatInvoice.Show(); } }
private void ts_Image_Click(object sender, EventArgs e) { frmIndex frmIndex = new frmIndex(); frmIndex.TopLevel = false; frmIndex.FormBorderStyle = FormBorderStyle.None; frmIndex.Dock = DockStyle.Fill; frmIndex.Parent = this.panel_index; frmIndex.Show(); }
/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { string name = this.txtName.Text.Trim(); string passWord = this.txtPassword.Text.Trim(); string strPath = ConfigurationManager.AppSettings["url"]; if (string.IsNullOrEmpty(strPath)) { MessageBox.Show("请配置服务器地址!", "提示"); return; } if (string.IsNullOrEmpty(name)) { MessageBox.Show("用户名不能为空!", "提示"); return; } if (string.IsNullOrEmpty(passWord)) { MessageBox.Show("密码不能为空!", "提示"); return; } try { string json = HttpPost(strPath + "/ImageApi/Login?UserID=" + name + "&passWord="******""); JObject result = JObject.Parse(json); if (Convert.ToBoolean(result["success"])) { SetValue("LoginName", txtName.Text); System.Configuration.ConfigurationManager.RefreshSection("appSettings"); frmIndex frmIndex = new frmIndex(); frmIndex.USERID = name; frmIndex.Show(); Hide(); } else { MessageBox.Show(result["info"].ToString(), "提示"); } } catch (Exception e1) { MessageBox.Show(e1.Message); } }