Форум программистов, компьютерный форум, киберфорум
C# Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск  
 
 
Рейтинг 4.78/170: Рейтинг темы: голосов - 170, средняя оценка - 4.78
 Аватар для kraldraav
30 / 30 / 6
Регистрация: 24.04.2010
Сообщений: 145

Печать из DataGridView: в предварительном просмотре таблица искажается

20.08.2010, 12:31. Показов 33078. Ответов 31
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Всем доброго времени суток!!!
С толкнулся с проблемой, а именно - была поставлена задача выводить на печать данные из DataGridView. Подумав, по размышляя, посидев написал более менее ясную програмулю. Но проблема в том, что в предварительном просмотре таблица искажается, т.е. изменяются размеры между столбцами, либо они наезжают друг на друга...

Ниже привожу код и скрин.

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
        void pDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;
            int x = 0;
            int y = 20;
            int cell_height = 0;
 
            int colCount = dataGridView1.ColumnCount;
            int rowCount = dataGridView1.RowCount-1;
            int current_col = 0;
            int current_row = 0;
            string value = "";
 
            int width = dataGridView1[current_col, current_row].Size.Width;
            int height = dataGridView1[current_col, current_row].Size.Height;
 
            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);
 
 
            while (current_col < colCount)
            {
                x += dataGridView1[current_col, current_row].Size.Width;
                cell_height = dataGridView1[current_col, current_row].Size.Height;
                cell_border = new Rectangle(x, y, width, height);
                value = dataGridView1.Columns[current_col].HeaderText.ToString();
                g.DrawRectangle(new Pen(Color.Black), cell_border);
                g.DrawString(value, new Font("Tahoma", 9, FontStyle.Bold, GraphicsUnit.Point), brush, x, y);
                current_col++;
            }
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    x += dataGridView1[current_col, current_row].Size.Width;
                    cell_height = dataGridView1[current_col, current_row].Size.Height;
                    cell_border = new Rectangle(x, y, width, height);
                    value = dataGridView1[current_col, current_row].Value.ToString();
                    g.DrawRectangle(new Pen(Color.Black), cell_border);
                    g.DrawString(value, new Font("Tahoma", 8, FontStyle.Regular, GraphicsUnit.Point), brush, x, y);
                    current_col++;
                }
                current_col = 0;
                current_row++;
                x = 0;
                y += cell_height;
            }
 
        }
Миниатюры
Печать из DataGridView: в предварительном просмотре таблица искажается  
2
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
20.08.2010, 12:31
Ответы с готовыми решениями:

Отображение документа word в предварительном просмотре
как записать макрос который это делает, если макрос не записывает действия через вкладку файл?

Масштаб отчета при предварительном просмотре
Уважаемые форумчане, подскажите, имется ли возможность задания масштаба при предварительном просмотре отчета перед его печатью....

Отчет. Глюк при предварительном просмотре
Никак не могу понять в чем проблема, подскажите знающие люди... Суть: 1. Запрос формирует некую выборку из таблицы. 2. Этот запрос служит...

31
98 / 101 / 30
Регистрация: 21.10.2012
Сообщений: 320
13.12.2014, 13:30
Студворк — интернет-сервис помощи студентам
А как быть, когда вся таблица не влезает на лист А4 ??? Тогда придется сменить ориентацию с книжной на альбомную, что ли ? Подкиньте идей...
0
98 / 101 / 30
Регистрация: 21.10.2012
Сообщений: 320
24.01.2015, 15:15
Уважаемые, а не подскажите, почему при таком варианте, не печатается первая строка ???
0
0 / 0 / 0
Регистрация: 15.05.2014
Сообщений: 22
06.05.2015, 19:24
не печатается первая строка, как сделать что бы она печаталась ?
0
 Аватар для Lamak
6 / 6 / 1
Регистрация: 17.08.2012
Сообщений: 75
07.07.2015, 12:58
не печатается первая и последняя строки

