Board index » delphi » Q: MDI form captionless,borderless resizable?

Q: MDI form captionless,borderless resizable?

how do i get rid of the top caption of a MDIchild form

i would like it to be preferrable
borderless
resizable
and minus the top caption

i can get 2 out of three using the various fs(formstyles)

but anytricks to accomplish all three?..

thankyou

hdashti

 

Re:Q: MDI form captionless,borderless resizable?


Quote
HDASHTI wrote:

> how do i get rid of the top caption of a MDIchild form

> i would like it to be preferrable
> borderless
> resizable
> and minus the top caption

> i can get 2 out of three using the various fs(formstyles)

> but anytricks to accomplish all three?..

> thankyou

> hdashti

How do you plan to let the user resize with no borders?

--
-----------------------------------------
Software Services - Making Windows Scream
http://www.invsn.com/softserv/
bry...@thevision.net
-----------------------------------------

Re:Q: MDI form captionless,borderless resizable?


On Fri, 07 Mar 1997 13:55:19 -0800, Bryan Valencia

Quote
<bry...@thevision.net> wrote:
>HDASHTI wrote:

>> how do i get rid of the top caption of a MDIchild form

>> i would like it to be preferrable
>> borderless
>> resizable
>> and minus the top caption

>> i can get 2 out of three using the various fs(formstyles)

>> but anytricks to accomplish all three?..

>> thankyou

>> hdashti

>How do you plan to let the user resize with no borders?

>--
>-----------------------------------------
>Software Services - Making Windows Scream
>http://www.invsn.com/softserv/
>bry...@thevision.net
>-----------------------------------------

ok how do i get rid of the caption on the top then with a border.

Re:Q: MDI form captionless,borderless resizable?


Quote
hdashti wrote:
> ok how do i get rid of the caption on the top then with a border.

Here's an excerpt from an article I wrote on the subject:
------------------------------------------------------
The second technique we'll demonstrate takes advantage of the
CreateParams method we describe in the article, "Displaying the Correct
Border Style for MDI Parent Windows." In that article, we apply the
WS_EX_CLIENTEDGE extended style to the Params.ExStyle parameter field.
To eliminate the caption from a form's window, you must make an
adjustment to the Params.Style parameter field, but it isn't an
intuitive change. As with many attribute adjustments using Windows API
functions, the different styles you can combine in the Params.Style
field interact in some surprising ways. To achieve the effect we want (a
captionless form), we need to modify the style in a deliberate manner.

The WS_POPUP style specifies a standard window that may or may not have
a caption and a border. In contrast, the WS_DLGFRAME style specifies
only
that the window have a caption.

Since the standard border styles typically provide some sort of border
(with the exception of bsNone), we can take the initial style settings
(which come from the BorderStyle property) and then modify them using
the other two styles. Combining the WS_POPUP style with the default form
style makes it possible for us to eliminate either the window border or
the caption.

Next, we'll apply the WS_DLGFRAME style in reverse. That is, we'll
invert this style and then apply it to the existing style.

Now let's create a captionless form using this technique. Create a new
blank-form project, and add the following CreateParams method
declaration to the private section of the form's class declaration:

procedure
CreateParams(var Params: TCreateParams);
  override;

Then, add the following method body to the implementation section of the
form's source file:

procedure
TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);

  Params.Style := Params.Style or
    WS_POPUP xor
    WS_DLGFRAME;
end;

Finally, create the following OnClick event handler for the form:

procedure TForm1.FormClick(Sender: TObject);
begin
  Close;
end;

You're now ready to build and run the application. When the form
appears, you'll notice that it doesn't have a caption, but it does have
the standard, resizeable border, as shown in Figure B. Click on the form
to exit, change the form's BorderStyle property to one of the other
styles, and then build and run the application again. This time, the
caption remains hidden, but the form's border will have the attributes
of the border style you just chose.
------------------------------------------------------

Hope this helps,

--
Tim Gooch
 Editor-in-chief,               Moderator,
 Delphi Developer's Journal     DDJ-THREAD Discussion List
 [ http://www.cobb.com/ddj ]    [ mailto:listp...@cobbtips.com ]
                                (subscribe ddj-thread <your_name>)

Other Threads