예제 #1
0
        public Size GetSize(Font font, Graphics g)
        {
            MeasureMenuItemEventArgs args = new MeasureMenuItemEventArgs(font, g, Size.Empty);

            OnMeasureItem(args);
            return(args.ItemSize);
        }
예제 #2
0
        protected virtual void OnMeasureItem(MeasureMenuItemEventArgs e)
        {
            EventHandler <MeasureMenuItemEventArgs> eh = MeasureItem;

            eh?.Invoke(this, e);
        }
예제 #3
0
        protected override void OnMeasureItem(MeasureMenuItemEventArgs e)
        {
            Size textSize = e.Graphics.MeasureString(Text, e.Font).ToSize();

            e.ItemSize = new Size(Math.Max(minimumWidth, textSize.Width), Math.Max(minimumHeight, textSize.Height));
        }