001.
using
System;
002.
using
System.Linq;
003.
using
System.Text;
004.
using
System.Data;
005.
using
System.Drawing;
006.
using
System.Windows.Forms;
007.
using
System.ComponentModel;
008.
using
System.Drawing.Drawing2D;
009.
using
System.Collections.Generic;
010.
011.
namespace
Overlap
012.
{
013.
public
partial
class
Form1 : Form
014.
{
015.
public
Form1()
016.
{
017.
InitializeComponent();
018.
}
019.
020.
021.
022.
023.
024.
025.
026.
027.
private
void
button1_Click(
object
sender, EventArgs e)
028.
{
029.
this
.Cursor = Cursors.WaitCursor;
030.
Application.DoEvents();
031.
032.
float
i =
float
.Parse(textBox2.Text);
033.
float
j =
float
.Parse(textBox1.Text);
034.
float
iwide =
float
.Parse(textBox3.Text);
035.
036.
037.
Bitmap bm =
new
Bitmap(picCanvas.ClientSize.Width, picCanvas.ClientSize.Height);
038.
picCanvas.Image = bm;
039.
040.
041.
using
(Graphics gr = Graphics.FromImage(bm))
042.
{
043.
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
044.
DrawImage(gr, i, j, iwide);
045.
}
046.
047.
048.
this
.Cursor = Cursors.Default;
049.
050.
051.
}
052.
void
DrawImage(Graphics gr,
float
i,
float
j,
float
iwide)
053.
{
054.
055.
gr.Clear(picCanvas.BackColor);
056.
057.
gr.PageUnit = GraphicsUnit.Millimeter;
058.
Pen p =
new
Pen(Color.Black, 1);
059.
Pen pp =
new
Pen(Color.Blue, 0.01f);
060.
Pen p_r =
new
Pen(Color.Red, 0.5f);
061.
062.
gr.DrawRectangle(p, 0,0, i, j);
063.
064.
float
jj, jja, r = 10;
065.
float
x1 = 0, y1 = 0,jjj;
066.
067.
jj = (j / 10) - 1;
068.
jja = (i / 10) - 1;
069.
float
a, b1, c, d,b2,A1,aaa,b3;
070.
c = iwide;
071.
aaa=i/c;
072.
A1 =(i-aaa)/c ;
073.
b2 = i - aaa;
074.
075.
jjj = (j / 2);
076.
for
(a = 0; a <= aaa-1; a++)
077.
{
078.
for
(b1 = 0; b1 <= (j / r) - 1; b1++)
079.
{
080.
081.
gr.DrawEllipse(p_r, 0 + (c *a), 0 + ((10 * b1 )), r, r);
082.
}
083.
084.
}
085.
086.
float
k;
087.
k = (i / 10) - 0;
088.
for
(iwide = 1; iwide <= k; iwide++)
089.
{
090.
091.
Pen pen =
new
Pen(Color.Black, 0.0005F);
092.
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
093.
094.
gr.DrawLine(pen, x1 + (iwide * 10) - 5, y1 + j, x1 + (iwide * 10) - 5, y1);
095.
gr.DrawLine(pen, x1 + (iwide * 10) - 5, y1 + j, x1 + (iwide * 10) - 5, y1);
096.
}
097.
098.
gr.Dispose();
099.
}
100.
public
object
PP {
get
;
set
; }
101.
102.
}
103.
}