zoukankan      html  css  js  c++  java
  • 模拟系统提示框

    在FormCreate设置PersonSignLB的windows消息

    aHint :=THintWindow.Create(nil);
    aHint.Color :=clInfoBk;
    FWndMethod := PersonSignLB.WindowProc;
    PersonSignLB.WindowProc := LabelWndProc;

    显示个人提示框

    procedure TMainForm.LabelWndProc(var Msg: TMessage);

      //根据一定长度,将字符串变为回车的字符
      function SplitByLen(src:string;var row:Integer;perCount:Integer):string;
      var
        i,j:Integer;
        c:Char;
        sTemp,s1:string;
        bIsDBCS:Boolean;
      begin
        row :=Ceil(Length(src)/perCount);
        sTemp :='';
        bIsDBCS :=False;
        for I := 1 to row do
        begin
          for   j:= 1 to  perCount   do
          begin
            if bIsDBCS   then
              bIsDBCS   :=   False
            else
              if Windows.IsDBCSLeadByte(byte(src[j]))   then
                bIsDBCS   := True;
          end;

          if  bIsDBCS   then   Dec(perCount);
          if i=row then
            sTemp :=sTemp +Copy(src,1,perCount)
          else
            sTemp :=sTemp +Copy(src,1,perCount)+#10#13;
          src :=Copy(src,perCount+1,Length(src)-perCount);
        end;
        if bIsDBCS then
          Inc(perCount);
        Result :=sTemp;  
      end;

    var
      p,p1,p2: TPoint;
      iRow:Integer;
      s:string;
    begin
      GetCursorPos(p);
      p1 :=Point(p.x,p.y+20);

      if Msg.Msg = CM_MOUSELEAVE then
      begin
        ShowWindow(aHint.Handle, SW_HIDE);
      end
      else if Msg.Msg = CM_MOUSEENTER then
      begin
        s :=SplitByLen(FSingLB,iRow,36);
        //djc 2012-8-30 mod
        if iRow=1 then
          p2 :=Point(p.x+220,p.y+36)
        else
          p2 :=Point(p.x+220,p.y+26*iRow);
        aHint.ActivateHint(Rect(p1,p2),s);
      end;
      FWndMethod(Msg);
    end;

  • 相关阅读:
    c语言使用指针交换数值
    OD
    ADO Connection failure
    Javascript 日期 加减
    RAD C++Builder xe7 std::map xtree BUG
    c++ map
    c++ vector
    TDictionary 是delphi用的,c++builder用起来太吃力。
    datasnap 如何监控客户端的连接情况
    DataSnap高级技术(7)—TDSServerClass中Lifecycle生命周期三种属性说明
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2665173.html
Copyright © 2011-2022 走看看