/// <summary> /// Builder for the daughter GroupButton class /// </summary> /// <param name="settings">Group settings for button colors</param> protected ToolButton(CategoryColorSettings settings) { InitializeComponent(); //To fit the control to the Linux version if (System.Environment.OSVersion.Platform == PlatformID.Unix) { this.Font = new System.Drawing.Font("Sans", 8.25F, System.Drawing.FontStyle.Regular); } //The appearance of the control is set this.BackColor = settings.BackColor; this.FlatAppearance.MouseOverBackColor = settings.ActionButtonOverColor; this.FlatAppearance.MouseDownBackColor = settings.ActionButtonOverColor; //To avoid the focus effect this.SetStyle(ControlStyles.UserPaint, true); }
/// <summary> /// Builder /// </summary> /// <param name="group">Virtual action with the data for the button</param> /// <param name="settings">Graphical parameters of the action Group</param> public ToolGroupButton(Group group, CategoryColorSettings settings) : base(settings) { InitializeComponent(); if (System.Environment.OSVersion.Platform == PlatformID.Unix) { this.Font = new System.Drawing.Font("Sans", 8, System.Drawing.FontStyle.Regular); } //A background image is loaded with the arrow this.BackgroundImage = Moway.Project.GraphicProject.Controls.GraphicResources.bgGroupButton; this.Text = group.Text; this.Image = group.Icon; //The timer is set for the effect of appearing in the subaction panel this.tGroupButton.Tick += new EventHandler(tGroupButton_Tick); //The group's graphical parameters are saved this.groupSettings = settings; }
/// <summary> /// Builder /// </summary> /// <param name="tool">Action the button represents</param> /// <param name="settings">Group settings for button colors</param> public ToolButton(Tool tool, CategoryColorSettings settings) : base() { InitializeComponent(); //To fit the control to the Linux version if (System.Environment.OSVersion.Platform == PlatformID.Unix) { this.Font = new System.Drawing.Font("Sans", 8.25F, System.Drawing.FontStyle.Regular); } //The appearance of the control is set this.BackColor = settings.BackColor; this.FlatAppearance.MouseOverBackColor = settings.ActionButtonOverColor; this.FlatAppearance.MouseDownBackColor = settings.ActionButtonOverColor; //To avoid the focus effect this.SetStyle(ControlStyles.Selectable, false); //Saves the action to which the button represents and displays the text and image this.tool = tool; this.Text = this.tool.Text; this.Image = this.tool.Icon; }
/// <summary> /// Builder /// </summary> /// <param name="tools">List of tools to display in the panel</param> /// <param name="settings">Configuration of the group for the visual part</param> public ToolGroupPanel(List <Tool> tools, CategoryColorSettings settings) { InitializeComponent(); this.BackColor = settings.BackColor; this.borderColor = settings.ActionButtonOverColor; //To avoid the effect of the button being selected this.SetStyle(ControlStyles.UserPaint, true); //Shows 1 button for each tool for (int i = 0; i < tools.Count; i++) { ToolButton button = new ToolButton(tools[i], settings); button.InitInsert += new ToolEventHandler(Button_InitInsert); button.DoInsert += new PointEventHandler(Button_DoInsert); button.CancelInsert += new EventHandler(Button_CancelInsert); button.MouseEnter += new EventHandler(Button_MouseEnter); button.MouseLeave += new EventHandler(Button_MouseLeave); button.Location = new Point(INIT_X, INIT_Y + (i * ToolPanel.BUTTON_SEPARATION)); button.Size = new Size(BUTTON_WIDTH, button.Height); this.toolTip.SetToolTip(button, tools[i].ToolTipText); this.Controls.Add(button); } //The size of the panel is dynamically calculated this.Size = new Size(this.Width, INIT_Y + 3 + (tools.Count * ToolPanel.BUTTON_SEPARATION)); }