加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何在Delphi中更改帮助弹出窗口的位置?

发布时间:2020-12-15 09:13:45 所属栏目:大数据 来源:网络整理
导读:我有下面的代码现在显示标准的 Windows帮助弹出窗口可用.有谁知道这个窗口出现的地方是否有定位方法?例如,要使其显示在用户点击的位置? function HelpPopupWindow(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;var dwIDs: array[0..3]
我有下面的代码现在显示标准的 Windows帮助弹出窗口可用.有谁知道这个窗口出现的地方是否有定位方法?例如,要使其显示在用户点击的位置?

function HelpPopupWindow(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;
var
  dwIDs: array[0..3] of DWord;
begin
  dwIDs[0] := Handle;
  dwIDs[1] := Data;
  dwIDs[2] := 0;
  dwIDs[3] := 0;

  HtmlHelp(Handle,PChar('HELP FILE LOCATION HERE::/cshelp.txt'),HH_TP_HELP_CONTEXTMENU,DWORD(@dwIDs[0]));

  CallHelp := False;
end;

干杯

保罗

解决方法

您应该使用 HH_DISPLAY_TEXT_POPUP来显示弹出帮助.通过您传递的 HH_POPUP结构,这为您提供了更大的灵活性.使用pt字段指定位置:

Specifies (in pixels) where the top center of the pop-up window should be located.

Helpware站点提供了一些Delphi代码示例:

{Show HH Popup using a string (StringID) from text file in a CHM
StringID: eg. 99; CHMTextFile: eg. _runDir + 'help.chm::/cshelp.txt'}
function HH_ShowPopupHelp3(aParent: TForm; StringID: Integer; 
  CHMTextFile: String; XYPos: TPoint): HWND;
var hhpopup: HH.THHPopup;
begin
  with hhpopup do
  begin
    cbStruct := sizeof(hhpopup); //sizeof this structure
    hinst := 0; //no used 
    idString := StringID; //topic number in a text file.
    pszText := nil; //no used
    pt := XYPos; //top center of popup
    clrForeground := COLORREF(-1); //use -1 for default - RGB value
    clrBackground := COLORREF(-1); //use -1 for default - RGB value
    rcMargins := Rect(-1,-1,-1);//amount of space between edges
    pszFont := ''; 
  end;
  Result := HtmlHelp(aParent.Handle,PChar(CHMTextFile),HH_DISPLAY_TEXT_POPUP,DWORD(@hhpopup));
end;

事实上,我认为你已经发现这个页面是根据你的代码来判断的,但只需要在页面下方进一步阅读.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读