Реклама i
|
||
| Правила | Регистрация | Пользователи | Сообщения за день | | Поиск | | Справка по форуму | Файлообменник | |
|
![]() |
Поиск в этой теме |
![]() |
#1 | |
Текст по кругу
Регистрация: 15.11.2013
Сообщений: 2
|
||
Просмотров: 2783
|
|
||||
КМД Регистрация: 26.03.2013
Я ЖЫВУ В РОССИИ.
Сообщений: 506
![]() |
в Form1.cs, добавь:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { protected string strText = "Sample Text"; protected Font font = new Font("Times New Roman", 24, FontStyle.Italic); float fRadius = 100; protected override void OnPaint(PaintEventArgs pea) { DoPage(pea.Graphics, ForeColor, ClientSize.Width,ClientSize.Height); } public Form1() { Text = "Wrap Text"; strText = "щё один пример нелинейных трансформаций в GDI. Е"; font = new Font("Times New Roman", 48); } protected void DoPage(Graphics grfx, Color clr, int cx, int cy) { GraphicsPath path = new GraphicsPath(); float fFontSize = Points2PageUnits(grfx, font); // Add text to the path. path.AddString(strText, font.FontFamily, (int) font.Style, fFontSize, new PointF(0, 0), new StringFormat()); // Shift the origin to left baseline, y increasing up. RectangleF rectf = path.GetBounds(); path.Transform(new Matrix(1, 0, 0, -1, -rectf.Left, GetAscent(grfx, font))); // Scale so width equals 2*PI. float fScale = 2 * (float) Math.PI / rectf.Width; path.Transform(new Matrix(fScale, 0, 0, fScale, 0, 0)); // Modify the path. PointF[] aptf = path.PathPoints; for (int i = 0; i < aptf.Length; i++) aptf[i] = new PointF( fRadius * (1 + aptf[i].Y) * (float) Math.Cos(aptf[i].X), fRadius * (1 + aptf[i].Y) * (float) Math.Sin(aptf[i].X)); path = new GraphicsPath(aptf, path.PathTypes); // Fill the path. grfx.TranslateTransform(cx / 2, cy / 2); grfx.FillPath(new SolidBrush(clr), path); } public float GetAscent(Graphics grfx, Font font) { return font.GetHeight(grfx) * font.FontFamily.GetCellAscent(font.Style) / font.FontFamily.GetLineSpacing(font.Style); } public float Points2PageUnits(Graphics grfx, Font font) { float fsize; if (grfx.PageUnit==GraphicsUnit.Display) fsize=100*font.SizeInPoints/72; else fsize=grfx.DpiX*font.SizeInPoints/72; return fsize; } } } а автокад скрин вставь...на это он сгодится... |
|||
![]() |
![]() |
|
|
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Текст вдоль полилинии или сплайна (по кривой) | Denioska | AutoCAD | 48 | 10.09.2022 21:55 |
Как выровнять текст | Rembo_4 | Программирование | 4 | 18.01.2012 23:28 |
кто как подгоняет текст в основной надписи? (Допускаются ли в основной надписи различная высота текста в однотипных графах, а также сжатие текста?) | Ax3 | AutoCAD | 35 | 20.10.2010 20:19 |
Как извлечь из размера значение, т.е. текст??? | Rubль | Программирование | 10 | 24.08.2009 17:24 |
Перестаёт редактироваться текст. | Behemoth | AutoCAD | 2 | 10.06.2009 08:04 |