Добавлено через 1 час 37 минут
А так печатаются:
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
public void printDocRazvoz_PrintPage(object sender, PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;
            int x = 0;
            int y = 20;
            int cell_height = 0;
 
            int colCount = dGridViewRazvoz.ColumnCount;
            int rowCount = dGridViewRazvoz.RowCount;
 
            Font font = new Font("Tahoma", 9, FontStyle.Regular, GraphicsUnit.Point);
 
            int[] widthC = new int[colCount];
 
            int current_col = 0;
            int current_row = 0;
 
            while (current_col < colCount)
            {
                if (g.MeasureString(dGridViewRazvoz.Columns[current_col].HeaderText.ToString(), font).Width > widthC[current_col])
                {
                    widthC[current_col] = (int)g.MeasureString(dGridViewRazvoz.Columns[current_col].HeaderText.ToString(), font).Width;
                }
                current_col++;
            }
 
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    if (g.MeasureString(dGridViewRazvoz[current_col, current_row].Value.ToString(), font).Width > widthC[current_col])
                    {
                        widthC[current_col] = (int)g.MeasureString(dGridViewRazvoz[current_col, current_row].Value.ToString(), font).Width;
                    }
                    current_col++;
                }
                current_col = 0;
                current_row++;
            }
 
            current_col = 0;
            current_row = 0;
 
            string value = "";
 
            int width = widthC[current_col]+5;
            int height = dGridViewRazvoz[current_col, current_row].Size.Height;
 
            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);
 
 
            while (current_col < colCount)
            {
                width = widthC[current_col];
                cell_height = dGridViewRazvoz[current_col, current_row].Size.Height;
                cell_border = new Rectangle(x, y, width, height);
                value = dGridViewRazvoz.Columns[current_col].HeaderText.ToString();
                g.DrawRectangle(new Pen(Color.Black), cell_border);
                g.DrawString(value, font, brush, x, y);
                x += widthC[current_col];
                current_col++;
            }
            current_row = -1;
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    width = widthC[current_col];
                    cell_height = dGridViewRazvoz[current_col, current_row].Size.Height;
                    cell_border = new Rectangle(x, y, width, height);
                    value = dGridViewRazvoz[current_col, current_row].Value.ToString();
                    g.DrawRectangle(new Pen(Color.Black), cell_border);
                    g.DrawString(value, font, brush, x, y);
                    x += widthC[current_col];
                    current_col++;
                }
                current_col = 0;
                current_row++;
                x = 0;
                y += cell_height;
            }
        }
Проблема в том, что в предпросмотре отображается только 1 страница
0
0 / 0 / 0
Регистрация: 23.12.2013
Сообщений: 8
09.09.2015, 00:26
Вот корректный код, если кому нужно.
В последнем примере затиралась первая и последняя строка из DataGridView

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
        private void printDocument_PrintPage3(object sender, PrintPageEventArgs e) // Метод печати для printDocument
        {
//DataGridView в моем случае это EveryDayReport
            Graphics g = e.Graphics;
            int x = 0;
            int y = 20;
            int cell_height = 0;
 
            int colCount = EveryDayReport.ColumnCount;
            int rowCount = EveryDayReport.RowCount;
 
            Font font = new Font("Tahoma", 9, FontStyle.Bold, GraphicsUnit.Point);
 
            int[] widthC = new int[colCount];
 
            int current_col = 0;
            int current_row = 0;
 
            while (current_col < colCount)
            {
                if (g.MeasureString(EveryDayReport.Columns[current_col].HeaderText.ToString(), font).Width > widthC[current_col])
                {
                    widthC[current_col] = (int)g.MeasureString(EveryDayReport.Columns[current_col].HeaderText.ToString(), font).Width+20;
                }
                current_col++;
            }
 
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    if (g.MeasureString(EveryDayReport[current_col, current_row].Value.ToString(), font).Width > widthC[current_col])
                    {
                        widthC[current_col] = (int)g.MeasureString(EveryDayReport[current_col, current_row].Value.ToString(), font).Width+20;
                    }
                    current_col++;
                }
                current_col = 0;
                current_row++;
            }
 
            current_col = 0;
            current_row = 0;
 
            string value = "";
 
            int width = widthC[current_col];
            int height = EveryDayReport[current_col, current_row].Size.Height;
 
            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);
 
 
            while (current_col < colCount)
            {
                width = widthC[current_col];
                cell_height = EveryDayReport[current_col, current_row].Size.Height;
                cell_border = new Rectangle(x, y, width, height);
                value = EveryDayReport.Columns[current_col].HeaderText.ToString();
                g.DrawRectangle(new Pen(Color.Black), cell_border);
                g.DrawString(value, font, brush, x, y);
                x += widthC[current_col];
                current_col++;
            }
            while (current_row < rowCount+1)
            {
 
                while (current_col < colCount)
                {
                    width = widthC[current_col];
                    cell_height = EveryDayReport[current_col, current_row-1].Size.Height;
                    cell_border = new Rectangle(x, y, width, height);
                    value = EveryDayReport[current_col, current_row-1].Value.ToString();
                    
                    g.DrawRectangle(new Pen(Color.Black), cell_border);
                    g.DrawString(value, font, brush, x, y);
                    x += widthC[current_col];
                    current_col++;
                }
                current_col = 0;
                current_row++;
                x = 0;
                y += cell_height;
            }
        }
