C1FlexGrid 画线

private void flxDetail_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            if (this.flxDetail.Rows.Count <= 1)
            {
                return;
            }

            // セルの描画を開始
            e.DrawCell();

            // タイトルに下線を描画
            if (e.Row == 0)
            {
                float b = e.Bounds.Bottom - 2;
                e.Graphics.DrawLine(pen, e.Bounds.Left, b, e.Bounds.Right, b);
            }

            // 3行毎に下線を描画
            if (e.Row >= 1)
            {
                if (e.Col < 4)
                {
                    float b = e.Bounds.Bottom - 2;
                    e.Graphics.DrawLine(pen, e.Bounds.Left, b, e.Bounds.Right, b);
                }

                if (e.Row % 3 == 0 && e.Col >= 4)
                {
                    float b = e.Bounds.Bottom - 2;
                    e.Graphics.DrawLine(pen, e.Bounds.Left, b, e.Bounds.Right, b);
                }
            }
            // 合計列の右側にも線を描画
            if (e.Col == 4)
            {
                float r = e.Bounds.Right - pen.Width;
                e.Graphics.DrawLine(pen, r, e.Bounds.Top, r, e.Bounds.Bottom);
            }

            // 確保状態列の左側にも線を描画
            if (e.Col == 1 && e.Row >= 1)
            {
                float r = (float)(e.Bounds.Left + 0.1);
                e.Graphics.DrawLine(pen, r, e.Bounds.Top, r, e.Bounds.Bottom);
            }
            // 最後列の右側にも線を描画
            if (e.Col == this.flxDetail.Cols.Count - 1 && e.Row >= 1)
            {
                float r = e.Bounds.Right - pen.Width;
                e.Graphics.DrawLine(pen, r, e.Bounds.Top, r, e.Bounds.Bottom);
            }

            // 描画終了
            e.Handled = true;
        }

 

posted @ 2025-12-03 16:14  _jwj  阅读(2)  评论(0)    收藏  举报