예제 #1
0
        protected internal virtual void RaiseDrawButtonEvent(DrawButtonEventArgs e)
        {
            DrawButtonEventHandler handler = (DrawButtonEventHandler)this.Events[drawButton];

            if (handler != null)
            {
                handler(GetEventSender(), e);
            }
        }
예제 #2
0
        protected override void DrawButton(ButtonEditViewInfo viewInfo, EditorButtonObjectInfoArgs info)
        {
            DrawButtonEventArgs e = new DrawButtonEventArgs(info);

            (viewInfo.Item as RepositoryItemMyButtonEdit).RaiseDrawButtonEvent(e);
            if (!e.Handled)
            {
                base.DrawButton(viewInfo, info);
            }
        }
        private void myButtonEdit2_DrawButton(object sender, DrawButtonEventArgs e)
        {
            switch (e.Index)
            {
            case 0:
                e.State = ObjectState.Hot;
                break;

            case 1:
                e.Handled = true;
                int textOffset = 0;
                DrawCustomButton(e, textOffset);
                break;
            }

            labelControl2.Text = "CustomEditButton2 " + "index = " + " " + e.Index.ToString() + " button State = " + e.State.ToString();
        }
        void myButtonEdit1_DrawButton(object sender, DrawButtonEventArgs e)
        {
            switch (e.Index)
            {
            case 0:
                e.Handled = true;
                int textOffset = 4;
                DrawCustomButton(e, textOffset);
                break;

            case 1:
                if (e.State == ObjectState.Hot || e.State == ObjectState.Pressed || e.State == ObjectState.Selected)
                {
                    e.Appearance.BackColor = Color.LightSkyBlue;
                }
                break;
            }

            labelControl1.Text = "CustomEditButton1 " + "index = " + " " + e.Index.ToString() + " button State = " + e.State.ToString();
        }
        private void DrawCustomButton(DrawButtonEventArgs e, int textOffset)
        {
            using (LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, Color.DarkBlue, Color.LightSkyBlue, 30)) {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }

            e.Graphics.DrawLine(Pens.Black, new Point(e.Bounds.X + 1, e.Bounds.Y + 1), new Point(e.Bounds.Right, e.Bounds.Y + 1));
            e.Graphics.DrawLine(Pens.Black, new Point(e.Bounds.X + 1, e.Bounds.Y + 1), new Point(e.Bounds.X + 1, e.Bounds.Bottom - 2));
            e.Graphics.DrawLine(Pens.LightGray, new Point(e.Bounds.Right + 2, e.Bounds.Y + 2), new Point(e.Bounds.Right - 2, e.Bounds.Bottom - 2));
            e.Graphics.DrawLine(Pens.LightGray, new Point(e.Bounds.X + 2, e.Bounds.Bottom - 2), new Point(e.Bounds.Right - 2, e.Bounds.Bottom - 2));

            using (SolidBrush whiteBrush = new SolidBrush(Color.White)) {
                e.Graphics.DrawString(e.Caption, e.Appearance.GetFont(), whiteBrush, new Point(e.Bounds.X + textOffset, e.Bounds.Y + textOffset));
            }

            using (SolidBrush yellowBrush = new SolidBrush(Color.Yellow)) {
                SizeF size = e.Cache.CalcTextSize(e.Caption, e.Appearance.GetFont(), new StringFormat(), e.Bounds.Size.Width);
                e.Graphics.DrawString("...", e.Appearance.GetFont(), yellowBrush, new Point(e.Bounds.X + textOffset + 2 + (int)size.Width, e.Bounds.Y + 1));
            }
        }