Добавлено через 6 минут
Еще пару советов.
После заполнения DataGridView.DataSource
Вызовите метод DataGridView.AutoResizeColumns();
Для альбомной ориентации - printDocument3.DefaultPageSettings.Lands cape = true;
0
 Аватар для Lamak
6 / 6 / 1
Регистрация: 17.08.2012
Сообщений: 75
09.09.2015, 09:55
Я разобрался в готовом проекте: http://www.codeproject.com/Art... taGridView
1
Лучше не лучше, но лучше.
 Аватар для BlacKCheT
16 / 14 / 3
Регистрация: 11.03.2018
Сообщений: 422
06.02.2019, 15:30
А как сделать Header и Footer? Возможно сделать их динамическими?

Добавлено через 2 минуты
Header название отчета, Footer дата к примеру..
0
7 / 7 / 5
Регистрация: 25.03.2018
Сообщений: 377
28.04.2019, 00:13
Исправил некоторые ошибки, теперь точно работает безотказно :
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 private void button_Print_Click(object sender, EventArgs e)
        {
            PrintDocument Document = new PrintDocument();
            Document.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
            PrintPreviewDialog dlg = new PrintPreviewDialog();
            dlg.Document = Document;
            dlg.ShowDialog();
        }
 
        private void printDocument_PrintPage(object sender, PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;
            int x = 0;
            int y = 20;
            int cell_height = 0;
 
            int colCount = dataGridView_Products.ColumnCount;
            int rowCount = dataGridView_Products.RowCount;
 
            Font font = new Font("Times New Roman", 16, FontStyle.Regular, GraphicsUnit.Point);
 
            int[] widthC = new int[colCount];
 
            int current_col = 0;
            int current_row = -1;
 
            while (current_col < colCount)
            {
                if (g.MeasureString(dataGridView_Products.Columns[current_col].HeaderText.ToString(), font).Width > widthC[current_col])
                {
                    widthC[current_col] = (int)g.MeasureString(dataGridView_Products.Columns[current_col].HeaderText.ToString(), font).Width;
                }
                current_col++;
            }
 
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    if (g.MeasureString(dataGridView_Products[current_col, current_row].Value.ToString(), font).Width > widthC[current_col])
                    {
                        widthC[current_col] = (int)g.MeasureString(dataGridView_Products[current_col, current_row].Value.ToString(), font).Width;
                    }
                    current_col++;
                }
                current_col = 0;
                current_row++;
            }
 
            current_col = 0;
            current_row = -1;
 
            string value = "";
 
            int width = widthC[current_col];
            int height = dataGridView_Products[current_col, current_row + 1].Size.Height;
 
            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);
 
 
            while (current_col < colCount)
            {
                width = widthC[current_col];
                cell_height = dataGridView_Products[current_col, current_row + 1].Size.Height;
                cell_border = new Rectangle(x, y, width, height);
                value = dataGridView_Products.Columns[current_col].HeaderText.ToString();
                g.DrawRectangle(new Pen(Color.Black), cell_border);
                g.DrawString(value, font, brush, x, y);
                x += widthC[current_col];
                current_col++;
            }
            while (current_row < rowCount)
            {
                while (current_col < colCount)
                {
                    width = widthC[current_col];
                    cell_height = dataGridView_Products[current_col, current_row].Size.Height;
                    cell_border = new Rectangle(x, y, width, height);
                    value = dataGridView_Products[current_col, current_row].Value.ToString();
                    g.DrawRectangle(new Pen(Color.Black), cell_border);
                    g.DrawString(value, font, brush, x, y);
                    x += widthC[current_col];
                    current_col++;
                }
                current_col = 0;
                current_row++;
                x = 0;
                y += cell_height;
            }
        }
