吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 795|回复: 11
收起左侧

[求助] 求教,Delphi关于创建mdi窗口程序

[复制链接]
冥界3大法王 发表于 2022-7-29 10:14
本帖最后由 冥界3大法王 于 2022-7-29 10:15 编辑

image.png
图中所示处如何干掉?






[Delphi] 纯文本查看 复制代码
unit MAIN;

interface

uses
  Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics, Vcl.Forms,
  Vcl.Controls, Vcl.Menus, Vcl.StdCtrls, Vcl.Dialogs, Vcl.Buttons,
  Winapi.Messages, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.StdActns, Vcl.ActnList,
  Vcl.ToolWin, Vcl.ImgList, System.ImageList, System.Actions, sPageControl,
  sSkinProvider, acTitleBar, sSkinManager, acImage, sLabel, sSpeedButton, sPanel,
  acPageScroller, acAlphaImageList, sStatusBar, RichViewActions,
  RVReportShapeAction;

type
  TMainForm = class(TForm)
    OpenDialog: TOpenDialog;
    ActionList1: TActionList;
    EditCut1: TEditCut;
    EditCopy1: TEditCopy;
    EditPaste1: TEditPaste;
    FileNew1: TAction;
    FileSave1: TAction;
    FileExit1: TAction;
    FileOpen1: TAction;
    FileSaveAs1: TAction;
    WindowCascade1: TWindowCascade;
    WindowTileHorizontal1: TWindowTileHorizontal;
    WindowArrangeAll1: TWindowArrange;
    WindowMinimizeAll1: TWindowMinimizeAll;
    HelpAbout1: TAction;
    FileClose1: TWindowClose;
    WindowTileVertical1: TWindowTileVertical;
    ImageList1: TImageList;
    sSkinManager1: TsSkinManager;
    CharImageList32: TsCharImageList;
    CharImageList16: TsCharImageList;
    ImageList32: TsAlphaImageList;
    sPageControl1: TsPageControl;
    sTabSheet2: TsTabSheet;
    sPageScroller1: TsPageScroller;
    PanelToolButtons: TsPanel;
    sSpeedButton9: TsSpeedButton;
    sSpeedButton8: TsSpeedButton;
    sSpeedButton2: TsSpeedButton;
    sSpeedButton1: TsSpeedButton;
    sSpeedButton5: TsSpeedButton;
    sSpeedButton4: TsSpeedButton;
    sSpeedButton3: TsSpeedButton;
    sSpeedButton6: TsSpeedButton;
    sSpeedButton7: TsSpeedButton;
    sSpeedButton10: TsSpeedButton;
    sPanel6: TsPanel;
    sPanel8: TsPanel;
    sWebLabel3: TsWebLabel;
    sStickyLabel1: TsStickyLabel;
    sStickyLabel2: TsStickyLabel;
    sWebLabel4: TsWebLabel;
    sWebLabel5: TsWebLabel;
    sStickyLabel3: TsStickyLabel;
    sStickyLabel4: TsStickyLabel;
    sWebLabel6: TsWebLabel;
    sTabSheet3: TsTabSheet;
    sImage1: TsImage;
    sStickyLabel12: TsStickyLabel;
    sWebLabel9: TsWebLabel;
    sWebLabel10: TsWebLabel;
    sStickyLabel9: TsStickyLabel;
    sStickyLabel10: TsStickyLabel;
    sWebLabel11: TsWebLabel;
    sStickyLabel11: TsStickyLabel;
    sWebLabel12: TsWebLabel;
    sTabSheet4: TsTabSheet;
    sTabSheet1: TsTabSheet;
    sTabSheet5: TsTabSheet;
    sTabSheet6: TsTabSheet;
    sTabSheet7: TsTabSheet;
    sTabSheet8: TsTabSheet;
    sTabSheet9: TsTabSheet;
    sTabSheet10: TsTabSheet;
    sPageScroller2: TsPageScroller;
    sPanel1: TsPanel;
    sSpeedButton11: TsSpeedButton;
    sSpeedButton12: TsSpeedButton;
    sSpeedButton14: TsSpeedButton;
    sSpeedButton15: TsSpeedButton;
    sSpeedButton16: TsSpeedButton;
    sSpeedButton17: TsSpeedButton;
    sSpeedButton18: TsSpeedButton;
    sSpeedButton19: TsSpeedButton;
    sSpeedButton20: TsSpeedButton;
    sPanel2: TsPanel;
    sPanel3: TsPanel;
    sWebLabel1: TsWebLabel;
    sStickyLabel5: TsStickyLabel;
    sStickyLabel6: TsStickyLabel;
    sWebLabel2: TsWebLabel;
    sWebLabel7: TsWebLabel;
    sStickyLabel7: TsStickyLabel;
    sStickyLabel8: TsStickyLabel;
    sWebLabel8: TsWebLabel;
    RVEInsertrvActionInsertFile1: TrvActionInsertFile;
    RVEInsertrvActionInsertPicture1: TrvActionInsertPicture;
    RVEInsertrvActionInsertHLine1: TrvActionInsertHLine;
    RVEMiscellaneousrvActionInsertCaption1: TrvActionInsertCaption;
    RVEInsertrvActionInsertHyperlink1: TrvActionInsertHyperlink;
    RVEInsertrvActionBookmarks1: TrvActionBookmarks;
    RVEInsertrvActionInsertSymbol1: TrvActionInsertSymbol;
    rvActionInsertText1: TrvActionInsertText;
    RVEInsertrvrActionInsertShape1: TrvrActionInsertShape;
    RVETextrvActionFonts1: TrvActionFonts;
    RVETextrvActionFontBold1: TrvActionFontBold;
    RVETextrvActionFontItalic1: TrvActionFontItalic;
    RVETextrvActionFontUnderline1: TrvActionFontUnderline;
    RVETextrvActionFontStrikeout1: TrvActionFontStrikeout;
    RVETextrvActionFontGrowOnePoint1: TrvActionFontGrowOnePoint;
    RVETextrvActionFontShrinkOnePoint1: TrvActionFontShrinkOnePoint;
    RVETextrvActionFontColor1: TrvActionFontColor;
    RVETextrvActionFontBackColor1: TrvActionFontBackColor;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    FileNewItem: TMenuItem;
    FileOpenItem: TMenuItem;
    FileCloseItem: TMenuItem;
    FileSaveItem: TMenuItem;
    FileSaveAsItem: TMenuItem;
    N1: TMenuItem;
    FileExitItem: TMenuItem;
    Edit1: TMenuItem;
    CutItem: TMenuItem;
    CopyItem: TMenuItem;
    PasteItem: TMenuItem;
    Window1: TMenuItem;
    WindowCascadeItem: TMenuItem;
    WindowTileItem: TMenuItem;
    WindowTileItem2: TMenuItem;
    WindowMinimizeItem: TMenuItem;
    WindowArrangeItem: TMenuItem;
    Help1: TMenuItem;
    HelpAboutItem: TMenuItem;
    procedure FileNew1Execute(Sender: TObject);
    procedure FileOpen1Execute(Sender: TObject);
    procedure HelpAbout1Execute(Sender: TObject);
    procedure FileExit1Execute(Sender: TObject);
    procedure sSpeedButton2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure CreateMDIChild(const Name: string);
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

