using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
namespace testgrid
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
...{
}
private void Form1_Load(object sender, EventArgs e)
...{
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
...{
MessageBox.Show(e.ToString());
e.Handled = true;
}
protected override void OnPaint(PaintEventArgs e)
...{
//Graphics g = e.Graphics;
//Pen pen = new Pen(ForeColor);
//g.SmoothingMode = SmoothingMode.None;
//g.PixelOffsetMode = PixelOffsetMode.Default;
//g.DrawLine(pen, 2, 2, 180, 100);
DoPage(e.Graphics, ForeColor, ClientSize.Width, ClientSize.Height);
}
protected override void OnClick(EventArgs e)
...{
PrintDocument prndoc = new PrintDocument();
prndoc.DocumentName = Text;
prndoc.PrintPage += new PrintPageEventHandler(prndoc_PrintPage);
}
void prndoc_PrintPage(object sender, PrintPageEventArgs e)
...{
Graphics g = e.Graphics;
SizeF sizef = g.VisibleClipBounds.Size;
DoPage(g, Color.Black, (int)sizef.Width, (int)sizef.Height);
}
protected virtual void DoPage(Graphics g, Color clr, int cx, int cy)
...{
Pen pen=new Pen(clr);
g.DrawLine(pen,0,0,cx-1,cy-1);
g.DrawLine(pen, cx - 1, 0, 0, cy - 1);
}
public void Form1_SizeChanged(object sender, EventArgs e)
...{
this.Refresh();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
namespace testgrid
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
...{
}
private void Form1_Load(object sender, EventArgs e)
...{
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
...{
MessageBox.Show(e.ToString());
e.Handled = true;
}
protected override void OnPaint(PaintEventArgs e)
...{
//Graphics g = e.Graphics;
//Pen pen = new Pen(ForeColor);
//g.SmoothingMode = SmoothingMode.None;
//g.PixelOffsetMode = PixelOffsetMode.Default;
//g.DrawLine(pen, 2, 2, 180, 100);
DoPage(e.Graphics, ForeColor, ClientSize.Width, ClientSize.Height);
}
protected override void OnClick(EventArgs e)
...{
PrintDocument prndoc = new PrintDocument();
prndoc.DocumentName = Text;
prndoc.PrintPage += new PrintPageEventHandler(prndoc_PrintPage);
}
void prndoc_PrintPage(object sender, PrintPageEventArgs e)
...{
Graphics g = e.Graphics;
SizeF sizef = g.VisibleClipBounds.Size;
DoPage(g, Color.Black, (int)sizef.Width, (int)sizef.Height);
}
protected virtual void DoPage(Graphics g, Color clr, int cx, int cy)
...{
Pen pen=new Pen(clr);
g.DrawLine(pen,0,0,cx-1,cy-1);
g.DrawLine(pen, cx - 1, 0, 0, cy - 1);
}
public void Form1_SizeChanged(object sender, EventArgs e)
...{
this.Refresh();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace testgrid
...{
public partial class StarGradientBrush : Form1
...{
public StarGradientBrush()
...{
InitializeComponent();
}
protected override void DoPage(Graphics g, Color clr, int cx, int cy)
...{
//base.DoPage(g, clr, cx, cy);
Point[] apt = new Point[5];
for (int i = 0; i < apt.Length; i++)
...{
double dAngle = (i * 0.8 - 0.5) * Math.PI;
apt[i] = new Point((int)(cx * (0.5 + 0.48 * Math.Cos(dAngle))),(int)(cy*(0.5+0.48*Math.Sin(dAngle))));
}
PathGradientBrush pgbrush = new PathGradientBrush(apt);
pgbrush.CenterColor = Color.White;
pgbrush.SurroundColors = new Color[1] ...{ Color.Black };
g.FillRectangle(pgbrush, 0, 0, cx, cy);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace testgrid
...{
public partial class StarGradientBrush : Form1
...{
public StarGradientBrush()
...{
InitializeComponent();
}
protected override void DoPage(Graphics g, Color clr, int cx, int cy)
...{
//base.DoPage(g, clr, cx, cy);
Point[] apt = new Point[5];
for (int i = 0; i < apt.Length; i++)
...{
double dAngle = (i * 0.8 - 0.5) * Math.PI;
apt[i] = new Point((int)(cx * (0.5 + 0.48 * Math.Cos(dAngle))),(int)(cy*(0.5+0.48*Math.Sin(dAngle))));
}
PathGradientBrush pgbrush = new PathGradientBrush(apt);
pgbrush.CenterColor = Color.White;
pgbrush.SurroundColors = new Color[1] ...{ Color.Black };
g.FillRectangle(pgbrush, 0, 0, cx, cy);
}
}
}