您的位置:程序门 -> .net技术 -> c#



初学,请问graphics如何实例化?为什么不能graphics g=new graphics(),实例化为有几中方式?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


初学,请问graphics如何实例化?为什么不能graphics g=new graphics(),实例化为有几中方式?
发表于:2007-01-23 12:02:41 楼主
如题。
发表于:2007-01-23 12:04:501楼 得分:0
private   void   form1_paint(object   sender,   painteventargs   e)
{
            graphics   graphics1   =   e.graphics;

 
我一般都是这么取得
发表于:2007-01-23 12:11:072楼 得分:0
graphics没有公有构造函数   ,如何实例化,可以用如下形式:

graphics   g=this.creategraphics();
发表于:2007-01-23 12:12:363楼 得分:0
graphics   g=graphics.fromimage( "... ");
发表于:2007-01-23 12:16:054楼 得分:0
public   static   graphics   fromimage   (
image   image
)

intptr   hwnd   =   this.handle;
        graphics   newgraphics   =   graphics.fromhwnd(hwnd);

picturebox的方法
graphics   creategraphics   ()
发表于:2007-01-23 13:24:245楼 得分:0
一般情况下,都是想在哪里画,就在哪里creat,比如想在form中画,就写
graphics   g   =   yourform.creategraphics();
想在picturebox中画就写   graphics   g   =   yourpicturebox.creategraphics();
发表于:2007-01-23 17:44:156楼 得分:0
方法:graphics   newgraphics   =   graphics.fromhwnd(...)

看看msdn就知道
发表于:2007-01-23 20:38:107楼 得分:0
查msdn不就知道了   ?


快速检索

最新资讯
热门点击