uses
  CHILDWIN, About;

procedure TMainForm.CreateMDIChild(const Name: string);
var
  Child: TMDIChild;
begin
  { create a new MDI child window }
  Child := TMDIChild.Create(Application);
  Child.Caption := Name;
  if FileExists(Name) then
  begin
    Child.RichViewEdit1.LoadRVF(Name);
  end;
//Child.RichViewEdit1.Lines.LoadFromFile(Name);
end;

procedure TMainForm.FileNew1Execute(Sender: TObject);
begin
  CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
end;

procedure TMainForm.FileOpen1Execute(Sender: TObject);
begin
  if OpenDialog.Execute then
    CreateMDIChild(OpenDialog.FileName);
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
 
end;

procedure TMainForm.HelpAbout1Execute(Sender: TObject);
begin
  AboutBox.ShowModal;
end;

procedure TMainForm.sSpeedButton2Click(Sender: TObject);
begin
  sSkinManager1.SkinName := sSkinManager1.GetRandomSkin;
  sSkinManager1.Active := True;
end;

procedure TMainForm.FileExit1Execute(Sender: TObject);
begin
  Close;
end;

end.



第二部分:

[Delphi] 纯文本查看 复制代码
unit CHILDWIN;

interface

uses Winapi.Windows, System.Classes, Vcl.Graphics, Vcl.Forms, Vcl.Controls,
  Vcl.StdCtrls, RVScroll, RichView, RVEdit, Vcl.ComCtrls, sRichEdit, RVStyle,
  Vcl.ExtCtrls, sPanel;

