bool cl = false;
int x1, y1 = 0;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
cl = true;
x1 = e.X;
y1 = e.Y;
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
cl = false;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (cl == true)
{
Bitmap b = new Bitmap(5, 5);
Rectangle r1 = new Rectangle(0, 0, 5, 5);
Graphics g = Graphics.FromImage(b);
g.SmoothingMode = SmoothingMode.AntiAlias;
LinearGradientBrush lgb = new LinearGradientBrush(r1,
Color.Yellow, Color.Green , LinearGradientMode.ForwardDiagonal);
g.FillRectangle(lgb, r1);
Rectangle r = new Rectangle(x1, y1, (e.X - x1) + 1, (e.Y - y1) + 1);
Bitmap b1 = new Bitmap(Width, Height);
Graphics g1 = Graphics.FromImage(b1);
g1.SmoothingMode = SmoothingMode.AntiAlias;
TextureBrush tb = new TextureBrush(b);
g1.FillRectangle(tb, r);
g1.DrawRectangle(new Pen(Brushes.Black), r);
this.BackgroundImage = b1;
}
}
using System.Text.RegularExpressions;
public static long LineCount2(string source, bool isFileName)
{
if (source != null)
{
string text = source;
long numOfLines = 0;
if (isFileName)
{
using (FileStream FS = new FileStream(source, FileMode.Open,
FileAccess.Read, FileShare.Read))
{
using (StreamReader SR = new StreamReader(FS))
{
while (text != null)
{
text = SR.ReadLine();
if (text != null)
{
++numOfLines;
}
}
}
}
return (numOfLines);
}
else
{
Regex RE = new Regex("\n", RegexOptions.Multiline);
MatchCollection theMatches = RE.Matches(text);
return (theMatches.Count + 1);
}
}
else
{
// Handle a null source here.
return (0);
}
}
MessageBox.Show(AppDomain.CurrentDomain.BaseDirectory);
MessageBox.Show(System.IO.Directory.GetCurrentDirectory());
MessageBox.Show(Application.StartupPath);
MessageBox.Show(System.IO.Path.GetDirectoryName(Application.ExecutablePath));
int l = 0;
private void timer1_Tick(object sender, EventArgs e)
{
l-=1;
System.Drawing.Drawing2D.GraphicsPath g = new System.Drawing.Drawing2D.GraphicsPath();
for (int i = 0; i <= 360; i+=20)
{
g.AddLine((float)Math.Cos(Math.PI * (i+l) / 180) * this.Width / 2 + this.Width / 2
, (float)Math.Sin(Math.PI * (i+l) / 180) * this.Height / 2 + this.Height / 2,
(float)Math.Cos(Math.PI * (i +l) / 180) * this.Width / 4 + this.Width / 2,
(float)Math.Sin(Math.PI * (i+l) / 180) * this.Height / 4 + this.Height / 2);
}
this.Region = new Region(g);
}
private void Form1_Load(object sender, EventArgs e)
{
this.Width = 300;
this.Height = 300;
}
double i = 0;
SolidBrush s = new SolidBrush(Color.Black);
private void timer1_Tick(object sender, EventArgs e)
{
Bitmap b = new Bitmap(pictureBox1.Image, pictureBox1.Size);
Graphics g = Graphics.FromImage(b);
i+=3;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawLine(new Pen(Brushes.Black),
float.Parse((Math.Cos(Math.PI * i / 180) * (b.Width / 20 + (i / 11)) + b.Width / 2).ToString()),
float.Parse((Math.Sin(Math.PI * i / 180) * (b.Width / 20 + (i / 11)) + b.Width / 2).ToString()),
float.Parse((Math.Cos(Math.PI * (i-1) / 180) * (b.Width / 20+((i-1)/11)) + b.Width / 2).ToString()),
float.Parse((Math.Sin(Math.PI * (i-1) / 180) * (b.Width / 20+((i-1)/11)) + b.Width / 2).ToString())
);
pictureBox1.Image = b;
this.Text = i.ToString();
if (i>=2660)
{
timer1.Enabled = false;
}
}
private void Form1_Load(object sender, EventArgs e)
{
Bitmap b = new Bitmap(pictureBox1.Width, pictureBox1.Height);
pictureBox1.Image = b;
}