Namespace Public Partial Class Public: Form1
Namespace Public Partial Class Public: Form1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
button1.ForeColor = Color.Green;
button1.Width = 40;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "Good luck";
}
private void button3_Click(object sender, EventArgs e)
{
int x, y, z;
x =int.Parse( textBox1.Text);
y=int.Parse(textBox2.Text);
z=x+y;
textBox3.Text = z.ToString() ;
// textBox3.Text = Convert.ToString(z);
}
}
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int i =1;
TextBox te1 = new TextBox();
TextBox te2 = new TextBox();
TextBox te3 = new TextBox();
TextBox te4 = new TextBox();
TextBox te5 = new TextBox();
TextBox te6 = new TextBox();
int prime(int x)
{
bool test = true;
while (test == true )
{
x++;
for (int j = 2; j <x ; j++)
{
if (x % j == 0) break;
if (j == x - 1) test = false;
}
}
return x;
} // ( )
public Form1()
{
InitializeComponent();
te1.Text = Convert.ToString(10);
Controls.Add(te1);
te1.Top = 50 + i * 25;
te1.Left = 300;
}
private void button2_Click(object sender, EventArgs e)
{
int x = int.Parse(te1.Text);
x = x + int.Parse(te2.Text);//sum
x = x + int.Parse(te3.Text);
x = x + int.Parse(te4.Text);
x = x + int.Parse(te5.Text);
x = x + int.Parse(te6.Text);
label1.Text = x.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
te2.Text = te1.Text;//copy
te3.Text = te1.Text;
te4.Text = te1.Text;
te5.Text = te1.Text;
te6.Text = te1.Text;
}
private void button4_Click(object sender, EventArgs e)
{
int x = int.Parse(te1.Text);
x += 2;
te2.Text = x.ToString();
x += 2;
te3.Text = x.ToString();
x += 2;
te4.Text = x.ToString();
x += 2;
te5.Text = x.ToString();
x += 2;
te6.Text = x.ToString();
}
private void button5_Click(object sender, EventArgs e)
{
te1.ForeColor = Color.Chocolate;
te2.ForeColor = Color.Red ;
te3.ForeColor = Color.Gold;
te4.ForeColor = Color.Green;
te5.ForeColor = Color.Blue;
te6.ForeColor = Color.Black;
}
private void button6_Click(object sender, EventArgs e)
{
int x = int.Parse(te1.Text);
x = prime(x);//
te2.Text = x.ToString();//
x = prime(x);
te3.Text = x.ToString();
x = prime(x);
te4.Text = x.ToString();
x = prime(x);
te5.Text = x.ToString();
x = prime(x);
te6.Text = x.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
i++;
if (i >= 7) i = 6;
switch (i)
{
case 1: Controls.Add(te1); te1.Top = 50 + i * 25; te1.Left
case 2: Controls.Add(te2); te2.Top = 50 + i * 25; te2.Left
case 3: Controls.Add(te3); te3.Top = 50 + i * 25; te3.Left
case 4: Controls.Add(te4); te4.Top = 50 + i * 25; te4.Left
case 5: Controls.Add(te5); te5.Top = 50 + i * 25; te5.Left
case 6: Controls.Add(te6); te6.Top = 50 + i * 25; te6.Left
}
}
private void button7_Click(object sender, EventArgs e)
{
if (i <= 1) i = 1;
switch (i)
{
case 1: Controls.Remove(te1); break;
case 2: Controls.Remove(te2); break;
case 3: Controls.Remove(te3); break;
case 4: Controls.Remove(te4); break;
case 5: Controls.Remove(te5); break;
case 6: Controls.Remove(te6); break;
}
i--;
}
}
=
=
=
=
=
=
300;
300;
300;
300;
300;
300;
break;
break;
break;
break;
break;
break;
namespace Class_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int x = int.Parse(textBox1.Text);
for (int i = 0; i < x; i++)
{
Button b1 = new Button();
Controls.Add(b1);
b1.Text = "Finish"+i.ToString();
b1.Name = "bb";
b1.Left = 50;
b1.Top = 75+i*25;
b1.Width = 120;
}
for (int i = 0; i < x; i++)
{
TextBox t1 = new TextBox();
Controls.Add(t1);
t1.Left = 200;
t1.Top = 75 + i * 25;
t1.Width = 120;
}
for (int i = 0; i < x; i++)
{
Label l1 = new Label();
Controls.Add(l1);
l1.Left = 400;
l1.Top = 75 + i * 25;
l1.Width = 120;
l1.Text = "ll" + i.ToString();
}
}
namespace class_3
{
namespace class_4
{
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i <= 2; i++)
{
Button b1 = new Button();
Controls.Add(b1);
b1.Left = 50;
b1.Top = 50 + i * 25;
b1.Width = 130;
b1.Name = "block" + i.ToString();
if (i == 0)
{
b1.Click += new EventHandler(b1click);
b1.Text = "Showing message box" ;
}
if (i == 1)
{
b1.Click += new EventHandler(b1click2);
b1.Text = "Generat textbox";
}
if (i == 2)
{
b1.Click += new EventHandler(tv);
b1.Text = "Summation";
}
}
}
private void b1click(object sender, EventArgs e)
{
MessageBox.Show("Your button is programmed");
}
private void b1click2(object sender, EventArgs e)
{
for (int i = 0; i < 2; i++)
{
TextBox t1 = new TextBox();
Controls.Add(t1);
t1.Name = "tt";
t1.Location = new Point(190, 90 + i * 25);
}
}
private void tv(object sender, EventArgs e)
{
int sum=0;
Label l1 = new Label();
Controls.Add(l1);
l1.Location = new Point(100, 150);
for (int j = 0; j < Controls.Count; j++)
{
if (Controls[j].Name == "tt") sum += int.Parse(Controls[j].Text);
}
l1.Text = sum.ToString();
}
namespace homework4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 1; i <= 3; i++)
{
Button b = new Button();
Controls.Add(b);
b.Location = new Point(100, 75 + i * 25);
b.Name = i.ToString();
b.Width=100;
}
for (int i = 0; i < Controls.Count; i++)
{
if (Controls[i].Name == "1")
{
Controls[i].Text = "genraet text box";
Controls[i].Click +=new EventHandler(clik_g);
}
if (Controls[i].Name == "2")
{
Controls[i].Text = "sum";
Controls[i].Click += new EventHandler(clik_s);
}
if (Controls[i].Name == "3")
{
Controls[i].Text = "remove";
Controls[i].Click += new EventHandler(clik_r);
}
}
}
private void clik_g(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
TextBox t = new TextBox();
Controls.Add(t);
t.Location = new Point(300, 75 + i * 25);
t.Name = "tt";
}
}
private void clik_s(object sender, EventArgs e)
{
int sum = 0;
try
{
for (int i = 0; i < Controls.Count; i++)
{
if (Controls[i].Name == "tt")
{
sum += int.Parse(Controls[i].Text);
}
}
Label L = new Label();
Controls.Add(L);
L.Location = new Point(300, 200);
L.Text = "sum = "+sum.ToString();
L.Name = "L";
int av = sum / 3;
Label L2 = new Label();
Controls.Add(L2);
L2.Location = new Point(300, 225);
L2.Text = "avarage = " + av.ToString();
L2.Name = "L";
}
catch
{
MessageBox.Show(";)"
}
}
private void clik_r(object sender, EventArgs e)
{
for (int i = 0; i <Controls.Count; i++)
{
if (Controls[i].Name == "tt" || Controls[i].Name == "L")
{
Controls.Remove(Controls[i]);
i--;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Text = Controls.Count.ToString();
}
namespace class_5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
namespace homework_5
{
public partial class Form1 : Form
{
int[] x; int[] y; int[] z;
int n;
List<int> x1; List<int> y1; List<int> z1;//
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
int j = 0; int j1 = 0;
n = int.Parse(textBox1.Text);
Label L = new Label();
L.Text = "x Array";
L.Name = "x Array";
Controls.Add(L);
L.Location = new Point(button1.Left, button1.Bottom + button1.Height * j++);
Label L2 = new Label();
L2.Text = "y Array";
L2.Name = "y Array";
Controls.Add(L2);
L2.Location = new Point(button1.Left + button1.Width, button1.Bottom +
button1.Height * j1++);
for (int i = 0; i < n; i++)
{TextBox t1 = new TextBox();
t1.Name = "tt";
t1.Location = new Point(button1.Left, button1.Bottom + button1.Height *
j++);
Controls.Add(t1);
}
for (int i = 0; i < n; i++)
{TextBox t2 = new TextBox();
t2.Name = "tt2";
t2.Location = new Point(button1.Left + button1.Width, button1.Bottom +
button1.Height * j1++);
Controls.Add(t2);
}
}
catch
{
MessageBox.Show(";)"!!!!
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
int k1 = 0, k2 = 0;
x = new int[int.Parse(textBox1.Text)];
y = new int[int.Parse(textBox1.Text)];
z = new int[int.Parse(textBox1.Text)];
for (int i = 0; i < Controls.Count; i++)
{
if (Controls[i].Name == "tt")
{
x[k1] = int.Parse(Controls[i].Text);
k1++;
}
if (Controls[i].Name == "tt2")
{
y[k2] = int.Parse(Controls[i].Text);
k2++;
}
}
MessageBox.Show("
}
catch
{
MessageBox.Show(";)"
}
" + n + "
");
}
private void button3_Click(object sender, EventArgs e)
{
int i = 0;
Label L3 = new Label();
L3.Text = " Z = x * y ";
Controls.Add(L3);
L3.Location = new Point(button3.Left, button3.Bottom + button3.Height * i);
if (x != null)
{
for (; i < n; i++)
{
TextBox t2 = new TextBox();
t2.Name = "tt3";
t2.Location = new Point(button3.Left, L3.Bottom + L3.Height * i);
Controls.Add(t2);
z[i] = x[i] * y[i];
t2.Text = z[i].ToString();
}
}
}
private void button4_Click(object sender, EventArgs e)
{
for (int i = 0; i < Controls.Count; i++)
{
if (Controls[i].Name == "tt" || Controls[i].Name == "tt2" || Controls[i].Name
== "x Array" || Controls[i].Name == "y Array")
{
Controls[i].Dispose();
i--;
}
}
}
private void button5_Click(object sender, EventArgs e)
{
x1 = new List<int>();
y1 = new List<int>();
int countx = 0;
int county = 0;
try
{
}
catch
{
MessageBox.Show(";)"
}
MessageBox.Show("list " + " x
y " + county);
namespace Class_6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
TextBox[] x;
namespace class_7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text = b.Text;
}
}
}//
b button1
namespace homwork_7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int sum = 0;
List <int> x = new List<int>();
private void button1_Click(object sender, EventArgs e)
{
int n = 1;
for (int j=1; j<=10; j++){
for (int i = 1; i <=10; i++)
{
Button b = new Button();
Controls.Add(b);
b.Name = "b";
b.Text = n.ToString();
b.Top = button1.Bottom + i * 25;
b.Left = button1.Left + j * 75;
n++;
b.Click +=new EventHandler(b_Click);
}
}
}
private void b_Click(object sender, EventArgs e)
{
Button b1= sender as Button;
textBox1.Text = b1.Text;
sum += int.Parse(b1.Text);
label1.Text = sum.ToString();
if (sum < 200)
{
b1.BackColor = Color.Red;
}
else
b1.BackColor = Color.Blue;
}
private void button2_Click(object sender, EventArgs e)
{
x.Add(int.Parse(textBox1.Text));
}
private void button3_Click(object sender, EventArgs e)
{
int i = 0;
foreach (int s in x)
{
TextBox t = new TextBox();
Controls.Add(t);
t.Location = new Point(button3.Left, button3.Bottom + 25 * i++);
t.Text = s.ToString();
}
}
private void button1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'a')
MessageBox.Show("jhjhj");
namespace homework_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Button b1 = new Button();
b1.Location = new Point(150, 25);
Controls.Add(b1);
b1.Click+=new EventHandler(b1_Click);
b1.Text = "genrate four buttons";
b1.Width = 150;
}
private void b1_Click(object sender, EventArgs e)
{
for (int i = 1; i < 5; i++)
{
Button b = new Button();
b.Location = new Point(0, 0 + i * 50);
Controls.Add(b);
b.Text = i.ToString();
b.Name = i.ToString();
b.Click += new EventHandler(Form1_Click);
}
}
private void Form1_Click(object sender, EventArgs e)
{
Button bb = sender as Button;
bb.Left += bb.Width *int.Parse(bb.Text) ;
}
sender ( controls)
namespace class_8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if(! Char.IsDigit(e.KeyChar))
e.Handled=true;
TextBox t = new TextBox();
Controls.Add(t);
t.Text = e.KeyChar.ToString();
t.Location = new Point(button1.Left, button1.Bottom + button1.Height * i++);
}
int k=0,j = 0,m=0;
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
TextBox t = new TextBox();
Controls.Add(t);
t.Text = e.KeyCode.ToString();
t.Location = new Point(button2.Left, button2.Bottom + button2.Height * j++);
TextBox tdata = new TextBox();
Controls.Add(tdata);
tdata.Text = e.KeyData.ToString();
tdata.Location = new Point(button3.Left, button3.Bottom + button3.Height * k++);
TextBox tvalue = new TextBox();
Controls.Add(tvalue);
tvalue.Text = e.KeyValue.ToString();
tvalue.Location = new Point(button4.Left, button4.Bottom +
button4.Height * m++);
}
}
}
namespace homework_9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int w = 0, h =0 , s = 0;
if (e.KeyCode == Keys.Z)//
{
button1.Top = button1.Top + 1;
button1.BackColor = Color.White;
if (button1.Bottom == 300 + h)
{
this.Height = this.Height + 1;
h++;
}
}
if (e.KeyData == (Keys.Z | Keys.Control))//
{
button1.Top = button1.Top + 5;
button1.BackColor = Color.White;
if (button1.Bottom >= 300 + h)
{
this.Height = this.Height + 5;
h += 5;
}
}
if (button1.Right >= 1370)//
button1.Left = 0;
if (button1.Bottom >= 700)// //
button1.Top = 0;
for (int i = 0; i < Controls.Count; i++) //
{
if (button1.Top==Controls[i].Top && button1.Left==Controls[i].Left && Controls[i].Name=="b")
{
s++;
label2.Text = s.ToString();
Controls[i].Dispose();
}
}
}
private void button1_Click(object sender, EventArgs e)
{
int name = 1;
for (int i= 0 ; i<= 2; i++)//
for (int j = 1; j <= 3; j++)
{
Button b = new Button();
b.Size = button1.Size;
b.Location = new Point(100 + i*150,100 + j*150);
b.Name = "b";
b.Text = name.ToString();
name++;
b.BackColor = button1.BackColor;
b.ForeColor = button1.ForeColor;
Controls.Add(b);
}
}
private void button1_KeyUp(object sender, KeyEventArgs e)
{
button1.BackColor = Color.Black;//
}
DialogResult d = DialogResult.yes;
private void button2_Click(object sender, EventArgs e)
{
if (d== MessageBox.Show("" , "worning",MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Exclamation))
this.Close();
}
}
}
using Microsoft.VisualBasic;
namespace class_9
{
private void button1_Click(object sender, EventArgs e)
{
DialogResult d1;
d1 = DialogResult.Yes;
d1= MessageBox.Show("Quit game","Game", MessageBoxButtons.YesNoCancel
,MessageBoxIcon.Question);
if (d1 == DialogResult.Yes) Close();
if (d1 == DialogResult.No) MessageBox.Show("the No button clicked");
}
private void button2_Click(object sender, EventArgs e)
{
string name;
name=Interaction.InputBox("Enter your name");
MessageBox.Show("The entered name is : " + name);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
int x, y, z;
if (textBox1.Text == "")
x = 0;
else x = int.Parse(textBox1.Text);
if (textBox2.Text == "")
y = 0;
else y = int.Parse(textBox2.Text);
if (textBox3.Text == "")
z = 0;
else z = int.Parse(textBox3.Text);
label1.Text = (x + y + z).ToString();
}
Button b1 = new Button();
private void textBox4_KeyUp(object sender, KeyEventArgs e)
{
b1.Top = int.Parse(textBox4.Text);
Controls.Add(b1);
}
private void textBox5_KeyUp(object sender, KeyEventArgs e)
{
if (textBox5.Text == "") b1.Left = 0;
else b1.Left = int.Parse(textBox5.Text);
}
}
}
using System.IO;
namespace class_10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog opf = new OpenFileDialog();
if(opf.ShowDialog()==DialogResult.OK)
{
StreamReader sr = new StreamReader(opf.FileName);
textBox1.Text=sr.ReadLine();
textBox2.Text = sr.ReadLine();
}
}
private void button2_Click(object sender, EventArgs e)
{
StreamReader sr = new StreamReader("d:\\ali.txt");
textBox3.Text = sr.ReadToEnd();
}
private void button3_Click(object sender, EventArgs e)
{
SaveFileDialog saf = new SaveFileDialog();
if (saf.ShowDialog() == DialogResult.OK)
{
StreamWriter sw = new StreamWriter(saf.FileName);
sw.WriteLine(textBox1.Text);
sw.Close();
}
//(streamReader) ( streamWriter ) class
-----------------------------------------------------------------------------private void button5_Click(object sender, EventArgs e)
ali {
b
FileStream fs = File.OpenRead(@"d:\ali.txt");
byte[] b = new byte[fs.Length];
fs.Read(b, 0, b.Length);
rr2
FileStream fw = File.OpenWrite(@"d:\rr2.txt");
fw.Write(b, 0, 5);
fw.Close();
}
}
}//---------(FileStream ) class
using System.IO;
namespace homework_10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
FileStream f = File.OpenRead("d:\\a.txt");
byte[] b = new byte[f.Length];
f.Read(b, 0, 250);
FileStream f1 = File.OpenWrite("d:\\b.txt");
f1.Write(b, 0, 50);
f1.Close();
FileStream f2 = File.OpenWrite("d:\\c.txt");
f2.Write(b, 50, 100);
f2.Close();
FileStream f3 = File.OpenWrite("d:\\d.txt");
f3.Write(b, 100, 150);
f3.Close();
FileStream f4 = File.OpenWrite("d:\\e.txt");
f4.Write(b, 150, 200);
f4.Close();
FileStream f5 = File.OpenWrite("d:\\f.txt");
f5.Write(b, 200, 250);
f5.Close();
-:
namespace class_11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
private void button2_Click(object sender, EventArgs e)
{
Graphics gr = Graphics.FromHwnd(Handle);
Image i = Image.FromFile(@"D:\sharp.jpg");
gr.DrawImage(i, 0, 0);
}
using System.IO;
namespace class_12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int k = 0, m = 0;
private void button1_Click(object sender, EventArgs e)
{
string[] drivnames = Environment.GetLogicalDrives();
foreach(string driv in drivnames)
{
DriveInfo drv = new DriveInfo(driv);
if (drv.IsReady)
{
TextBox t1 = new TextBox();
t1.Location = new Point(button6.Left, button6.Bottom +
button6.Height * k++);
Controls.Add(t1);
t1.Text = drv.Name;
TextBox t2 = new TextBox();
t2.Location = new Point(button5.Left, button5.Bottom +
button5.Height * m++);
Controls.Add(t2);
t2.Text = drv.TotalSize.ToString();
DirectoryInfo dr = drv.RootDirectory;
CheckAll(dr);
}
}
int i = 0;
private void button4_Click(object sender, EventArgs e)
{
DirectoryInfo d1 = new DirectoryInfo(@"c:\first\second\");
if (!d1.Exists) d1.Create();
// FileInfo f1 = new FileInfo(d1+"easy.txt");
FileInfo f1 = new FileInfo(@"c:\first\second\easy.txt");
"
if (files != null)
{
foreach (FileInfo ff in files)
MessageBox.Show(ff.FullName);
}
DirectoryInfo[] directories = null;
try
{
directories = dir.GetDirectories();
}
catch (UnauthorizedAccessException)
{ }
if (directories != null)
{
foreach (DirectoryInfo dd in directories)
CheckAll(dd);
}
}
--------------------------------------------------------------------------------------------using System.IO;
namespace homework_FlashMemory
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string s1, s2="",s3,ss;
private void button1_Click(object sender, EventArgs e)
{
CheckBox[] x = new CheckBox[]
{
checkBox1,checkBox2,checkBox3,checkBox4,
checkBox5,checkBox6,checkBox7}
for (int i = 0; i < 7; i++)
{
if (x[i].Checked)
{ ss = x[i].Text;
MessageBox.Show(" Copying from drive "+ss);
DriveInfo dd = new DriveInfo(ss);
if (dd.IsReady )
{
DirectoryInfo dir = dd.RootDirectory;
// DirectoryInfo dir=new DirectoryInfo(@"H:\big");
checkAll(dir);
}
}
}
}
}
else MessageBox.Show("The " + s2 + " as target drive is not ready");
}
// else MessageBox.Show("Please select a file type");
namespace class_13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Graphics gr = Graphics.FromHwnd(Handle);
OpenFileDialog opf = new OpenFileDialog();
opf.Filter = "Image files|*e*.jpg;d?????.bmp";
bp2 -
using System.Drawing.Printing;
namespace class_14
{
public partial class Form1 : Form
{
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Text = "goal";
// f2.f1 = this;
f2.Show();
}
private void button2_Click(object sender, EventArgs e)
{
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.Black), 200, 300, 10, 40);
}
private void button3_Click(object sender, EventArgs e)
{
PrintDialog pdg = new PrintDialog();
if (pdg.ShowDialog() == DialogResult.OK)
{
PrintDocument pd = new PrintDocument();
pd.PrinterSettings = pdg.PrinterSettings;
pdg.Document = pd;
pd.PrintPage += new PrintPageEventHandler(ptttp);
//MessageBox.Show("we ready to print");
pd.Print();
}
}
private void ptttp(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.Red), 500, 300, 10, 40);
}
}
}
using System.Drawing.Printing;
namespace class_15
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void printDocument1_PrintPage(object
printDocument1_PrintPage
sender, PrintPageEventArgs e)
{
e.Graphics.DrawString("Let's
Let's go
go", new Font("Arial", 16, FontStyle.Regular),
Brushes.Black, 10, 10);
}
private void button1_Click(object
button1_Click(
sender, EventArgs e)
{
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
// ( print Document1) ( print dialog )
properties ... -:
private void button2_Click(object
button2_Click(
sender, EventArgs e)
{
x = 1;
PrintDialog pdg = new PrintDialog();
if (pdg.ShowDialog() == DialogResult.OK)
{
PrintDocument pd = new PrintDocument();
pd.PrinterSettings = pdg.Printe
pdg.PrinterSettings;//
pd.PrintPage += new PrintPageEventHandler(ptt);
pd.Print();
}
}
int x=1;
private void ptt(object
object sender, PrintPageEventArgs evv)
{
if(x==1)
evv.Graphics.DrawString(textBox1.Text,
new Font("Arial"
"Arial", 16, FontStyle.Regular),
textBox1
Brushes.Black, 10, 10);
if(x==2)
evv.Graphics.DrawString(textBox2.Text,
new Font("Arial"
"Arial", 16, FontStyle.Regular),
textBox2
Brushes.Black, 10, 10);
if (x < 2) evv.HasMorePages = true;
x++;
}
}
} // ( print Document1) ( print dialog )
using System.Drawing.Printing;
using System.IO;
namespace homework_14
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int count = 0 ,x = 0;
StreamReader r = new StreamReader("d:\\tt.txt");
d:\\tt.txt
count -
(printDialog1) -
-
-
Count -
namespace screen_shot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//
Point start;
- Microsoft access
-
- ) ( ) ( En.
- c#
-
- view other window server Explorer ) . ( ctrl + alt + s
-
-
ok
- change
- Browse
- Advanced
-
using System.Data.OleDb;
namespace _1database
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
DataSet ds;
OleDbConnection con;
OleDbDataAdapter da;
private void button1_Click(object sender, EventArgs e)
{
ds = new DataSet();
con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
DataSource=C:\Users\hP\Documents\7.accdb");
da = new OleDbDataAdapter("select * from tab1",con);
con.Open();
da.Fill(ds,"all");
( paste)