public MenuContainerLevelTwo(Form parent_, MenuContainer hLevelContainer_, MenuButton hLevelButton_) : base(parent_) { hLevelContainer = hLevelContainer_; hLevelButton = hLevelButton_; this.VisibleChanged += MenuContainerLevelTwo_VisibleChanged; this.ControlAdded += MenuContainerLevelTwo_ControlAdded; this.MouseEnter += MenuContainerLevelTwo_MouseEnter; this.Paint += MenuContainerLevelTwo_Paint; this.Width = 300; this.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.WrapContents = false; // this.AutoScroll = true; }
public MenuButtonLevelTwo(List <Connections.AtiranAccModel.Menu> childeren_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_) : base(childeren_, self_, parent_) { this.Width = 300; this.Font = UI.WindowsForms.FontManager.GetFont("IRANSans", 9.5F, FontStyle.Regular); indicator = new Panel() { Dock = System.Windows.Forms.DockStyle.Right, BackColor = Color.Transparent, Width = 5 }; rightSpace.Controls.Add(indicator); rightSpace.Width = 20; title.Width = 300 - 20; title.Height = 23; this.Height = 23; this.title.MouseEnter += MenuButtonLevelTwo_MouseEnter; this.rightSpace.MouseEnter += MenuButtonLevelTwo_MouseEnter; this.title.MouseLeave += Title_MouseLeave; this.rightSpace.MouseLeave += Title_MouseLeave; focusedLevelTwo = true; }
public MenuButton(List <Connections.AtiranAccModel.Menu> menuData_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_) { this.Margin = new Padding(0); menuData = menuData_; self = self_; children = menuData.Where(md => md.ParentMenuID == self.MenuID).OrderBy(i => i.order).ToList(); parent = parent_; parent.AddItem(this); tlp = new ToolTip(); tlp.OwnerDraw = true; tlp.Draw += Tlp_Draw; tlp.Popup += Tlp_Popup; this.FlowDirection = FlowDirection.RightToLeft; rightSpace = new Panel(); rightSpace.Height = this.Height; rightSpace.Margin = new Padding(0); this.Controls.Add(rightSpace); title = new Label(); if (children.Count > 0) { title.Image = ResourceManager.GetResourceManager().GetObject("sort_down_green") as Image; title.ImageAlign = ContentAlignment.MiddleLeft; title.Padding = new Padding(5, 0, 0, 0); } title.TextAlign = ContentAlignment.MiddleRight; title.Text = (self_.Titel.Length > title.Width) ? " ... " + self_.Titel.Remove(self_.Titel.LastIndexOf(' ')).ToString() : self_.Titel; title.Tag = self_.MenuID; title.Height = this.Height; title.Margin = new Padding(0); this.Controls.Add(title); this.ControlAdded += MenuButton_ControlAdded; this.Enter += MenuButton_Enter; childContainer = new MenuContainerLevelTwo((Atiran.UI.WindowsForms.UIElements.Form) this.Parent.Parent, (MenuContainer)this.parent, this); ((Atiran.UI.WindowsForms.UIElements.Form) this.Parent.Parent).AddToSubMenus(childContainer); childContainer.Visible = false; if (children != null && children.Count > 0) { foreach (Connections.AtiranAccModel.Menu c in children) { MenuButtonLevelTwo mb = new MenuButtonLevelTwo(menuData, c, childContainer); } } childContainer.Top = this.Top + 69; //childContainer.Left = this.parent.Left - 200; this.BackColor = Color.FromArgb(56, 79, 99); this.ForeColor = Color.FromArgb(255, 255, 255); this.title.MouseMove += MenuButtonMouseMove; this.title.MouseLeave += MenuButton_MouseLeave; this.title.MouseEnter += MenuButton_MouseEnter; this.title.Click += MenuButton_Click; this.rightSpace.MouseMove += MenuButtonMouseMove; this.rightSpace.MouseLeave += MenuButton_MouseLeave; this.rightSpace.MouseEnter += MenuButton_MouseEnter; this.rightSpace.Click += MenuButton_Click; this.MouseHover += MenuButton_MouseHover; }
public MenuButtonLevelOne(List <Connections.AtiranAccModel.Menu> childeren_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_) : base(childeren_, self_, parent_) { this.Height = 35; this.Width = 200; this.Font = FontManager.GetFont("IRANSans", 11F, FontStyle.Regular); rightSpace.Width = 30; title.Width = 200 - 30; title.Height = 35; this.rightSpace.MouseEnter += MenuButtonLevelOne_MouseEnter; this.title.MouseEnter += MenuButtonLevelOne_MouseEnter; this.rightSpace.MouseLeave += RightSpace_MouseLeave; this.title.MouseLeave += RightSpace_MouseLeave; }