type
  TMDIChild = class(TForm)
    RVStyle1: TRVStyle;
    Main_Panel: TsPanel;
    Left_Panel: TsPanel;
    RichViewEdit1: TRichViewEdit;
    LeftTop_Panel: TsPanel;
    Left_Bottom_Panel: TsPanel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

{$R *.dfm}

procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

end.

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lml0126 发表于 2022-7-29 11:20
好怀念delphi
xingyuwan 发表于 2022-7-29 11:41
flyer_2001 发表于 2022-7-29 13:06
网上找的试试看
[Delphi] 纯文本查看 复制代码
var
   GWL_Result: Integer;
begin
  GWL_Result:= GetWindowLong(Handle,GWL_STYLE);
  if GWL_Result>0 then
  begin
      SetWindowLong(Handle, GWL_STYLE, GWL_Result and not WS_MINIMIZEBOX and not WS_MAXIMIZEBOX);
  end;
end;
 楼主| 冥界3大法王 发表于 2022-7-29 13:43
flyer_2001 发表于 2022-7-29 13:06
网上找的试试看
[mw_shl_code=delphi,true]
var

试过了,顶上的没了,下面的还有。
flyer_2001 发表于 2022-7-29 14:11
冥界3大法王 发表于 2022-7-29 13:43
试过了,顶上的没了,下面的还有。

放在TMDIChild里的吗?
 楼主| 冥界3大法王 发表于 2022-7-29 20:13
flyer_2001 发表于 2022-7-29 14:11
放在TMDIChild里的吗?

你的话咋改?
skypaladin 发表于 2022-7-29 20:53
这是起尸了么
flyer_2001 发表于 2022-7-30 00:40

在创建窗口的地方加下试试看
[Delphi] 纯文本查看 复制代码
procedure TMainForm.CreateMDIChild(const Name: string);
var
  Child: TMDIChild;
  GWL_Result: Integer;
begin
  { create a new MDI child window }
  Child := TMDIChild.Create(Application);
  Child.Caption := Name;

  GWL_Result:= GetWindowLong(Child.Handle, GWL_STYLE);
  if GWL_Result>0 then
  begin
    SetWindowLong(Child.Handle, GWL_STYLE, GWL_Result and not WS_MINIMIZEBOX and not WS_MAXIMIZEBOX);
  end;

  if FileExists(Name) then
  begin
    Child.RichViewEdit1.LoadRVF(Name);
  end;
//Child.RichViewEdit1.Lines.LoadFromFile(Name);
end;
flyer_2001 发表于 2022-7-30 01:04
或者在子窗口创建的地方做处理会更好些
[Delphi] 纯文本查看 复制代码
procedure TChild.FormCreate(Sender: TObject);
var
   GWL_Result: Integer;
begin
  if Handle <> null then
  begin
      GWL_Result:= GetWindowLong(Handle, GWL_STYLE);
      if GWL_Result>0 then
      begin
          SetWindowLong(Handle, GWL_STYLE, GWL_Result and not WS_MINIMIZEBOX and not WS_MAXIMIZEBOX);
      end;
  end;
end;
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 10:26

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表