public void FrmLayout_Load(object sender, EventArgs e) { button1.changeColor(Color.White, Color.Red); button2.changeColor(Color.White, Color.DimGray); button3.changeColor(Color.White, Color.DimGray); sections = new ArrayList(); sections.Clear(); listPanel.Clear(); DataTable sectionList = serviceGet.getSections("1001"); for (int i = 0; i < sectionList.Rows.Count; i++) { string sectionName = sectionList.Rows[i][1].ToString(); sections.Add(sectionName); ArrayList tmp = new ArrayList(); tmp = serviceGet.getTables("1001", sectionName); //Int64 a = (Int64)sectionList.Rows[i][2]; Color color1 = Color.FromArgb((int)sectionList.Rows[i][2]); Color color2 = Color.FromArgb((int)sectionList.Rows[i][3]); PanelLayout panel = new PanelLayout(sectionName, tmp, color1, color2, isTransfer); listPanel.Add(sectionName, panel); this.Controls.Add((PanelLayout)listPanel[sectionName]); } if (isTransfer) { button1.Text = "Quay về"; for (int i = 2; i < 8; i++) { var tmp = (button)panel4.Controls["button" + i.ToString()]; //tmp.changeColor(Color.White,Color.LightGray); tmp.Enabled = false; } } pageIndex = 1; selectedSection = 0; if (listPanel.Count % 4 == 0) { pageNum = listPanel.Count / 4; } else { pageNum = listPanel.Count / 4 + 1; } for (int i = 10; i < 14; i++) { var tmp = (button)panel3.Controls["button" + i.ToString()]; //tmp.changeColor(Color.White,Color.LightGray); tmp.Click += new EventHandler(tmp_Click); } LoadSectionButton(); var tmppanel = (PanelLayout)listPanel[sections[0].ToString()]; tmppanel.BringToFront(); this.Refresh(); }
// Switch the active window to the one given by windowIndex public void SetActivePanel(int panelIndex) { if (panelIndex < 0 || panelIndex > panels.Count - 1) { throw new Exception("Cannot switch to a window that doesn't exist"); } if (activePanel != null) { tabs[panels.IndexOf(activePanel)].tabFace.GetComponent <Button>().interactable = true; // Move most recent tab to front of all borders, but back of main window tabs[panels.IndexOf(activePanel)].tabFace.transform.SetSiblingIndex(tabs.Count); } activePanel = panels[panelIndex]; activePanel.transform.SetAsLastSibling(); tabs[panelIndex].tabFace.GetComponent <Button>().interactable = false; foreach (PanelLayout panel in panels) { panel.gameObject.SetActive(false); } activePanel.gameObject.SetActive(true); // Move current tab face to front of portfolio's children tabs[panelIndex].tabFace.transform.SetAsLastSibling(); }
public int LayoutMenuOptions(string[] options, PanelLayout type) { _panel_area = _client_area; lock (this) { MenuOptions = options; if (MenuOptions != null) { // Step1; if no MenuLocations or MenuLocations Length not the same as MenuOptions Length // then create/recreate MenuLocations with the right size. if (MenuLocations == null) { MenuLocations = new Rectangle[MenuOptions.Length]; } else if (MenuLocations.Length != MenuOptions.Length) { MenuLocations = new Rectangle[MenuOptions.Length]; } //Step2; Initialize all MenuLocations to the empty rectangle. //Step3; Set the layout type and return the total height of the MenuOptions, (useful for resizing) _layout = type; _menu_item_height = 0; for (int i = 0; i < MenuOptions.Length; i++) { MenuLocations[i] = _font.MeasureString(null, MenuOptions[i], DrawTextFormat.None, Color.Yellow); switch (type) { case PanelLayout.Vertical: goto case PanelLayout.VerticalFree; case PanelLayout.VerticalFree: MenuLocations[i].Height = (int)(MenuLocations[i].Height * 1.5); _menu_item_height += MenuLocations[i].Height; break; case PanelLayout.Horizontal: goto case PanelLayout.HorizontalFree; case PanelLayout.HorizontalFree: MenuLocations[i].Width = (int)(MenuLocations[i].Width * 1.5); MenuLocations[i].Height = _panel_area.Height; _menu_item_height += MenuLocations[i].Width; break; default: throw new ArgumentException("LayoutMenuOptions: Unsupported Layout type."); } } LayoutButtons(type); return(_menu_item_height); } } return(0); }
public PanelMenu(Microsoft.DirectX.Direct3D.Font font, PanelMenuSelectHandler handler) { _client_area = Rectangle.Empty; _Sticky = false; _font = font; _handler = handler; _layout = PanelLayout.Horizontal; }
public TileData(PanelLayout layout) { PanelId = layout.PanelId; X = layout.X; Y = layout.Y; O = layout.O; ShapeType = layout.ShapeType; SetSideLength(); }
public PanelMenu(Microsoft.DirectX.Direct3D.Font font, string text, int x1, int y1, int x2, int y2, PanelMenuSelectHandler handler) { _client_area.X = x1; _client_area.Y = y1; _client_area.Width = x2 - x1; _client_area.Height = y2 - y1; _font = font; _handler = handler; _layout = PanelLayout.Horizontal; _Sticky = false; }
public void LayoutButtons(PanelLayout type) { _button_material.Diffuse = Window.CaptionColor; _arrow_material.Diffuse = Window.CaptionForeground; _arrow_selected.Diffuse = Color.Yellow; int arrow_size = ScrollButtonWidth / 2; switch (type) { case PanelLayout.Vertical: goto case PanelLayout.VerticalFree; case PanelLayout.VerticalFree: if (_panel_area.Height < _menu_item_height) { _panel_area.X += 1; _panel_area.Width -= 2; _panel_area.Height -= ScrollButtonWidth * 2; _panel_area.Y += ScrollButtonWidth; _up_button_area = new Rectangle(_client_area.X, _client_area.Y, _panel_area.Width, ScrollButtonWidth); _up_arrow = new Rectangle(_client_area.X + (int)(.5 * (_client_area.Width - arrow_size)), _client_area.Y + (int)(.5 * arrow_size), arrow_size, arrow_size); _down_button_area = new Rectangle(_client_area.X, _panel_area.Bottom, _panel_area.Width, ScrollButtonWidth); _down_arrow = new Rectangle(_up_arrow.X, _panel_area.Bottom + (int)(.5 * arrow_size), arrow_size, arrow_size); } break; case PanelLayout.Horizontal: goto case PanelLayout.HorizontalFree; case PanelLayout.HorizontalFree: if (_panel_area.Width < _menu_item_height) { _panel_area.Width -= (ScrollButtonWidth * 2) + 2; _panel_area.X += ScrollButtonWidth + 1; _left_button_area = new Rectangle(_client_area.X, _client_area.Y, ScrollButtonWidth, _client_area.Height); _left_arrow = new Rectangle(_client_area.X + (int)(.5 * arrow_size), _client_area.Y + (int)(.5 * (_client_area.Height - arrow_size)), arrow_size, arrow_size); _right_button_area = new Rectangle(_panel_area.Right, _client_area.Y, ScrollButtonWidth, _client_area.Height); _right_arrow = new Rectangle(_panel_area.Right + (int)(.5 * arrow_size), _left_arrow.Y, arrow_size, arrow_size); } break; default: throw new ArgumentException("LayoutMenuOptions: Unsupported Layout type."); } }
public FrmBanHang formBanHang; // Xu ly transfer public FrmLayout() { InitializeComponent(); sections = new ArrayList(); for (int i = 1; i < 8; i++) { sections.Add(i.ToString()); ArrayList tmp = new ArrayList(); button aa = new button(100, 100, 50, 50); aa.Text = i.ToString(); tmp.Add(aa); PanelLayout panel = new PanelLayout(tmp, i.ToString()); listPanel.Add(i.ToString(), panel); this.Controls.Add((PanelLayout)listPanel[i.ToString()]); } }
public Orchestrator(Device device) { Device = device; ScheduleTimer = new ScheduleTimer(this); PanelLayout = new PanelLayout(Device); _eventTriggersCollection = new EventTriggersCollection(this); // Custom effect initialization must come after panel layout initialization as custom screen mirror effect needs the panel layout _customEffects = new CustomEffectsCollection(Device, this); if (device.OperationMode == OperationMode.Schedule) { ScheduleTimer.StartTimer(); } else if (device.OperationMode == OperationMode.Manual) { Task.Run(() => ActivateEffect(Device.OverrideEffect, Device.OverrideBrightness)); } }
/// <summary> /// Draws the layout and gives the polygons colors /// </summary> /// <param name="resetLayout"> /// If true, the panel layout is always requested from the panels /// even if it has been retrieved before. /// </param> public void DrawLayout(bool resetLayout = false) { CanvasArea.Children.Clear(); if (resetLayout || _panelLayout == null) { var orchestrator = OrchestratorCollection.GetOrchestratorForDevice(UserSettings.Settings.ActiveDevice); if (orchestrator == null) { return; } _panelLayout = orchestrator.PanelLayout; } _polygons = _panelLayout.GetScaledPolygons((int)ActualWidth, (int)ActualHeight, ScaleType.Fit, FlipType.None); if (_polygons == null || !_polygons.Any()) { return; } if (_panelsClickable) { foreach (var polygon in _polygons) { polygon.Polygon.MouseDown += PolygonClicked; } } //Draw the triangles foreach (var polygon in _polygons) { CanvasArea.Children.Add(polygon.Polygon); } UpdateColors(); }
////////////////////////////////////////////////////////////////////////////////// public void Reload() { button1.changeColor(Color.White, Color.Red); button2.changeColor(Color.White, Color.DimGray); button3.changeColor(Color.White, Color.DimGray); //if (sections != null) //{ // for (int i = 0; i < sections.Count; i++) // { // ((PanelLayout)listPanel[sections[i].ToString()]).Dispose(); // } // //sections.Clear(); // sections = null; //} //sections = new ArrayList(); //listPanel.Clear(); //listPanel = null; System.GC.Collect(); //listPanel = new Hashtable(); //DataTable sectionList = serviceGet.getSections("1001"); for (int i = 0; i < sections.Count; i++) { //string sectionName = sectionList.Rows[i][1].ToString(); //sections.Add(sectionName); ArrayList tmp = new ArrayList(); tmp = serviceGet.getTables("1001", sections[i].ToString()); //Int64 a = (Int64)sectionList.Rows[i][2]; //Color color1 = Color.FromArgb((int)sectionList.Rows[i][2]); //Color color2 = Color.FromArgb((int)sectionList.Rows[i][3]); //PanelLayout panel = new PanelLayout(sections[i].ToString(), tmp, isTransfer); //listPanel.Add(sectionName, panel); //this.Controls.Add((PanelLayout)listPanel[sectionName]); PanelLayout panelLayout = (PanelLayout)listPanel[sections[i].ToString()]; panelLayout.Reload(sections[i].ToString(), tmp, false); } //if (isTransfer) //{ // button1.Text = "Quay về"; // for (int i = 2; i < 8; i++) // { // var tmp = (button)panel4.Controls["button" + i.ToString()]; // //tmp.changeColor(Color.White,Color.LightGray); // tmp.Enabled = false; // } //} if (listPanel.Count % 4 == 0) { pageNum = listPanel.Count / 4; } else { pageNum = listPanel.Count / 4 + 1; } //for (int i = 10; i < 14; i++) //{ // var tmp = (button)panel3.Controls["button" + i.ToString()]; // //tmp.changeColor(Color.White,Color.LightGray); // tmp.Click += new EventHandler(tmp_Click); //} LoadSectionButton(); var tmppanel = (PanelLayout)listPanel[sections[selectedSection].ToString()]; tmppanel.BringToFront(); this.Refresh(); }
public Panel(int margin, PanelLayout layout = PanelLayout.Stacking) { this.layout = layout; this.margin = margin; }
public int LayoutMenuOptions(string[] options, PanelLayout type) { _panel_area = _client_area; lock (this) { MenuOptions = options; if (MenuOptions != null) { // Step1; if no MenuLocations or MenuLocations Length not the same as MenuOptions Length // then create/recreate MenuLocations with the right size. if (MenuLocations == null) { MenuLocations = new Rectangle[MenuOptions.Length]; } else if (MenuLocations.Length != MenuOptions.Length) { MenuLocations = new Rectangle[MenuOptions.Length]; } //Step2; Initialize all MenuLocations to the empty rectangle. //Step3; Set the layout type and return the total height of the MenuOptions, (useful for resizing) _layout = type; _menu_item_height = 0; for (int i = 0; i < MenuOptions.Length; i++) { MenuLocations[i] = _font.MeasureString(null, MenuOptions[i], DrawTextFormat.None, Color.Yellow); switch (type) { case PanelLayout.Vertical: goto case PanelLayout.VerticalFree; case PanelLayout.VerticalFree: MenuLocations[i].Height = (int)(MenuLocations[i].Height * 1.5); _menu_item_height += MenuLocations[i].Height; break; case PanelLayout.Horizontal: goto case PanelLayout.HorizontalFree; case PanelLayout.HorizontalFree: MenuLocations[i].Width = (int)(MenuLocations[i].Width * 1.5); MenuLocations[i].Height = _panel_area.Height; _menu_item_height += MenuLocations[i].Width; break; default: throw new ArgumentException("LayoutMenuOptions: Unsupported Layout type."); } } LayoutButtons(type); return _menu_item_height; } } return 0; }