How to control/remove borders of embedded chm help file in delphi windows/vcl application?

ぐ巨炮叔叔 提交于 2019-12-12 04:57:07

问题


I've got a Delphi Windows/VCL (XE7) program that embeds CHM help pages in various panels of the program. This largely works fine but the panels always shows an ugly recessed border (looks very windows 95). Here is a screenshot:

Does anyone know how to display the help files with no border? Below is the code I use at the moment. Thanks for any help!

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;

来源:https://stackoverflow.com/questions/28115493/how-to-control-remove-borders-of-embedded-chm-help-file-in-delphi-windows-vcl-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!