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;

  • 相关阅读:
    DOM中元素节点、属性节点、文本节点的理解
    vue3+ts +vant 从0搭建移动端架子
    (转)一位软件工程师的6年总结
    tabcontrol的alignment属性设置成Right时,tabPage的text内容不能显示的问题<转>
    已知两点,画过两点的直线
    索引器
    SQL中 非 简体中文排序出现乱码的问题
    group by 列 聚合函数 where having
    SQL存储过程及事务
    使用C#创建Windows服务
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2665173.html
Copyright © 2011-2022 走看看