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;

  • 相关阅读:
    js获取数组中的值显示[object HTMLInputElement]
    IntelliJ Idea 常用快捷键
    MySQL查询本周、上周、本月、上个月份数据的sql代码
    表的基本
    字符串类型
    备份数据库
    增加标 和增加其内容
    数据库的基本
    jq做的简单的变色表格
    jq做的简单的轮播
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2665173.html
Copyright © 2011-2022 走看看