2
 Аватар для radiofan
4 / 3 / 1
Регистрация: 18.04.2018
Сообщений: 53
13.06.2020, 17:42
cinekst_207,
Цитата Сообщение от cinekst_207 Посмотреть сообщение
int rowCount = dataGridView_Products.RowCount;
(18 строка)
По-моему там должно быть
C++
1
int rowCount = dataGridView_Products.RowCount-1;
0
1 / 1 / 0
Регистрация: 15.08.2016
Сообщений: 58
02.09.2020, 08:40
такой вопрос. все печатается корректно.
а как сделать так, чтобы длинная строка
в колонке печаталась в 2-3 строки.
0
1 / 1 / 0
Регистрация: 15.08.2016
Сообщений: 58
03.09.2020, 10:19
сделал такой вот костыль для длинных строк
чтобы в ячейке печатались в 2 строки
если кому понадобится.
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
private void printDocMat_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawString(tblMat, new Font("Century Gothic", 14, FontStyle.Bold), Brushes.Black, 320, 40);
            Graphics g = e.Graphics;
            int x = 40;
            int y = 70;
            int cell_height = 0;
            int colCount = dGMaterials.ColumnCount;
            int rowCount = dGMaterials.RowCount + 1;
            Font font = new Font("Century Gothic", 14, FontStyle.Regular, GraphicsUnit.Point);
            int[] widthC = new int[colCount];
            int current_col = 1;
            int current_row = 0;
            while (current_col < colCount - 1)
            {
                if (g.MeasureString(dGMaterials.Columns[current_col].HeaderText.ToString(), font).Width > widthC[current_col])
                {
                    if (current_col == 1) widthC[current_col] = 570;
                    if (current_col == 2) widthC[current_col] = 65;
                    if (current_col == 3) widthC[current_col] = 110;
                    else widthC[current_col] = (int)g.MeasureString(dGMaterials.Columns[current_col].HeaderText.ToString(), font).Width;
                }
                current_col++;
            }
            while (current_row < rowCount)
            {
                while (current_col < colCount - 1)
                {
                    if (g.MeasureString(dGMaterials[current_col, current_row - 1].Value.ToString(), font).Width > widthC[current_col])
                    {
                        if (current_col == 1) widthC[current_col] = 570;
                        if (current_col == 2) widthC[current_col] = 65;
                        if (current_col == 3) widthC[current_col] = 110;
                        widthC[current_col] = (int)g.MeasureString(dGMaterials[current_col, current_row - 1].Value.ToString(), font).Width;
                    }
                    current_col++;
                }
                current_col = 1;
                current_row++;
            }
            current_col = 1;
            current_row = 0;
            cell_height = 0;
            string value = "";
            int width = widthC[current_col];
            int height = dGMaterials[current_col, current_row].Size.Height;
            int heightNR = dGMaterials[current_col, current_row].Size.Height*2;
            int heightT = dGMaterials[current_col, current_row].Size.Height;
            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);
            while (current_col < colCount - 1)
            {
                if (current_col == 1) widthC[current_col] = 570;
                if (current_col == 2) widthC[current_col] = 65;
                if (current_col == 3) widthC[current_col] = 110;
                width = widthC[current_col];
                if (dGMaterials.Columns[current_col].HeaderText.ToString() == "Ед изм")
                    value = "Ед\nизм" ;
                else
                    value = dGMaterials.Columns[current_col].HeaderText.ToString();
                cell_height = dGMaterials[current_col, current_row].Size.Height +25;
                cell_border = new Rectangle(x, y, width, height+25);
                g.DrawRectangle(new Pen(Color.Black), cell_border);
                g.DrawString(value, font, brush, x, y);
                x += widthC[current_col];
                current_col++;
            }
            //height = 25;
            while (current_row < rowCount)
            {                
                while (current_col < colCount - 1)
                {
                    if (current_col == 1) widthC[current_col] = 570;
                    if (current_col == 2) widthC[current_col] = 65;
                    if (current_col == 3) widthC[current_col] = 110;
                    else width = widthC[current_col];
                    value = dGMaterials[current_col, current_row - 1].Value.ToString();
                    if (value.Length < 50)
                    {
                        value = dGMaterials[current_col, current_row - 1].Value.ToString();
                        cell_height = dGMaterials[current_col, current_row - 1].Size.Height+5;
                        cell_border = new Rectangle(x, y, widthC[current_col], height+5);
                        g.DrawRectangle(new Pen(Color.Black), cell_border);
                        g.DrawString(value, font, brush, x, y);
                        x += widthC[current_col];
                        current_col++;
                    }
                    //height = 25;
                    if (value.Length >= 50)
                    {
                        
                        LongString = true;
                        int cur_row = current_row - 1;
                        string valueDRT = value.Substring(0, 49);
                        int indexOfChar = valueDRT.LastIndexOf(" ");
                        string valueDR = valueDRT.Substring(0, indexOfChar);
                        string valueResult = valueDR + "\n" + value.Substring(indexOfChar + 1);
                        txtTH.Text = valueDR;
                        txtTH.Text = "";
                        value = valueResult;
 
                        double lengthValue = value.Length;
                        double n = lengthValue / 50;
                        txtTH.Text = n.ToString();
                        double MnH = Math.Ceiling(n);
                        txtTH.Text = MnH.ToString();
                        int HR = int.Parse(txtTH.Text);
                        cell_height = dGMaterials[current_col, current_row - 1].Size.Height *2 +5;
                        cell_border = new Rectangle(x, y, widthC[current_col], height*2 +5);
                        g.DrawRectangle(new Pen(Color.Black), cell_border);
                        g.DrawString(value, font, brush, x, y);
                        x += widthC[current_col];
                        current_col++;
                        if ( current_col == 2)
                        {
                            value = dGMaterials[2, current_row - 1].Value.ToString();
                            cell_height = dGMaterials[current_col, current_row - 1].Size.Height*2 +5;
                            cell_border = new Rectangle(x, y, widthC[current_col], height*2 +5 );
                            g.DrawRectangle(new Pen(Color.Black), cell_border);
                            g.DrawString(value, font, brush, x, y);
                            x += widthC[current_col];
                            current_col++;
                        }
                        if (current_col == 3)
                        {
                            value = dGMaterials[3, current_row - 1].Value.ToString();
                            cell_height = dGMaterials[current_col, current_row - 1].Size.Height*2 +5;
                            cell_border = new Rectangle(x, y, widthC[current_col], height*2+5);
                            g.DrawRectangle(new Pen(Color.Black), cell_border);
                            g.DrawString(value, font, brush, x, y);
                            x += widthC[current_col];
                            current_col++;
                        }
                        
                        y = y -42;
                    }
                }
                height = 24;
                current_col = 1;
                current_row++;
                x = 40;
                y += cell_height;
                
            }
        }
