博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
模拟系统提示框
阅读量:7176 次
发布时间:2019-06-29

本文共 1261 字,大约阅读时间需要 4 分钟。

在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;

 

 

转载地址:http://emfzm.baihongyu.com/

你可能感兴趣的文章
linux 多硬盘 分区格式化自动挂载知识点
查看>>
phpMyAdmin中sql-parser组件的使用
查看>>
.NET文档处理套包GroupDocs.Total for .NET新版发布 | 附下载
查看>>
Excel 控件Spire.XLS 7.12.130发布 | 附下载
查看>>
shell - sed中如何替换出新行来
查看>>
Crontab
查看>>
聊聊我怎么系统学习Linux技能并快速提高的
查看>>
微软不会彻底杀死Edge浏览器
查看>>
CodeIgniter文件上传时提示The filetype you are attempting to upload is not allowed
查看>>
电脑经验--thinkpad电脑u盘启动
查看>>
【爱上大舞台 · 有梦一起来】之“我最红”全国选拔赛正式启动
查看>>
IOS 三种线程操作方式详解
查看>>
mybatis+spring boot +druid 在@MapperScan多数据源出现的坑,自挖自埋
查看>>
git基本操作
查看>>
Spring中文文档
查看>>
第一个hadoop程序-WordCount
查看>>
参考小程序-》正则表达式
查看>>
Jetty内嵌使用
查看>>
如何高效的阅读一篇学术论文
查看>>
Hive 数据倾斜总结
查看>>