当前位置:首页 » 多媒体相关

继承TGraphicControl类的控件如何清除内容恢复透明


我继承了tgraphiccontrol类做了一个控件,要把内容擦除,恢复透明状态,我已经参照了tshape的做法,可是还是不行,不知为何,请指点,代码如下:  
          pen.style   :=   psclear;  
          pen.width   :=   1;  
          pen.mode     :=   pmcopy;  
          brush.style   :=   bsclear;  
          rectangle(rect);

推荐阅读

  • 三星E318的版本大全 [详细内容]
  • 国庆手机销售被重视 顾客购买正当是好时候 [详细内容]
  • North Q特别版强力模块电源NQ-4100推出 [详细内容]
  • 7260新手必读(三) [详细内容]
  • Ebay夸大中国表现 淘宝称其掩耳盗铃误导用户 [详细内容]
  • 盛大痛下决心整风革新管理 痛批内部丑恶现象 [详细内容]
  • Flash需求旺 模块厂商设计厂商关系亲密 [详细内容]
  • 网友回答:
    网友:zswang

    type  
          ttempgraphic   =   class(tgraphiccontrol)  
          protected  
              procedure   paint;   override;  
          end;  
       
      {   ttempgraphic   }  
       
      procedure   ttempgraphic.paint;  
      begin  
          inherited;  
      //     canvas.pen.style   :=   psclear;//如果有这条就是全部透明了~~  
       
          canvas.brush.style   :=   bsclear;  
          canvas.rectangle(rect(0,   0,   width,   height));  
      end;  
       
      {   tform1   }  
       
      procedure   tform1.formcreate(sender:   tobject);  
      begin  
          with   ttempgraphic.create(self)   do   begin  
              parent   :=   self;  
              width   :=   100;  
              height   :=   100;  
          end;  
      end;  
       
       
      //不明白你的意思,随便灌灌~~

    .

    讨论区

    Login