величины для ширины
if (current_col == 1) widthC[current_col] = 570;
if (current_col == 2) widthC[current_col] = 65;
if (current_col == 3) widthC[current_col] = 110;
height = 24; y = y -42;
произвольно под свой проект
длина строки для деления на 2 строки
value.Length >= 50 зависит от шрифта его размера.
Font font = new Font("Century Gothic", 14, FontStyle.Regular, GraphicsUnit.Point);
0
 Аватар для URAHOV
4 / 4 / 0
Регистрация: 27.12.2015
Сообщений: 47
23.08.2021, 21:06
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//создаём формат строки
StringFormat format1 = new StringFormat(StringFormatFlags.NoClip);
 
            format1.LineAlignment = StringAlignment.Center; //выравнивание по вертикали
            format1.Alignment = StringAlignment.Far; // по горизонтали
 
            var font = dataGridView1.Font; // нужный шрифт
            Pen pen = new(Color.LightGray); //цвет
            Rectangle rectangleCell; //область печати строки
            var rowCountDGV = dataGridView1.RowCount; //кол-во столбцов в datagridview
            var columnCountDGV = dataGridView1.ColumnCount; //кол-во строк
            string stringPrint; // строка для печати
 
//в цикле перебираем все ячейки в DGV 
            for (int rowIndex = 0; rowIndex < rowCountDGV; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < columnCountDGV; columnIndex++)
                {
//получаем область для печати со всеми размерами и локацией
                    rectangleCell = dataGridView1.GetCellDisplayRectangle(columnIndex, rowIndex, true);
//получаем значение текущей ячейки
                    stringPrint = (string)dataGridView1[columnIndex, rowIndex].FormattedValue;
//печатаем прямоугольник
                    e.Graphics.DrawRectangle(pen, rectangleCell);
//печатаем строку в данном прямоугольнике
                    e.Graphics.DrawString(stringPrint, this.Font, Brushes.Black, (RectangleF)rectangleCell, format1);
                }
            }
