Многострочность
Delphi — среда быстрой разработки, где в качестве языка программирования используется Object Pascal. На сегодняшний день позволяет разрабатывать ПО для Microsoft Windows, Mac OS, iOS и Android и входит в состав Embarcadero RAD Studio
https://delphi-hlp.ru/index.php/stringgrid/mnogostrochnost.feed
2022-09-13T04:49:18+07:00
Delphi help
info@delphi-hlp.ru
Joomla! - Open Source Content Management
Компонет TWrapGrid, осуществляющий перенос текста в TStringGrid
2017-08-11T19:33:25+07:00
2017-08-11T19:33:25+07:00
https://delphi-hlp.ru/index.php/stringgrid/mnogostrochnost/komponet-twrapgrid-osushchestvlyayushchij-perenos-teksta-v-tstringgrid.html
Super User
toto44@inbox.ru
<p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Я наконец нашел время и создал заказной компонент TWrapGrid, функционально идентичный TStringGrid, но умеющий переносить текст в ячейках. Пока это бета-версия, поэтому поэкспериментируйте с ним, и в случае наличия каких-либо замечаний или предложений не забудьте уведомить об этом меня. При использовании компонента не забывайте про RowHeights (или DefaultRowHeight), т.к. при переносе текста потребуется отобразить несколько строк.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Для использования скопируйте код в модуль, сохраните его с именем 'Wrapgrid.PAS' и следуйте за инструкциями, расположенными в верхней части кода.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Присылайте свой комментарии и пожелания. Вот код: </span></p>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/komponet-twrapgrid-osushchestvlyayushchij-perenos-teksta-v-tstringgrid.html">Подробнее...</a></p>
<p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Я наконец нашел время и создал заказной компонент TWrapGrid, функционально идентичный TStringGrid, но умеющий переносить текст в ячейках. Пока это бета-версия, поэтому поэкспериментируйте с ним, и в случае наличия каких-либо замечаний или предложений не забудьте уведомить об этом меня. При использовании компонента не забывайте про RowHeights (или DefaultRowHeight), т.к. при переносе текста потребуется отобразить несколько строк.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Для использования скопируйте код в модуль, сохраните его с именем 'Wrapgrid.PAS' и следуйте за инструкциями, расположенными в верхней части кода.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Присылайте свой комментарии и пожелания. Вот код: </span></p>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/komponet-twrapgrid-osushchestvlyayushchij-perenos-teksta-v-tstringgrid.html">Подробнее...</a></p>
Многострочность в заголовках колонок StringGrid
2017-08-11T19:32:47+07:00
2017-08-11T19:32:47+07:00
https://delphi-hlp.ru/index.php/stringgrid/mnogostrochnost/mnogostrochnost-v-zagolovkakh-kolonok-stringgrid.html
Super User
toto44@inbox.ru
<p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Автор: Rick Rogers</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> У меня есть StringGrid, который выглядит очень красивым, за исключением заголовков колонок, где я хотел бы иметь их размер равным 1 ячейке, но с заголовком, размещенным в нескольких строках, например,</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Индекс Фондовой Биржи</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">показывалось бы как</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Индекс</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Фондовой</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Биржи</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">было бы классно, если можно было этот заголовок размещать еще и по центру.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Рисовать сами ячейки вы можете в обработчике события OnDrawCell. Для определения ячейки (заголовок?), обрабатываемой в текущий момент, используйте параметр GridState.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Я выводил тест с помощью обычных методов рисования (которые хорошо "приживаются" в данном компоненте), с поддержкой вертикального выравнивания, полей и переноса слов. Вот сам код:</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/mnogostrochnost-v-zagolovkakh-kolonok-stringgrid.html">Подробнее...</a></p>
<p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Автор: Rick Rogers</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> У меня есть StringGrid, который выглядит очень красивым, за исключением заголовков колонок, где я хотел бы иметь их размер равным 1 ячейке, но с заголовком, размещенным в нескольких строках, например,</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Индекс Фондовой Биржи</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">показывалось бы как</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Индекс</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Фондовой</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> Биржи</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">было бы классно, если можно было этот заголовок размещать еще и по центру.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Рисовать сами ячейки вы можете в обработчике события OnDrawCell. Для определения ячейки (заголовок?), обрабатываемой в текущий момент, используйте параметр GridState.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Я выводил тест с помощью обычных методов рисования (которые хорошо "приживаются" в данном компоненте), с поддержкой вертикального выравнивания, полей и переноса слов. Вот сам код:</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/mnogostrochnost-v-zagolovkakh-kolonok-stringgrid.html">Подробнее...</a></p>
Многострочные ячейки в StringGrid.
2017-08-11T19:32:03+07:00
2017-08-11T19:32:03+07:00
https://delphi-hlp.ru/index.php/stringgrid/mnogostrochnost/mnogostrochnye-yachejki-v-stringgrid.html
Super User
toto44@inbox.ru
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;">
<table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4">
<tbody>
<tr align="left" valign="top">
<td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;">
<p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p>
</td>
</tr>
<tr align="left">
<td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;">
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">Procedure</span><span class="f_CodeExample" style="color: #000000;"> GridRemoveColumn(StrGrid: TStringGrid; DelColumn: Integer); </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">Var</span><span class="f_CodeExample" style="color: #000000;"> Column: Integer; </span></span></p>
<p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">begin</span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">If</span><span class="f_CodeExample" style="color: #000000;"> DelColumn <= StrGrid.ColCount </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">then</span></span></p>
<p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Begin</span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">For</span><span class="f_CodeExample" style="color: #000000;"> Column := DelColumn </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">To</span><span class="f_CodeExample" style="color: #000000;"> StrGrid.ColCount-</span><span class="f_CodeExample" style="color: #800000;">1</span> <span class="f_CodeExample" style="color: #008000; font-weight: bold;">do</span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> StrGrid.Cols[Column-</span><span class="f_CodeExample" style="color: #800000;">1</span><span class="f_CodeExample" style="color: #000000;">].Assign(StrGrid.Cols[Column]); </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> StrGrid.ColCount := StrGrid.ColCount-</span><span class="f_CodeExample" style="color: #800000;">1</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">End</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">end</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/mnogostrochnye-yachejki-v-stringgrid.html">Подробнее...</a></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>
<div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;">
<table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4">
<tbody>
<tr align="left" valign="top">
<td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;">
<p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p>
</td>
</tr>
<tr align="left">
<td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;">
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">Procedure</span><span class="f_CodeExample" style="color: #000000;"> GridRemoveColumn(StrGrid: TStringGrid; DelColumn: Integer); </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">Var</span><span class="f_CodeExample" style="color: #000000;"> Column: Integer; </span></span></p>
<p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">begin</span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">If</span><span class="f_CodeExample" style="color: #000000;"> DelColumn <= StrGrid.ColCount </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">then</span></span></p>
<p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Begin</span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">For</span><span class="f_CodeExample" style="color: #000000;"> Column := DelColumn </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">To</span><span class="f_CodeExample" style="color: #000000;"> StrGrid.ColCount-</span><span class="f_CodeExample" style="color: #800000;">1</span> <span class="f_CodeExample" style="color: #008000; font-weight: bold;">do</span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> StrGrid.Cols[Column-</span><span class="f_CodeExample" style="color: #800000;">1</span><span class="f_CodeExample" style="color: #000000;">].Assign(StrGrid.Cols[Column]); </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;"> StrGrid.ColCount := StrGrid.ColCount-</span><span class="f_CodeExample" style="color: #800000;">1</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">End</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
<p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">end</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/mnogostrochnost/mnogostrochnye-yachejki-v-stringgrid.html">Подробнее...</a></p>