السلام عليكم ورحمة الله وبركاته
اخواني ارجو منكم المساعدة على هاذا الكود الذي هو عبارة عن فورم يقوم بعرض الصفحات بتحديد معين مع عرض اطار بداخلهم
الان اريد عرض كتابة بداخل هذه الصفحات بشرط ان لا تتعدى الكتابة هذا الاطار
وجازاكم الله خير الجزاء
اذا كان سؤالي فيه بعض الغموض قولو لي نقطة الغموض باذن الله اوضحها لكم
فقكط ارجو الرد في اقرب وقت
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_Validating(object sender, CancelEventArgs e)
{
try
{
int x = Int32.Parse(textBox1.Text);
errorProvider1.SetError(textBox1, "");
}
catch (Exception )
{
errorProvider1.SetError(textBox1, "Not an integer value.");
}
}
private void textBox2_Validating(object sender, CancelEventArgs e)
{
try
{
int x = Int32.Parse(textBox2.Text);
errorProvider1.SetError(textBox2, "");
}
catch (Exception )
{
errorProvider1.SetError(textBox2, "Not an integer value.");
}
}
private void button1_Click(object sender, EventArgs e)
{
printPreviewDialog1.ShowDialog();
}
private void Form1_Load(object sender, EventArgs e)
{
}
Font f = new Font("times new romain ", 14, FontStyle.Bold);
private void Form1_Paint(object sender, PaintEventArgs e)
{
//e.Graphics.DrawString (" teste",f,Brushes.Black,10,10);
//e.Graphics.DrawRectangle(Pens.Red, 10, 10, 100, 30);
RectangleF rf = new RectangleF(10, 20, 200, 40);
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
string s = "je comprie pas rien";
float h = f.GetHeight(e.Graphics);
float w = e.Graphics.MeasureString(s, f).Width;
e.Graphics.DrawRectangle(Pens.Blue, rf.X, rf.Y, rf.Width, rf.Height);
e.Graphics.DrawString(s, f, Brushes.Black, rf, sf);
e.Graphics.DrawString(s, f, Brushes.Black, 5, 10);
}
int X = 0;
Pen pen = new Pen(Color.Red,10f);
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString(X.ToString(), f, Brushes.Blue, 10, 10);
e.Graphics.DrawRectangle(pen, e.PageBounds.X + 1, e.PageBounds.Y + 1, e.PageBounds.Width-2,e.PageBounds.Height-2);
e.Graphics.DrawRectangle(pen, e.MarginBounds);
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
RectangleF Footbounds = new RectangleF(e.MarginBounds.Left, e.MarginBounds.Bottom, e.MarginBounds.Width, f.GetHeight(e.Graphics));
e.Graphics.DrawString(X.ToString(), f, Brushes.Blue, Footbounds, sf);
if (X < 10)
{
e.HasMorePages = true; X += 1;
}else
{ e.HasMorePages = false; }
}}
}