예제 #1
0
        public void Render(Graphics g, Point offset)
        {
            Rectangle bounds = base.Bounds;

            bounds.X += offset.X;
            bounds.Y += offset.Y;
            using (Brush brush = new SolidBrush(this.ForeColor))
            {
                using (Brush brush2 = new SolidBrush(this.BackColor))
                {
                    Rectangle rc = bounds;
                    ExtendDraw.FillRoundedRectangle(g, brush, rc, base.m_scale * 5, 3);
                    rc.Inflate(-base.m_scale, -base.m_scale);
                    ExtendDraw.FillRoundedRectangle(g, brush2, rc, base.m_scale * 5, 3);
                }
                Region clip = g.Clip;
                bounds    = this.GetTextBounds(g);
                bounds.X += offset.X;
                bounds.Y += offset.Y;
                g.Clip    = new Region(bounds);
                StringFormat format = new StringFormat();
                if (!this.m_bMultiLine)
                {
                    SizeF ef = g.MeasureString(this.Text, base.Font);
                    if (bounds.Width <= ef.Width)
                    {
                        bounds.Width = (int)ef.Width;
                    }
                    format.LineAlignment = StringAlignment.Center;
                }
                format.Alignment = StringAlignment.Center;
                g.DrawString(this.Text, base.Font, brush, bounds, format);
                g.Clip = clip;
            }
        }
예제 #2
0
 public void Render(Graphics g, Point offset)
 {
     using (Brush brush = new SolidBrush(this.BackColor))
     {
         using (Brush brush2 = new SolidBrush(this.ForeColor))
         {
             Rectangle bounds = base.Bounds;
             bounds.X     += offset.X;
             bounds.Y     += offset.Y;
             bounds.Height = this.m_itemHeight;
             int num  = 0;
             int num2 = this.m_items.Length - 1;
             foreach (Resco.Controls.MessageBox.MenuItem item in this.m_items)
             {
                 bool flag = num == this.m_selected;
                 if (num == num2)
                 {
                     ExtendDraw.FillRoundedRectangle(g, flag ? brush2 : brush, bounds, base.m_scale * 5, 12);
                 }
                 else
                 {
                     g.FillRectangle(flag ? brush2 : brush, bounds);
                 }
                 if (item.Image != null)
                 {
                     int num3 = (bounds.Height - item.Image.Height) / 2;
                     ExtendDraw.DrawImage(g, item.Image, num3 + bounds.Left, num3 + bounds.Top, item.Image.GetPixel(0, 0));
                 }
                 StringFormat format = new StringFormat();
                 format.Alignment     = StringAlignment.Center;
                 format.LineAlignment = StringAlignment.Center;
                 g.DrawString(item.Text, base.Font, flag ? brush : brush2, bounds, format);
                 if (!item.Enabled)
                 {
                     Rectangle rect = bounds;
                     rect.Inflate(-2 * base.m_scale, -2 * base.m_scale);
                     ExtendDraw.BlendRect(g, rect, Color.FromArgb(-2130706433));
                 }
                 if (num > 0)
                 {
                     using (Pen pen = new Pen(this.LineColor))
                     {
                         g.DrawLine(pen, bounds.X, bounds.Y, bounds.Right - 1, bounds.Y);
                     }
                 }
                 num++;
                 bounds.Y += this.m_itemHeight;
             }
         }
     }
 }