冥界3大法王 发表于 2022-7-29 10:14

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

本帖最后由 冥界3大法王 于 2022-7-29 10:15 编辑


图中所示处如何干掉?







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.



第二部分:


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

好怀念FOXBASE

flyer_2001 发表于 2022-7-29 13:06

网上找的试试看

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
网上找的试试看

var


试过了,顶上的没了,下面的还有。{:301_971:}

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

这是起尸了么 :lol

flyer_2001 发表于 2022-7-30 00:40

冥界3大法王 发表于 2022-7-29 20:13
你的话咋改?

在创建窗口的地方加下试试看
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

或者在子窗口创建的地方做处理会更好些

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;
页: [1] 2
查看完整版本: 求教,Delphi关于创建mdi窗口程序