/// <summary> /// 添加修改左侧panel * /// </summary> /// <param name="usercode"></param> /// <param name="systemcode"></param> /// <param name="contentCode"></param> public void UpdateLeftPanel(string usercode, string systemcode, string contentCode) { try { if (contentCode.Equals("0101")) { PanelLeft.RemoveAll(true); Ext.Net.Panel panelMenu = GetmenuPanel(usercode, systemcode, contentCode); panelMenu.Render(PanelLeft, RenderMode.Auto); } else { PanelLeft.RemoveAll(true); Ext.Net.Panel panelMenu = GetmenuPanel(usercode, systemcode, contentCode); if (panelMenu != null) { PanelLeft.Items.Add(panelMenu); panelMenu.Render(PanelLeft, RenderMode.Auto); } } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("ExMainIndex.aspx-UpdateLeftPanel", ex.Message + ";" + ex.StackTrace, "UpdateLeftPanel has an exception"); } }
//Click vào button Statistics sẽ load page StatisticsPage private void BtSta_Click(object sender, EventArgs e) { #region//Click vào button Statistics sẽ load page StatisticsPage if (Position != 2) { //Đổi màu bt Sta BtStatistic.BackColor = Color.FromArgb(223, 159, 163);// CHuyển màu button Sta BtStatistic.ForeColor = Color.FromArgb(255, 255, 255); BtStatistic.IconColor = Color.FromArgb(255, 255, 255); BtStatistic.Font = new Font("Calibri", 16, FontStyle.Bold); #region Trả lại màu button khác BtAdmin.BackColor = Color.FromArgb(239, 242, 235); BtAdmin.ForeColor = Color.FromArgb(73, 80, 87); BtAdmin.IconColor = Color.FromArgb(73, 80, 87); BtAdmin.Font = new Font("Calibri", 15, FontStyle.Bold); BtOder.BackColor = Color.FromArgb(239, 242, 235); BtOder.ForeColor = Color.FromArgb(73, 80, 87); BtOder.IconColor = Color.FromArgb(73, 80, 87); BtOder.Font = new Font("Calibri", 15, FontStyle.Bold); BtAcc.BackColor = Color.FromArgb(239, 242, 235); BtAcc.ForeColor = Color.FromArgb(73, 80, 87); BtAcc.IconColor = Color.FromArgb(73, 80, 87); BtAcc.Font = new Font("Calibri", 15, FontStyle.Bold); BtDetails.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtDetails.ForeColor = Color.FromArgb(73, 80, 87); BtDetails.IconColor = Color.FromArgb(73, 80, 87); BtDetails.Font = new Font("Calibri", 15, FontStyle.Bold); BtStock.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtStock.ForeColor = Color.FromArgb(73, 80, 87); BtStock.IconColor = Color.FromArgb(73, 80, 87); BtStock.Font = new Font("Calibri", 15, FontStyle.Bold); #endregion pgSta.ClientSize = panelMain.ClientSize; pgSta.BringToFront(); pgSta.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); PanelLeft.Show(); PanelLeft.Height = BtStatistic.Height; PanelLeft.Top = BtStatistic.Top; } else { MessageBox.Show("Bạn không có quyền truy cập trang này!", "Thông báo"); } #endregion }
//Click vào button About sẽ load page HelpUser private void BtAbout_Click(object sender, EventArgs e) { // Đổi màu Button About BtDetails.BackColor = Color.FromArgb(162, 172, 164);// CHuyển màu button About BtDetails.ForeColor = Color.FromArgb(255, 255, 255); BtDetails.IconColor = Color.FromArgb(255, 255, 255); BtDetails.Font = new Font("Calibri", 16, FontStyle.Bold); #region Trả lại màu button khác BtAdmin.BackColor = Color.FromArgb(239, 242, 235); BtAdmin.ForeColor = Color.FromArgb(73, 80, 87); BtAdmin.IconColor = Color.FromArgb(73, 80, 87); BtAdmin.Font = new Font("Calibri", 15, FontStyle.Bold); BtOder.BackColor = Color.FromArgb(239, 242, 235); BtOder.ForeColor = Color.FromArgb(73, 80, 87); BtOder.IconColor = Color.FromArgb(73, 80, 87); BtOder.Font = new Font("Calibri", 15, FontStyle.Bold); BtStatistic.BackColor = Color.FromArgb(239, 242, 235); BtStatistic.ForeColor = Color.FromArgb(73, 80, 87); BtStatistic.IconColor = Color.FromArgb(73, 80, 87); BtStatistic.Font = new Font("Calibri", 15, FontStyle.Bold); BtAcc.BackColor = Color.FromArgb(239, 242, 235); BtAcc.ForeColor = Color.FromArgb(73, 80, 87); BtAcc.IconColor = Color.FromArgb(73, 80, 87); BtAcc.Font = new Font("Calibri", 15, FontStyle.Bold); BtStock.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtStock.ForeColor = Color.FromArgb(73, 80, 87); BtStock.IconColor = Color.FromArgb(73, 80, 87); BtStock.Font = new Font("Calibri", 15, FontStyle.Bold); #endregion #region About--- load page HelpUser pgHelpUser.ClientSize = panelMain.ClientSize; pgHelpUser.BringToFront(); pgHelpUser.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); PanelLeft.Show(); PanelLeft.Height = BtDetails.Height; PanelLeft.Top = BtDetails.Top; #endregion }
//Click vào button Account sẽ load page AccountUser private void BtAcc_Click(object sender, EventArgs e) { // Đổi màu button Acc BtAcc.BackColor = Color.FromArgb(214, 158, 137);// CHuyển màu button Acc BtAcc.ForeColor = Color.FromArgb(255, 255, 255); BtAcc.IconColor = Color.FromArgb(255, 255, 255); BtAcc.Font = new Font("Calibri", 16, FontStyle.Bold); #region Trả lại màu button khác BtAdmin.BackColor = Color.FromArgb(239, 242, 235); BtAdmin.ForeColor = Color.FromArgb(73, 80, 87); BtAdmin.IconColor = Color.FromArgb(73, 80, 87); BtAdmin.Font = new Font("Calibri", 15, FontStyle.Bold); BtOder.BackColor = Color.FromArgb(239, 242, 235); BtOder.ForeColor = Color.FromArgb(73, 80, 87); BtOder.IconColor = Color.FromArgb(73, 80, 87); BtOder.Font = new Font("Calibri", 15, FontStyle.Bold); BtStatistic.BackColor = Color.FromArgb(239, 242, 235); BtStatistic.ForeColor = Color.FromArgb(73, 80, 87); BtStatistic.IconColor = Color.FromArgb(73, 80, 87); BtStatistic.Font = new Font("Calibri", 15, FontStyle.Bold); BtDetails.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtDetails.ForeColor = Color.FromArgb(73, 80, 87); BtDetails.IconColor = Color.FromArgb(73, 80, 87); BtDetails.Font = new Font("Calibri", 15, FontStyle.Bold); BtStock.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtStock.ForeColor = Color.FromArgb(73, 80, 87); BtStock.IconColor = Color.FromArgb(73, 80, 87); BtStock.Font = new Font("Calibri", 15, FontStyle.Bold); #endregion #region //Click vào button Account sẽ load page AccountUser của User, page AdminManage của Admin pgAcc.ClientSize = panelMain.ClientSize; pgAcc.BringToFront(); pgAcc.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); PanelLeft.Show(); PanelLeft.Height = BtAcc.Height; PanelLeft.Top = BtAcc.Top; #endregion }
//Click vào button Stock sẽ load page StockPage private void BtStock_Click(object sender, EventArgs e) { // Đổi màu và font của button Stock BtAdmin.BackColor = Color.FromArgb(239, 242, 235); BtAdmin.ForeColor = Color.FromArgb(73, 80, 87); BtAdmin.IconColor = Color.FromArgb(73, 80, 87); BtAdmin.Font = new Font("Calibri", 15, FontStyle.Bold); BtStock.BackColor = Color.FromArgb(58, 197, 158);// CHuyển màu button Stock BtStock.ForeColor = Color.FromArgb(255, 255, 255); BtStock.IconColor = Color.FromArgb(255, 255, 255); BtStock.Font = new Font("Calibri", 16, FontStyle.Bold); #region Trả lại màu button khác BtOder.BackColor = Color.FromArgb(239, 242, 235); BtOder.ForeColor = Color.FromArgb(73, 80, 87); BtOder.IconColor = Color.FromArgb(73, 80, 87); BtOder.Font = new Font("Calibri", 15, FontStyle.Bold); BtStatistic.BackColor = Color.FromArgb(239, 242, 235); BtStatistic.ForeColor = Color.FromArgb(73, 80, 87); BtStatistic.IconColor = Color.FromArgb(73, 80, 87); BtStatistic.Font = new Font("Calibri", 15, FontStyle.Bold); BtAcc.BackColor = Color.FromArgb(239, 242, 235); BtAcc.ForeColor = Color.FromArgb(73, 80, 87); BtAcc.IconColor = Color.FromArgb(73, 80, 87); BtAcc.Font = new Font("Calibri", 15, FontStyle.Bold); BtDetails.BackColor = Color.FromArgb(239, 242, 235);// CHuyển màu button Oder BtDetails.ForeColor = Color.FromArgb(73, 80, 87); BtDetails.IconColor = Color.FromArgb(73, 80, 87); BtDetails.Font = new Font("Calibri", 15, FontStyle.Bold); #endregion #region //Click vào button Stock sẽ load page StockPage ckBT = true; pgStock.ClientSize = panelMain.ClientSize; pgStock.BringToFront(); pgStock.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); PanelLeft.Show(); PanelLeft.Height = BtStock.Height; PanelLeft.Top = BtStock.Top; #endregion }
public override void Focus() { if (PanelCenter.CanFocus) { PanelCenter.Focus(); } else if (PanelLeft.CanFocus) { PanelLeft.Focus(); } else if (!PanelRight.CanFocus) { PanelRight.Focus(); } else { PanelBottom.Focus(); } }
public override void OnLayout(IGUIContext ctx, RectangleF bounds) { base.OnLayout(ctx, bounds); SplitterLeft.Visible = PanelLeft.Visible && (PanelCenter.Visible || PanelBottom.Visible); SplitterRight.Visible = PanelRight.Visible && PanelCenter.Visible; SplitterBottom.Visible = PanelBottom.Visible && (PanelCenter.Visible || PanelRight.Visible); if (SplitterLeft.Visible) { SplitterLeft.OnLayout(ctx, bounds); } if (SplitterRight.Visible) { SplitterRight.OnLayout(ctx, bounds); } if (SplitterBottom.Visible) { SplitterBottom.OnLayout(ctx, bounds); } //if (!PanelLeftCollapsed) // SplitterLeft.OnLayout (ctx, this.Bounds); /******/ if (!PanelBottomCollapsed && !PanelCenterCollapsed) { float left = bounds.Left; if (!PanelLeftCollapsed && SplitterLeft.Visible) { left = SplitterLeft.Right; } SplitterBottom.OnLayout(ctx, new RectangleF(left, Top, Width - left, Height - SplitterBottom.Bottom)); } if (!PanelRightCollapsed) { float bottom = bounds.Bottom; if (!PanelBottomCollapsed && SplitterBottom.Visible) { bottom = SplitterBottom.Top; } SplitterRight.OnLayout(ctx, new RectangleF(SplitterRight.Left, Top, SplitterRight.Width, Height - bottom)); } // dump splitters /*** * this.LogDebug("SplitterLeft.Left: {0}", SplitterLeft.Left); * this.LogDebug("SplitterBottom.Top: {0}", SplitterBottom.Top); * this.LogDebug("SplitterRight.Right: {0}", SplitterRight.Right); ***/ // it's nice to handle such things quite optimized.. if (PanelLeft.Visible) { PanelLeft.OnLayout(ctx, new RectangleF(Left, Top, SplitterLeft.Left - Left, Height)); } if (PanelCenter.Visible) { float left = bounds.Left; float right = bounds.Right; float bottom = bounds.Bottom; if (!PanelLeftCollapsed && SplitterLeft.Visible) { left = SplitterLeft.Right; } if (!PanelRightCollapsed && SplitterRight.Visible) { right = SplitterRight.Left; } if (!PanelBottomCollapsed && SplitterBottom.Visible) { bottom = SplitterBottom.Top; } PanelCenter.OnLayout(ctx, new RectangleF(left, Top, right - left, bottom - Top)); } if (PanelBottom.Visible) { float left = bounds.Left; if (!PanelLeftCollapsed && SplitterLeft.Visible) { left = SplitterLeft.Right; } PanelBottom.OnLayout(ctx, new RectangleF(left, SplitterBottom.Bottom, Right - left, Bottom - SplitterBottom.Bottom)); } if (PanelRight.Visible) { float bottom = bounds.Bottom; if (!PanelBottomCollapsed && SplitterBottom.Visible) { bottom = SplitterBottom.Top; } PanelRight.OnLayout(ctx, new RectangleF(SplitterRight.Right, Top, Right - SplitterRight.Right, Height - bottom)); } }
private void DrawCube() { int SquareUnit = PanelBack.Width / 5; for (int i = 0; i < 6; i++) { Graphics g = null; switch (i) { case 0: g = PanelFront.CreateGraphics(); break; case 1: g = PanelLeft.CreateGraphics(); break; case 2: g = PanelBack.CreateGraphics(); break; case 3: g = PanelRight.CreateGraphics(); break; case 4: g = PanelUp.CreateGraphics(); break; case 5: g = PanelDown.CreateGraphics(); break; } g.Clear(Color.Black); for (int j = 0; j < 9; j++) { try { Dictionary <Direction, Color> .Enumerator ColorsEnum = ManagerRef.Faces[i, j].Colors.GetEnumerator(); while (ColorsEnum.MoveNext()) { switch (ColorsEnum.Current.Key) { case Direction.Front: g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1); break; case Direction.Up: g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit, SquareUnit - 1, SquareUnit - 1); break; case Direction.Left: g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1); break; case Direction.Right: g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + 2 * SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1); break; case Direction.Down: g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + 2 * SquareUnit, SquareUnit - 1, SquareUnit - 1); break; } } } catch (Exception ex) { } } LblBack.Text = "Back (" + ManagerRef.Faces[2, 4].Colors[Direction.Front].Name + ")"; LblDown.Text = "Down (" + ManagerRef.Faces[5, 4].Colors[Direction.Front].Name + ")"; LbLeft.Text = "Left (" + ManagerRef.Faces[1, 4].Colors[Direction.Front].Name + ")"; LblFront.Text = "Front (" + ManagerRef.Faces[0, 4].Colors[Direction.Front].Name + ")"; LblRight.Text = "Right (" + ManagerRef.Faces[3, 4].Colors[Direction.Front].Name + ")"; LblUp.Text = "Up (" + ManagerRef.Faces[4, 4].Colors[Direction.Front].Name + ")"; } if (ManagerRef.IsCubeSolved && !ManagerRef.IsHistoryActive) { MoveHistory MH = new MoveHistory(); MH.ManagerRef = ManagerRef; MH.Show(); ManagerRef.IsCubeSolved = false; } }