Ejemplo n.º 1
0
        //绘制数据栏
        private void drawData(JArray jData)
        {
            if (jData == null)
            {
                return;
            }
            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;  // 更正: 垂直居中
            format.Alignment     = StringAlignment.Center;  // 水平居中
            Font  font  = new Font("微软雅黑", 12, FontStyle.Regular);
            Brush brush = Brushes.Black;

            int RowCount = jData.Count > 20 ? 20 : jData.Count;

            for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                JObject           jRow = (JObject)jData[rowIndex];
                PositionContent[] cols = new PositionContent[10];
                for (int i = 0; i < 10; i++)
                {
                    string content = string.Empty;
                    if (jRow["c" + (i + 1).ToString()] == null)
                    {
                        content = "";
                    }
                    else
                    {
                        content = jRow["c" + (i + 1).ToString()].ToString();
                    }
                    int             tempHeight = _rowHeight[0] + rowIndex + 1 + rowIndex * _rowHeight[1];
                    Rectangle       Rect       = new Rectangle(_colWidth.Take <int>(i).Sum() + i, tempHeight, _colWidth[i], _rowHeight[1]);
                    PositionContent temp       = new PositionContent(content, Rect);
                    cols[i] = temp;
                }
                for (int i = 0; i < cols.Length; i++)
                {
                    if (i != 1)
                    {
                        _gr.DrawString(cols[i].Content, font, brush, cols[i].Rect, format);
                    }
                    else
                    {
                        Rectangle codeRect = cols[i].Rect;
                        int       padding  = 5;
                        Bitmap    numImage = drawNumber(cols[i].Content, cols[i].Rect.Width - padding * 2);
                        _gr.DrawImage(numImage, codeRect.Left + padding, codeRect.Top, cols[i].Rect.Width - padding * 2, _rowHeight[i]);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //绘制标题
        private void drawTitle()
        {
            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;  // 更正: 垂直居中
            format.Alignment     = StringAlignment.Center;  // 水平居中
            Font  font  = new Font("微软雅黑", 12, FontStyle.Regular);
            Brush brush = Brushes.Black;

            _gr.FillRectangle(Brushes.WhiteSmoke, 0, 0, _map.Width, _rowHeight[0]);

            PositionContent[] title = new PositionContent[4];
            title[0] = new PositionContent("时间", new Rectangle(_colWidth.Take <int>(0).Sum() + 0, 0, _colWidth[0], _rowHeight[0]));
            title[1] = new PositionContent("开奖号码", new Rectangle(_colWidth.Take <int>(1).Sum() + 1, 0, _colWidth[1], _rowHeight[0]));
            title[2] = new PositionContent("冠亚军和", new Rectangle(_colWidth.Take <int>(2).Sum() + 2, 0, _colWidth[2] + _colWidth[3] + _colWidth[4], _rowHeight[0]));
            title[3] = new PositionContent("1-5龍虎", new Rectangle(_colWidth.Take <int>(5).Sum() + 5, 0, _colWidth[5] + _colWidth[6] + _colWidth[7] + _colWidth[8] + _colWidth[9], _rowHeight[0]));

            for (int i = 0; i < title.Length; i++)
            {
                _gr.DrawString(title[i].Content, font, brush, title[i].Rect, format);
            }
        }