本文整理汇总了C#中System.Windows.Forms.Panel.CreateGraphics方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.CreateGraphics方法的具体用法?C# Panel.CreateGraphics怎么用?C# Panel.CreateGraphics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Panel
的用法示例。
在下文中一共展示了Panel.CreateGraphics方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Drawer
public Drawer(Panel panel, int _xGridSquareSize, int _yGridSquareSize)
{
g = panel.CreateGraphics();
xGridSquareSize = _xGridSquareSize;
yGridSquareSize = _yGridSquareSize;
with = new DrawerUtensils();
}
示例2: Draw
public override void Draw(Panel panel) // 畫出橢圓形
{
Pen myPen = new Pen(Color.Black, 1);
Brush myBrush = new SolidBrush(Color.LightGray);
StringFormat drawFormat = new StringFormat(); // 設定字形的位置
drawFormat.Alignment = StringAlignment.Center; // 水平置中
drawFormat.LineAlignment = StringAlignment.Center; // 垂直置中
rect = new Rectangle(coordinate, size);
panel.CreateGraphics().FillEllipse(myBrush, rect);
panel.CreateGraphics().DrawEllipse(myPen, rect);
panel.CreateGraphics().DrawString(myID, new Font("Arial", 16), new SolidBrush(Color.Black), rect, drawFormat);
myPen.Dispose();
myBrush.Dispose();
}
示例3: DrawCross
public void DrawCross(Panel panel)
{
Graphics g = panel.CreateGraphics();
Pen _pen = new Pen(Color.Black, _linewidth);
g.DrawLine(_pen, new Point(_innerMargin, _innerMargin), new Point(_square - _innerMargin, _square - _innerMargin));
g.DrawLine(_pen, new Point(_innerMargin, _square - _innerMargin), new Point(_square - _innerMargin, _innerMargin));
}
示例4: Draw
public Draw(Panel panel1,Panel panel2)
{
width = panel2.Width;
height = panel2.Height;
formGraphics = panel1.CreateGraphics();
formGraphics2 = panel2.CreateGraphics();
}
示例5: PrintPanel
public void PrintPanel(Panel p)
{
Graphics mygraphics = p.CreateGraphics();
Size s = p.Size;
mBitmap = new Bitmap(s.Width, s.Height, mygraphics);
Graphics memoryGraphics = Graphics.FromImage(mBitmap);
IntPtr dc1 = mygraphics.GetHdc();
IntPtr dc2 = memoryGraphics.GetHdc();
BitBlt(dc2, 0, 0, p.ClientRectangle.Width, p.ClientRectangle.Height, dc1, 0, 0, 13369376);
mygraphics.ReleaseHdc(dc1);
memoryGraphics.ReleaseHdc(dc2);
saveFileDialog1.Filter = "图片文件(*.jpg)|*.jpg;";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
mBitmap.Save(saveFileDialog1.FileName, ImageFormat.Jpeg);
}
catch (Exception ee)
{
MessageBox.Show(ee.Message, "Error");
return;
}
MessageBox.Show("保存成功!", "提示");
}
}
示例6: Vista
public Vista(Panel areaDibujo)
{
g = areaDibujo.CreateGraphics();
anchura = areaDibujo.Width;
altura = areaDibujo.Height;
}
示例7: DrawRectangle
public void DrawRectangle(Pen pen, Panel canvas)
{
Graphics g = canvas.CreateGraphics();
g.DrawRectangle(pen, new Rectangle(X, Y, Width, Height));
g.Dispose();
pen.Dispose();
}
示例8: Vista
public Vista(Panel areaDibujo)
{
this.g = areaDibujo.CreateGraphics();
this.colorLapiz = Color.Empty;
ancho = areaDibujo.Width;
alto = areaDibujo.Height;
}
示例9: Nodes
public Nodes(Panel panel1,Panel panel2)
{
formGraphics = panel1.CreateGraphics();
formGraphics.DrawRectangle(new Pen(Color.Blue, 5), panel1.ClientRectangle);
formGraphics2 = panel2.CreateGraphics();
formGraphics2.DrawRectangle(new Pen(Color.Blue, 5), panel2.ClientRectangle);
}
示例10: Draw
public static void Draw( string text, int[] pixels)
{
var form = new Form { TopMost = true, Visible = true, Width = 29 * tileSize, Height = 29 * tileSize };
var panel = new Panel { Dock = DockStyle.Fill };
panel.BackColor = Color.Black;
form.Controls.Add(panel);
var graphics = panel.CreateGraphics();
for(int index=0; index < pixels.Length; index++){
int col = index % characerSize;
int row = index / characerSize;
Color color = Color.FromArgb(pixels[index], pixels[index], pixels[index]);
var brush = new SolidBrush(color);
graphics.FillRectangle(brush,col*tileSize,row*tileSize,tileSize,tileSize);
}
var point = new PointF(5, 5);
var font = new Font(FontFamily.GenericSansSerif, 30 );
graphics.DrawString(text, font, new SolidBrush(Color.Red), point);
Application.EnableVisualStyles();
Application.Run(form);
}
示例11: Vista
public Vista(Panel areaDibujo, Color c1)
{
g = areaDibujo.CreateGraphics();
colorLapiz = c1;
anchura = areaDibujo.Width;
altura = areaDibujo.Height;
}
示例12: DrawCross
private void DrawCross(Panel panel)
{
Graphics g = panel.CreateGraphics();
Pen _pen = new Pen(Color.Black, _linewidth);
g.DrawLine(_pen, new Point(_margin1, _margin1), new Point(_square - _margin1, _square - _margin1));
g.DrawLine(_pen, new Point(_margin1, _square - _margin1), new Point(_square - _margin1, _margin1));
}
示例13: fill_pictureBox
/// <summary>
/// Заполняет область рисования указанным цветом
/// </summary>
/// <param name="pb">объект для рисования PictureBox, ссылочный</param>
/// <param name="C">цвет для заливки</param>
public static void fill_pictureBox(ref Panel pb, Color C)
{
using (Graphics G = pb.CreateGraphics())
{
G.Clear(C);
}
}
示例14: DrawMap
/// <summary>
/// 地图描边
/// </summary>
/// <param name="panel"></param>
/// <param name="map"></param>
public static void DrawMap(Panel panel, ModelMap map)
{
#region 勾画地图
var g = panel.CreateGraphics();
#region 画横线
for (int ri = 0; ri <= map.Row; ri++)
{
g.DrawLine(new Pen(Color.Black), 0, ri * map.Box.Height, map.Column * map.Box.Width, ri * map.Box.Height);
}
#endregion
#region 画竖线
for (int ci = 0; ci <= map.Column; ci++)
{
g.DrawLine(new Pen(Color.Black), ci * map.Box.Width, 0, ci * map.Box.Height, map.Row * map.Box.Width);
}
#endregion
#region 勾画方块
foreach (var b in map.Body)
{
DrawMapBox(panel, map.Color, b.Abscissa, b.Ordinate, map.Box.Width, map.Box.Height);
}
#endregion
#endregion
}
示例15: Vista
public Vista(Panel areaDibujo, Color cl, Color cf)
{
g = areaDibujo.CreateGraphics();
ColorLapiz = cl;
ColorFondo = cf;
anchura = areaDibujo.Width;
altura = areaDibujo.Height;
}