Home>

I wrote a blog post last time,But every time I update the icon,The desktop will flash (refresh)/go.php?id=73350&s=aSome bloggers say that their icons will not refresh,Can also animate.I thought about it,If i want to achieve this effect,This can be achieved with a form, which is to embed a picture in the form.Then use a label to dynamically display the number of messages,The key is to hide the border of the form.Just set the background to transparent.If there is a rotation or scaling animation,Both can be implemented with c#.

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.linq;
using system.text;
using system.windows.forms;
namespace aopdemo
{
  public partial class appiconmsg:form
  {
    public appiconmsg ()
    {
      initializecomponent ();
      //Set the background to transparent
      this.backcolor=color.fromargb (116, 164, 2);
      this.transparencykey=this.backcolor;
    }
    private void appiconmsg_load (object sender, eventargs e)
    {
      this.width=64;
      this.height=64;
      this.label1.text="99";
      this.timer1.enabled=true;
    }
    //drag it around the screen
    private const int wm_nchittest=0x84;
    private const int htcaption=0x2;
    protected override void wndproc (ref message m)
    {
      //disable mousedoubleclick on form
      if (m.msg == wm_lbuttondblclk)
      {
        form2 frm=new form2 (msg);
        frm.show ();
        //this.close ();
        return;
      }
      if (m.msg == wm_nclbuttondblclk)
      {
        form2 frm=new form2 (msg);
        frm.show ();
        //this.close ();
        return;
      }
      //drag
      if (m.msg == wm_nchittest)
        m.result=new intptr (htcaption);
      else
        base.wndproc (ref m);
    }
    private int msg=0;
    private void timer1_tick (object sender, eventargs e)
    {
      int num=new random (). next (1, 100);
      msg=num;
      this.label1.text=num.tostring ();
    }
    const int wm_lbuttondblclk=0x0203;//client area
    const int wm_nclbuttondblclk=0x00a3;//non-client area
    private void toolstripexit_click (object sender, eventargs e)
    {
      this.close ();
    }
  }
}
c
  • Previous Method for mutual conversion between unicode and ASCII in JavaScript
  • Next Example to understand the problem of pointer to two-dimensional array of C language