1个回答
展开全部
关键是要控制 坐标
这有代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DrawingPicture
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 5);
Pen p1 = new Pen(Color.Green, 5);
Pen p2 = new Pen(Color.Blue, 5);
p.EndCap = LineCap.ArrowAnchor;
g.DrawLine(p, 10, 10, 150, 100);
g.DrawLine(p, 10, 100, 150, 10);
g.DrawRectangle(p1, 10, 10, 150, 100);
g.DrawEllipse(p2, 10, 10, 150, 100);
HatchBrush s = new HatchBrush(HatchStyle.LargeCheckerBoard,Color.YellowGreen);
//SolidBrush s = new SolidBrush(Color.Pink);
//LinearGradientBrush l = new LinearGradientBrush(100,100,100,100,Color.Green,Color.Black);
//TextureBrush t = new TextureBrush(Image.FromFile("蝴蝶.jpg"));
Rectangle r=new Rectangle(150,10,150,150);
Rectangle r1 = new Rectangle(150,150,800,600);
g.DrawString("马发腾",new Font("微软雅黑",100),t,new Point(260,-5));
g.FillRectangle(s,r);
g.FillRectangle(t,r1);
}
}
}
这有代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DrawingPicture
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 5);
Pen p1 = new Pen(Color.Green, 5);
Pen p2 = new Pen(Color.Blue, 5);
p.EndCap = LineCap.ArrowAnchor;
g.DrawLine(p, 10, 10, 150, 100);
g.DrawLine(p, 10, 100, 150, 10);
g.DrawRectangle(p1, 10, 10, 150, 100);
g.DrawEllipse(p2, 10, 10, 150, 100);
HatchBrush s = new HatchBrush(HatchStyle.LargeCheckerBoard,Color.YellowGreen);
//SolidBrush s = new SolidBrush(Color.Pink);
//LinearGradientBrush l = new LinearGradientBrush(100,100,100,100,Color.Green,Color.Black);
//TextureBrush t = new TextureBrush(Image.FromFile("蝴蝶.jpg"));
Rectangle r=new Rectangle(150,10,150,150);
Rectangle r1 = new Rectangle(150,150,800,600);
g.DrawString("马发腾",new Font("微软雅黑",100),t,new Point(260,-5));
g.FillRectangle(s,r);
g.FillRectangle(t,r1);
}
}
}
更多追问追答
追问
我要的不是填充单纯的一个图形,是多个图形的交叉部分,比如说填充两个椭圆相交部分
追答
取出相交的部分,再 填充就行了..
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询