ورود

View Full Version : سوال: جدا کردن کاراکتر رشته



fakhravari
یک شنبه 03 شهریور 1392, 22:03 عصر
با سلام
برای اسم ایده شما برای پر کردن این مورد چی هست؟

fakhravari
یک شنبه 03 شهریور 1392, 22:36 عصر
چه تابع خشکلی نوشتم.
:لبخند:

m.sunset
یک شنبه 03 شهریور 1392, 22:52 عصر
در FastReport خودش کنترلی به نام CellularText (http://www.fast-report.com/documentation/UserManFrNET-en/index.html?cellulartextobject.htm) داره که این روال رو هندل می کنه براتون

fakhravari
یک شنبه 03 شهریور 1392, 22:54 عصر
sti mul bud.

m.sunset
یک شنبه 03 شهریور 1392, 22:55 عصر
نمایش روی فرم :


string text = "سایت برنامه نویس";
Font f = new Font("Courier New", 20, FontStyle.Bold, GraphicsUnit.Pixel);
Bitmap bmp = new Bitmap(text.Length * 30 + 2, 30);
StringFormat format = new StringFormat();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;
format.FormatFlags = StringFormatFlags.DirectionRightToLeft;
using (Graphics g = Graphics.FromImage(bmp))
{
g.Clear(SystemColors.Control);
for (int i = 0; i < text.Length; i++)
{
g.DrawRectangle(new Pen(Color.Black, 2), i * 30 + 1, 1, 30, 28);
g.DrawString(text[i].ToString(), f, Brushes.Black, new Rectangle(bmp.Width - (i + 1) * 30, 0, 30, 30), format);
}
}
PictureBox pic = new PictureBox();
pic.SizeMode = PictureBoxSizeMode.AutoSize;
pic.Image = bmp;
pic.Location = new Point(10, 10);
this.Controls.Add(pic);

m.sunset
یک شنبه 03 شهریور 1392, 22:58 عصر
چاپ:
using System.Drawing.Printing;



private void button1_Click(object sender, EventArgs e)
{
PrintDocument doc = new PrintDocument();
doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
doc.Print();
}

void doc_PrintPage(object sender, PrintPageEventArgs e)
{
string text = "سایت برنامه نویس";
int width = 100;
Font f = new Font("Courier New", (int)(width * 0.7), FontStyle.Bold, GraphicsUnit.Document);
StringFormat format = new StringFormat();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;
format.FormatFlags = StringFormatFlags.DirectionRightToLeft;
e.Graphics.PageUnit = GraphicsUnit.Document;
Point pos = new Point(200, 200);
for (int i = 0; i < text.Length; i++)
{
e.Graphics.DrawRectangle(new Pen(Color.Black, 6), i * width + pos.X + 3, pos.Y, width, width);
e.Graphics.DrawString(text[i].ToString(), f, Brushes.Black
, new Rectangle(text.Length * width - (i + 1) * width + pos.X, pos.Y, width, width), format);
}
}

fakhravari
دوشنبه 04 شهریور 1392, 00:09 صبح
برای استیمول دوستا چی پیشنهاد میکنن.