zoukankan      html  css  js  c++  java
  • 椭圆按纽制作

    TButtonTest   =   class(TGraphicControl)  
      public  
          constructor   Create(aOwner:   TComponent);   override;  
      protected  
          procedure   Paint;   override;  
      end;  
       
      constructor   TButtonTest.Create(aOwner:   TComponent);  
      begin  
          inherited;  
          Height:=50;  
          Width:=100;  
      end;  
       
      procedure   TButtonTest.Paint;  
      begin  
          inherited;  
          Canvas.Brush.Style:=bsClear;  
          Canvas.Pen.Color:=clBlue;  
          Canvas.Brush.Color:=clGreen;  
          Canvas.RoundRect(0,0,Width,Height,8,8);//圆角矩形  
          Canvas.Ellipse(0,0,Width,Height);//椭圆  
      end;  
       
      var   Btn:TButtonTest;  
       
      Btn:=TButtonTest.Create(self);  
      Btn.Parent:=Self;   
    椭圆形按钮:  
      type  
          TRbutton=class(TButton)  
      private  
          .......  
      protected  
          procedure   CreateWnd;override;  
          ........  
          ........  
      procedure   TRbutton.CreateWnd;//在控件一建立就设置  
      var  
          hRgn   :THandle;  
      begin  
          inherited     CreateWnd;  
          hRgn:=CreateEllipticRgn(0,0,Width,Height);//创建一个椭圆剪裁域;  
          SetWindowRgn(Handle,hRgn,True);  
      end;   
       
  • 相关阅读:
    组合模式
    迭代器模式
    模板方法模式
    外观模式
    适配器模式
    运行mysql时,提示Table ‘performance_schema.session_variables’ doesn’t exist
    idea maven 打包 引用本地jar
    centos7 安装redis
    centos7 防火墙
    linux 常用命令
  • 原文地址:https://www.cnblogs.com/chengxin1982/p/1409770.html
Copyright © 2011-2022 走看看