protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);

            Graphics g = pe.Graphics;

            /*Graphics gbuf = Graphics.FromImage(bmpbuf);
             * gbuf.Clear(this.BackColor);*/

            // Текст
            if (m_value != null && m_value.IsDefined())
            {
                Rectangle m_rect_BorderBounds = new Rectangle(0, 0, this.Width, this.Height);
                if (strFonts == null && strBrushes == null)
                {
                    SmallHelper.DrawMultiString(g, m_rect_BorderBounds, this.m_value.ToString(), this.Font, this.m_brush_String, align_x, align_x2, StringAlignment.Center, offset_x, 0, interval_y);
                }
                else
                {
                    SmallHelper.DrawMultiString(g, m_rect_BorderBounds, this.m_value.ToString(), (this.strFonts == null || !bUseFonts) ? (new Font[] { this.Font }) : this.strFonts, (this.strBrushes == null || !bUseBrushes) ? (new Brush[] { this.m_brush_String }) : this.strBrushes, align_x, align_x2, StringAlignment.Center, offset_x, 0, interval_y);
                }
            }

            /*gbuf.Dispose();
             * g.DrawImage(bmpbuf, 0, 0);
             * g.Dispose();*/
        }
Example #2
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);

            Graphics g = pe.Graphics;

            // Обводка, если нажата мышка
            if (bMousePressed && bMouseOver && !_lock_)
            {
                Rectangle r = m_rect_BorderBounds;
                for (int i = 0; i < highlightPens.Length; i++)
                {
                    SmallHelper.DrawRect(g, highlightPens[i], r);
                    r.X++;
                    r.Y++;
                    r.Width  -= 2;
                    r.Height -= 2;
                }
            }

            // Текст
            if (m_switcher != null && m_switcher.IsDefined())
            {
                SmallHelper.DrawMultiString(g, m_rect_BorderBounds, m_switcher.ToString(), this.Font, this.m_brush_String, align_x, StringAlignment.Near, StringAlignment.Center, offset_x, 0, 0);


                //m_rf_String = SmallHelper.StringInMiddle(g, m_rect_BorderBounds, m_switcher.ToString(), this.Font);
                //g.DrawString(this.m_switcher.ToString(), this.Font, this.m_brush_String, offset_x, m_rf_String.Y);
            }
        }
Example #3
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);

            Graphics g = pe.Graphics;

            // Текст
            String str = "";

            if (m_score != null && m_score.IsDefined())
            {
                if (m_pair != null && m_pair.IsDefined())
                {
                    str = m_score.ToString(m_pair.Pair);
                }
                else
                {
                    str = m_score.ToString(RelativePair);
                }
            }
            Rectangle m_rect_BorderBounds = new Rectangle(0, 0, this.Width, this.Height);

            SmallHelper.DrawMultiString(g, m_rect_BorderBounds, str, this.Font, this.m_brush_String, align_x, align_x2, StringAlignment.Center, offset_x, 0, 0);
        }
Example #4
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
            Graphics g = pe.Graphics;

            // [delme!!!] Заполнить чем-то всю область
            g.FillRectangle(new SolidBrush(Color.Gray), this.ClientRectangle);

            // Граница
            SmallHelper.DrawRect(g, m_pen_Black, new Rectangle(0, 0, total_width, total_height));
            SmallHelper.FillRectInside(g, m_brush, new Rectangle(0, 0, total_width, total_height));

            // Элементы
            Rectangle  r = new Rectangle();
            RectangleF rf;
            int        jw = 1, jh = 1;
            bool       jf = false;
            object     o;

            for (int i = 0; i < DATA__arr.Count; i++)
            {
                for (int j = 0; j < DATA__columns; j++)
                {
                    if (GetJoinInfo(j, i, out jf, out jw, out jh) == true)
                    {
                        if (!jf)
                        {
                            continue;
                        }
                    }

                    r.Width = (jw - 1) * PAINT__border_delay + 2 * jw;
                    for (int x = j; x < (j + jw); x++)
                    {
                        r.Width += PAINT__columns_widths[x];
                    }
                    r.Height = (jh - 1) * PAINT__border_delay + 2 * jh;
                    for (int x = i; x < (i + jh); x++)
                    {
                        r.Height += (x < PAINT__columns_heights.Count ? PAINT__columns_heights[x] : PAINT__data_height);
                    }
                    r.X = (1 + PAINT__border_delay);
                    for (int x = 0; x < j; x++)
                    {
                        r.X += (PAINT__columns_widths[x] + 1 + PAINT__border_delay + 1);
                    }
                    r.Y = (1 + PAINT__border_delay);
                    for (int x = 0; x < i; x++)
                    {
                        r.Y += (x < PAINT__columns_heights.Count ? PAINT__columns_heights[x] : PAINT__data_height) + 1 + PAINT__border_delay + 1;
                    }
                    SmallHelper.DrawRect(g, m_pen_Black, r);
                    bool isHeader = (i < PAINT__headerLinesUp) || (j < PAINT__headerLinesLeft);
                    SmallHelper.FillRectInside(g, (isHeader ? m_brushH : ((i - PAINT__headerLinesUp) % 2 == 0 ? m_brush1 : m_brush2)), r);
                    o  = ((ArrayList)DATA__arr[i])[j];
                    rf = SmallHelper.StringInMiddle(g, r, (o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font));
                    SmallHelper.DrawMultiString(g, r, (o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font), m_brush_Font, StringAlignment.Center, StringAlignment.Center, StringAlignment.Center, 0, 0, -5);
                    //g.DrawString((o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font), m_brush_Font, rf);
                }
            }

            g.Dispose();
        }