如何在delphi windows / vcl应用程序中控制/删除嵌入式chm帮助文件的边框?

时间:2015-01-23 17:32:38

标签: windows delphi vcl chm

我有一个Delphi Windows / VCL(XE7)程序,它在程序的各个面板中嵌入了CHM帮助页面。这在很大程度上工作正常,但面板总是显示一个丑陋的凹陷边框(看起来非常窗口95)。这是一个截图:

enter image description here

有谁知道如何显示没有边框的帮助文件?以下是我目前使用的代码。谢谢你的帮助!

Procedure DoShowEmbeddedHelp(TheWinName: string; ThePanel: TPanel;
  var HelpWinHandle: integer; HelpTopic: string; var LastTopic: string;
  ByContext: boolean; ContextData: integer; var LastContext: integer);

var
  wintypedef: THHWinType;
  hf, fn: string;
begin
  hf := Gl.ProgramPath + 'leap.chm';
  if not FileExists(hf) then
    MessageDlg('Help file not found: ' + hf, mtError, [mbOK], 0)
  else if ((not ByContext) and (HelpTopic <> LastTopic)) or
    (ByContext and (ContextData <> LastContext)) then
   begin
     if not ByContext then
       begin
         LastTopic := HelpTopic;
         LastContext := 0;
       end
      else
        begin
          LastContext := ContextData;
          LastTopic := '';
        end;
      fn := hf + '>' + TheWinName;
      FillChar(wintypedef, sizeof(wintypedef), 0);

      with wintypedef do
        begin
          cbStruct := sizeof(wintypedef);      
          fUniCodeStrings := false;        
          pszType := PAnsiChar(TheWinName); 
          fsValidMembers := 
            HHWIN_PARAM_PROPERTIES or 
            HHWIN_PARAM_STYLES or 
            HHWIN_PARAM_EXSTYLES or 
            HHWIN_PARAM_RECT or 
            HHWIN_PARAM_NAV_WIDTH or 
            HHWIN_PARAM_SHOWSTATE or 
            HHWIN_PARAM_TB_FLAGS or 
            HHWIN_PARAM_EXPANSION; 

          fsWinProperties :=
            HHWIN_PROP_NOTITLEBAR or 
            HHWIN_PROP_NO_TOOLBAR or HHWIN_PROP_NODEF_STYLES or
            HHWIN_PROP_NODEF_EXSTYLES or
            HHWIN_PROP_TRI_PANE; 

      wintypedef.pszCaption := ''; 
      wintypedef.dwStyles := WS_VISIBLE or WS_CHILDWINDOW;
      wintypedef.dwExStyles := WS_EX_LEFT; 
      wintypedef.rcWindowPos := Rect(0, 0, ThePanel.ClientWidth, ThePanel.ClientHeight);
      wintypedef.nShowState := SW_SHOW; 
      wintypedef.fsToolBarFlags := HHWIN_BUTTON_PRINT or HHWIN_BUTTON_BACK;
      fNotExpanded := true;
    end;

  if integer(HtmlHelp(0, nil, HH_SET_WIN_TYPE, DWORD(@wintypedef))) < 0 then
    ShowMessage('Help failed on topic: ' + HelpTopic)
  else if ByContext then
    HelpWinHandle := HtmlHelp(ThePanel.Handle, PChar(fn), HH_HELP_CONTEXT, ContextData)
  else
    HelpWinHandle := HtmlHelp(ThePanel.Handle, PChar(fn), HH_DISPLAY_TOPIC, DWORD(PChar('Expressions\' + HelpTopic + '.htm')));
    end;
 end;

0 个答案:

没有答案