Inheritance: VisualSimpleBase, IButtonControl, IContentValues
Esempio n. 1
0
        public void createFileButton(String fileName)
        {
            KryptonDropButton button = new KryptonDropButton();
            button.ButtonStyle = ComponentFactory.Krypton.Toolkit.ButtonStyle.Custom1;
            button.ContextMenuStrip = this.contextMenuStrip1;
            button.OverrideDefault.Back.Color1 = System.Drawing.Color.Transparent;
            button.OverrideDefault.Back.Color2 = System.Drawing.Color.Transparent;
            button.OverrideFocus.Border.DrawBorders = ((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders)((((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Top | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Bottom)
                        | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Left)
                        | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Right)));
            button.StateNormal.Back.Color1 = System.Drawing.Color.Transparent;
            button.StateNormal.Back.Color2 = System.Drawing.Color.Transparent;
            button.StateNormal.Border.Color1 = System.Drawing.Color.Transparent;
            button.StateNormal.Border.DrawBorders = ((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders)((((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Top | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Bottom)
                        | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Left)
                        | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Right)));
            button.Values.Image = global::WarehouseApp.Properties.Resources.page_attach;
            button.DropDown += new EventHandler<ContextPositionMenuArgs>(btnFile_DropDown);

            button.Text = fileName;
            using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(new Bitmap(1, 1)))
            {
                //Console.WriteLine((int)graphics.MeasureString(button.Text, button.StateCommon.BackFont).Width);
                button.MinimumSize = new System.Drawing.Size((int)graphics.MeasureString(button.Text, new Font(button.Font.FontFamily, button.Font.Size, GraphicsUnit.Pixel)).Width + 60, 25);
            }

            button.Click += new EventHandler(fileBtn_Click);
            flowLayoutPanel1.Controls.Add(button);
            button.Name = "btnFile" + flowLayoutPanel1.Controls.IndexOf(button).ToString();
        }
        /// <summary>
        /// Initialize a new instance of the KryptonDropButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonDropButtonActionList(KryptonDropButtonDesigner owner)
            : base(owner.Component)
        {
            // Remember the button instance
            _dropButton = owner.Component as KryptonDropButton;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
        /// <summary>
        /// Initialize a new instance of the KryptonDropButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonDropButtonActionList(KryptonDropButtonDesigner owner)
            : base(owner.Component)
        {
            // Remember the button instance
            _dropButton = owner.Component as KryptonDropButton;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
Esempio n. 4
0
 private void btnFile_DropDown(object sender, ContextPositionMenuArgs e)
 {
     KryptonDropButton button = (KryptonDropButton)sender;
     btnFileClicked = button;
 }