По-моему самый простой вариант вывода на печать datagridview.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
23.08.2021, 21:06

Как прокручивать вниз макет в предварительном просмотре?
Всем привет. Столкнулся с проблемой, которую не знаю как решить. У меня есть активити, в которой содержится длинный текст с возможностью...

В предварительном просмотре отчета идет разделение страницы
Добрый вечер. Помогите пожалуйста решить проблемку. Потихоньку делал отчет &quot;КМ-2&quot;, изменял свойство линии в таблице. Сам не...

Разное количество страниц при предварительном просмотре
Помогите, не могу понять почему в конфигураторе предварительный просмотр две страницы, а если запустить конфигурацию то получается 4...

Не применяются настройки печати при предварительном просмотре
Здравствуйте. Возникла одна проблема. При печати некоторых документов небольшая часть таблицы табличного документа и подвальная часть...

Не отображается содержимое файлов Excel в предварительном просмотре Проводника
Предварительный просмотр включен. Все остальные файлы отображаются, при попытке просмотреть файл excel пишет нет данных для...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
32
Ответ Создать тему
Новые блоги и статьи
Запрет дублирования строк в табличной части
Maks 13.09.2026
Реализация из решения ниже выполнена на нетиповом справочнике "Нормы ТО" с табличной часть "Виды ТО", разработанного в КА2, со следующими реквизитами: - ВидТО (СправочникСсылка. ВидыТО); - ВидГСМ. . .
Скрипты Tampermonkey для CyberForum, ChatGPT, Claude и пр.
Jin X 06.09.2026
Скрипты Tampermonkey для CyberForum, ChatGPT, Claude и пр. Работая с форумом и нейросетями в браузере часто хочется что-то подкорректировать или добавить какого-то функционала. Ниже прикреплён. . .
Программа опроса у.з. расходомера SLS-720F
Argus19 02.09.2026
Программа опроса у. з. расходомера SLS-720F Программа опрашивает один раз в минуту три ультразвуковых расходомера SLS-720F через интерфейс RS-485 по протоколу Modbus RTU. Опрашиваются регистры. . .
Hyper-V: Компьютер должен поддерживать доверенный платформенный модуль 2.0.
Maks 31.08.2026
При установке Windows 11 на виртуальную машину Hyper-V 2-го поколения вылезла такая ошибка: Решение: в параметрах виртуальной машины, в разделе "Безопасность" (Security) активировать флаг. . .
Архитектура биовида Стива в Майнкрафте: Зачем бонобо кубический каннибализм
anaschu 30.08.2026
Кубический Вагинокапитализм в Minecraft: Математический инвариант ОДУ и рок Стивов-бонобо Главная задача разработанной «Модели Всего» — наглядно продемонстрировать наличие системной «судьбы». . .
Оттачиваю умение писать js программы.
russiannick 30.08.2026
Проектом выходного дня стало написание Книги шифров Виженера. Итогом стала версия 200, синий туман. Синий туман назван так, потому что замораживает текст под собой. Нажатие синих кнопок управляют. . .
мат медиц модель 30. презентация проекта
anaschu 27.08.2026
хоп хоп хоп хидахоп, а я кладую))
Как у меня протекала болезнь
zorxor 27.08.2026
Здравствуйте, друзья! Эта запись блога предназначена именно для вас - для моих дорогих друзей, которые знали меня лично. Чтобы ответить на вопрос - а что же со мной произошло на самом деле? Я учился. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru