[英]C# WinForm Menu Strip
我使用 ASP.NET 和母版頁和 session。 我把菜單放在母版頁中。 成功登錄后,我將變量保存在 session 中。
現在我正在使用 Winform。 Session 我用變量替換
和我用表格替換的母版頁
所以在成功登錄后,我保存在 Session 的變量 insted 中,並使用菜單條關閉和打開面板。
public partial class Principale : Form
static string _ClientId;
public static string ClientId
{
get { return _ClientId; }
set { _ClientId = value; }
}
LeOrdre_BL oOrdre_BL = new LeOrdre_BL();
LeOrdreStatut_Entite_BL oOrdreStat_BL = new LeOrdreStatut_Entite_BL();
public Principale()
{
InitializeComponent();
ClientId = LoginData.Trim().Substring(0, LoginData.Trim().Length - 1);
panelControl_Ordre.Hide();
panelControl_Mag.Hide();
}
private void ordreToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Show();
panelControl_Mag.Hide();
GetDataOrdre();
}
private void magasinierToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Hide();
panelControl_Mag.Show();
}
public void GetDataOrdre()
{
try
{
bindingSource_OdreStatus.DataSource = oOrdreStat_BL.Get_All_OrdreStatut();
STATUT_ORDRE.DataSource = bindingSource_OdreStatus;
STATUT_ORDRE.DisplayMember = "LIBELLE";
STATUT_ORDRE.ValueMember = "NO";
bindingSource_Ordre.DataSource = oOrdre_BL.Get_Ordre_BL();
dataGridView_ordre.DataSource = bindingSource_Ordre;
dataGridView_ordre.DataMember = "OrdreTable";
}
catch (Exception excThrown)
{
lbl_Princ_Err.Text = excThrown.Message;
}
}
我是否以正確的方式執行此操作,或者您是否有其他想法來替換 Winform 中的 ASP.NET Masterpage?
提前感謝
您是否嘗試過使用 MdiContainer。 用戶 state 可以存儲為 mdi 容器形式的變量嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.