科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道C#中水晶按钮的程序生成 2

C#中水晶按钮的程序生成 2

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

  private void DrawYinYing(Graphics gr,bool xiacen) { Rectangle rect= this

作者:中国IT实验室 来源:中国IT实验室 2007年9月10日

关键字: C# 编程

  • 评论
  • 分享微博
  • 分享邮件
  


  private void DrawYinYing(Graphics gr,bool xiacen)
  {
   Rectangle rect= this.ClientRectangle;
   rect.Inflate(-(rect.Width/10),-(rect.Height)/4);
   float bf1=rect.Width/100f;
   float bf2=rect.Height/100f;
   
   rect.Y=rect.Y+this.ClientRectangle.Height/4;
   if(xiacen)
   {
    rect.Y=rect.Y+4;
   }
   GraphicsPath path;
   
   for(int a=1;a<33;a++)
   {
    float bf3=bf1*a;
    float bf4=bf2*a;
    Rectangle rect1=rect;
    rect1.Inflate(-(int)bf3,-(int)bf4);
    path=GetGraphicsPath(rect1);
        
    int r=backColor.R;
    int g=backColor.G;
    int b=backColor.B;
    r=r+3*a;
    g=g+3*a;
    b=b+3*a;
    if(r>255) r=255;
    if(g>255) g=255;
    if(b>255) b=255;
    gr.FillPath(new SolidBrush(Color.FromArgb(r,g,b)),path);
   }
  }
  
  private void DrawGaoLiang(Graphics g,bool xiacen)
  {
   Rectangle rect= this.ClientRectangle;
   rect.Inflate(-4,-4);
   
   if(xiacen)
   {
    rect.Y=rect.Y+4;
   }
   GraphicsPath path=GetGraphicsPath1(rect);
   RectangleF rect1=path.GetBounds();
   rect1.Height=rect1.Height+1;
   g.FillPath(new LinearGradientBrush(rect1,
    Color.FromArgb(0xff,0xff,0xff,0xff),
    Color.FromArgb(0xff,backColor),LinearGradientMode.Vertical),path);
  }
  
  private void DrawText(Graphics g,bool xiacen)
  {
   Rectangle rect= this.ClientRectangle;
   Rectangle rect1= this.ClientRectangle;
   StringFormat stringFormat=new StringFormat();
   stringFormat.Alignment=StringAlignment.Center;
   stringFormat.LineAlignment=StringAlignment.Center;
   rect.Y=this.ClientRectangle.Height/5;
   if(xiacen)
   {
    rect.Y=rect.Y+4;
    rect1.Y=rect1.Y+4;
   }
   
   Font font=this.Font;
   
   
   if(mouseMove)
   {
    font=new Font(this.Font,FontStyle.Underline);
   }
   
   g.DrawString(this.Text,font,
    new SolidBrush(Color.FromArgb(0x66,backColor)),rect,stringFormat);
   g.DrawString(this.Text,font,new SolidBrush(this.ForeColor),rect1,stringFormat);
  }

  private void UserControl1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
  {
   if(XiaCen==false)
   {
    XiaCen=true;
    this.Refresh();
   }
  }
  
  private void UserControl1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
  {
   if(XiaCen==true)
   {
    XiaCen=false;
    this.Refresh();
   }
  }

  private void UserControl1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
   
   
  }
 

查看本文来源

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章