我想在任务栏上显示一个60分或120分的倒计时。格式,就像右下角的时间格式就行,字体是粗体,颜色红或蓝
字号当然越大越好,哪样看得方便。
这个倒计时时间,背景要透明,像屏幕右下角时间哪样。要一直置顶,不能被其它的任务栏按钮所挡住或覆盖掉,最好它可以用属标实现拖动,但不能拖出这个任务栏区?
这个效果要怎么写?

解决方案 »

  1.   

    类似于Windows Search的效果吧
      

  2.   

    没用过win7。不知Windows Search是什么效果
    只是一个倒计时的提醒程序,觉得放在任务栏中会明显一些。
      

  3.   

    搜索一下DeskBand,應可找到你要的答案
      

  4.   

    你这个新贴用Setparent函数设置新句柄就可以实现了。
      

  5.   

    进来学习一下
    Come under study
      

  6.   

    一个简单的实现思路,用TrayIcon,由于1个TrayIcon所能显示的区域较小,所以可用二个TrayIcon,系统设一定时器,对TrayIcon的Icon进行重画,应该可以实现
      

  7.   

    首先,可以用API函数将窗体至于最上方
    再在窗体的移动事件里监控位置
    详细请见 http://www.yecode.net/2010_04_17_107.html
      

  8.   

    每秒用API函数将自己的窗体至于最上方一次,以免被遮挡
      

  9.   

    我贴我的代码给你吧unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        HTrayWnd, HReBar, HBtnStar, ReplaceBtnHwnd, HNotifyWnd: HWND;
        TrayWndRct, ReBarTct, BtnStarTct, NotifyWndTct: TRect;
        procedure SetPosition;
        procedure GetTraySize;    procedure CreateButton;
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      BorderStyle := bsNone;
      HTrayWnd := FindWindow('Shell_TrayWnd', nil);
      HReBar := FindWindowEx(HTrayWnd, 0, 'ReBarWindow32', nil);
      HNotifyWnd := FindWindowEx(HTrayWnd, 0, 'TrayNotifyWnd', nil);
      if Win32MajorVersion < 6 then
      begin
        HBtnStar := FindWindowEx(HTrayWnd, 0, 'Button', nil);
      end
      else
      begin
        HBtnStar := FindWindow('Button', nil);
      end;
      CreateButton;
    end;procedure TForm1.GetTraySize;
    begin  try
        if (Windows.GetWindowRect(HReBar, ReBarTct) = false) or (Windows.GetWindowRect(HTrayWnd, TrayWndRct) = false)
          or (Windows.GetWindowRect(HBtnStar, BtnStarTct) = false)
          or (Windows.GetWindowRect(HNotifyWnd, NotifyWndTct) = false)
          then
        begin
          Application.MessageBox('错误,初始化获取数据失败,程序退出。', Pchar(Application.Title), MB_OK + MB_ICONERROR);
          Application.Terminate;
          Application.ShowMainForm := False;
        end;
      except
      end;
    end;procedure TForm1.SetPosition;
    var
      BisWidth: Boolean;
    begin
      try
        GetTraySize;
        if TrayWndRct.Right - TrayWndRct.Left > TrayWndRct.Bottom - TrayWndRct.Top then //判断人无论是横向还是纵向
          BisWidth := True
        else
          BisWidth := False;
        if BisWidth then
        begin
          MoveWindow(Self.Handle, BtnStarTct.Right + 5, (TrayWndRct.Bottom - TrayWndRct.Top - Self.Height) div 2, 75, 25, true);
          MoveWindow(HReBar, 75 + 5 + BtnStarTct.Right + 5, 0, NotifyWndTct.Left - 75 - 10 - BtnStarTct.Right, ReBarTct.Bottom - ReBarTct.Top, True)
        end
        else
        begin
          MoveWindow(Self.Handle, (TrayWndRct.Right - TrayWndRct.Left - Self.Width) div 2, BtnStarTct.Bottom + 3, 75, 25, true);
          MoveWindow(HReBar, 0, BtnStarTct.Bottom + 25 + 6, ReBarTct.Right - ReBarTct.Left, NotifyWndTct.Top - 6 - 25 - BtnStarTct.Bottom, True);
        end;
      except
      end;
    end;procedure TForm1.CreateButton;
    begin
      try
        Self.ParentWindow := HTrayWnd;
        Self.Visible := true;
        Self.Width := 75;
        Self.Height := 25;
        Self.Left := -100;
        Self.Caption := '';
        SetPosition;
      except
      end;
    end;
    end.
      

  10.   

    Form上放个timer,执行以下代码
    var
      Datestring: string;
    begin
      SetPosition;
      datestring := TimeToStr(Now);
      Canvas.TextOut(0, 0, datestring);
    end; SetPosition; 里面是调整位置的,你自己去调整吧另外,作为技术,你是否合格。这里是技术讨论而已,并不是代替帮你开发。就算这次行了,下一次呢?知识在自己手才是最珍贵的。我们做技术的,别人给出关键代码,剩下的地方自己去完善就好了。。我想问你,你连定时代码都不会写吗?
      

  11.   

     
    tiankun66不好意思,我忘记是你了。我重新发帖吧。说明是求代码帖。