abstract void
clearRect(int x, int y, int width, int height) 通过使用当前绘图表面的背景色进行填充来清除指定的矩形。
abstract void
clipRect(int x, int y, int width, int height) 将当前剪贴区与指定的矩形相交。
abstract void
copyArea(int x, int y, int width, int height, int dx, int dy) 将组件的区域複製到由 dx 和 dy 指定的距离处。
abstractGraphics
create() 创建一个新的 Graphics 对象,它是此 Graphics 对象的副本。
Graphics
create(int x, int y, int width, int height) 基于此 Graphics 对象创建一个新的 Graphics 对象,但是使用新的转换和剪贴区域。
abstract void
dispose() 释放此图形的上下文并释放它所使用的所有系统资源。
void
draw3DRect(int x, int y, int width, int height, boolean raised) 绘製指定矩形的 3-D 突出显示框线。
abstract void
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) 绘製一个覆盖指定矩形的圆弧或椭圆弧框线。
void
drawBytes(byte[] data, int offset, int length, int x, int y) 使用此图形上下文的当前字型和颜色绘製由指定的 byte 数组给定的文本。
void
drawChars(char[] data, int offset, int length, int x, int y) 使用此图形上下文的当前字型和颜色绘製由指定字元数组给定的文本。
abstract boolean
drawImage(Imageimg, int x, int y,Colorbgcolor,ImageObserverobserver) 绘製指定图像中当前可用的图像。
abstract boolean
ImageObserverobserver) 绘製指定图像中当前可用的图像。
abstract boolean
int width, int height,Colorbgcolor,ImageObserverobserver) 绘製指定图像中已缩放到适合指定矩形内部的图像。
abstract boolean
ImageObserverobserver) 绘製指定图像中已缩放到适合指定矩形内部的图像。
abstract boolean
drawImage(Imageimg, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,Colorbgcolor,ImageObserverobserver) 绘製当前可用的指定图像的指定区域,动态地缩放图像使其符合目标绘製表面的指定区域。
abstract boolean
ImageObserverobserver)
abstract void
drawLine(int x1, int y1, int x2, int y2) 在此图形上下文的坐标系统中,使用当前颜色在点 (x1, y1) 和 (x2, y2) 之间画一条线。
abstract void
drawOval(int x, int y, int width, int height) 绘製椭圆的框线。
abstract void
drawPolygon(int[] xPoints, int[] yPoints, int nPoints) 绘製一个由x和y坐标数组定义的闭合多边形。
void
drawPolygon(Polygonp) 绘製由指定的 Polygon 对象定义的多边形框线。
abstract void
drawPolyline(int[] xPoints, int[] yPoints, int nPoints) 绘製由x和y坐标数组定义的一系列连线线。
void
drawRect(int x, int y, int width, int height) 绘製指定矩形的框线。
abstract void
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) 用此图形上下文的当前颜色绘製圆角矩形的框线。
abstract void
drawString(AttributedCharacterIteratoriterator, int x, int y) 使用此图形上下文的当前颜色绘製由指定叠代器给定的文本。
abstract void
drawString(Stringstr, int x, int y) 使用此图形上下文的当前字型和颜色绘製由指定 string 给定的文本。
void
fill3DRect(int x, int y, int width, int height, boolean raised) 绘製一个用当前颜色填充的 3-D 突出显示矩形。
abstract void
fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) 填充覆盖指定矩形的圆弧或椭圆弧。
abstract void
fillOval(int x, int y, int width, int height) 使用当前颜色填充外接指定矩形框的椭圆。
abstract void
fillPolygon(int[] xPoints, int[] yPoints, int nPoints) 填充由x和y坐标数组定义的闭合多边形。
void
fillPolygon(Polygonp) 用图形上下文的当前颜色填充由指定的 Polygon 对象定义的多边形。
abstract void
fillRect(int x, int y, int width, int height) 填充指定的矩形。
abstract void
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) 用当前颜色填充指定的圆角矩形。
void
finalize() 一旦不再引用此图形上下文就释放它。
abstractShape
getClip() 获取当前的剪贴区域。
abstractRectangle
getClipBounds() 返回当前剪贴区域的边界矩形。
Rectangle
getClipBounds(Rectangler) 返回当前剪贴区域的边界矩形。
Rectangle
getClipRect() 已过时。从 JDK version 1.1 开始,由 getClipBounds() 取代。
abstractColor
getColor() 获取此图形上下文的当前颜色。
abstractFont
getFont() 获取当前字型。
FontMetrics
getFontMetrics() 获取当前字型的字型规格。
abstractFontMetrics
getFontMetrics(Fontf) 获取指定字型的字型规格。
boolean
hitClip(int x, int y, int width, int height) 如果指定的矩形区域与当前的剪贴区域相交,则返回 true。
abstract void
setClip(int x, int y, int width, int height) 将当前的剪贴区设定为由给定坐标指定的矩形。
abstract void
setClip(Shapeclip) 将当前的剪贴区域设定为任意的剪贴形状。
abstract void
setColor(Colorc) 将此图形上下文的当前颜色设定为指定颜色。
abstract void
setFont(Fontfont) 将此图形上下文的字型设定为指定字型。
abstract void
setPaintMode() 设定将此图形上下文的绘图模式,以便通过此图形上下文中的当前颜色来改写目标。
abstract void
setXORMode(Colorc1) 将此图形下文的绘图模式设定为在此图形上下文的当前颜色和新的指定颜色之间交替。
String
toString() 返回表示此 Graphics 对象值的 String 对象。
abstract void
translate(int x, int y) 将图形上下文的原点平移到当前坐标系统中的点 (x,y)。
public sealed class Graphics : MarshalByRefObject, IDeviceContext, IDisposableSystem.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red);//画笔System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷System.Drawing.Graphics formGraphics = this.CreateGraphics();formGraphics.FillEllipse(myBrush, newRectangle(0,0,100,200));//画实心椭圆formGraphics.DrawEllipse(myPen, new Rectangle(0,0,100,200));//空心圆formGraphics.FillRectangle(myBrush, new Rectangle(0,0,100,200));//画实心方formGraphics.DrawRectangle(myPen, new Rectangle(0,0,100,200));//空心矩形formGraphics.DrawLine(myPen, 0, 0, 200, 200);//画线formGraphics.DrawPie(myPen,90,80,140,40,120,100); //画馅饼图形//画多边形formGraphics.DrawPolygon(myPen,new Point[]{ new Point(30,140), new Point(270,250), new Point(110,240), new Point (200,170), new Point(70,350), new Point(50,200)}); //清理使用的资源myPen.Dispose(); myBrush.Dispose(); formGraphics.Dispose();使用Graphics对象绘製线条和形状、呈现文本或显示与操作图像,所用到的属性和方法如表所示。as3 绘图类GraphicsFlash中的绘图是通过Graphics类实现的,Graphics类直接继承Object类,有两种绘图方法,一是定义绘图样式的方法;一种是用于绘製和清除图形的方法。Graphics类有关样式的方法包括线条样式和填充样式两类。如下表:Graphics类的绘图样式方法