faq11.htm

来自「C++builder学习资料C++builder」· HTM 代码 · 共 55 行

HTM
55
字号


<HTML>

<HEAD>

   <TITLE>Create a form with a client edge</TITLE>

   <META NAME="Author" CONTENT="Harold Howe">

</HEAD>

<BODY BGCOLOR="WHITE">



<CENTER>

<TABLE  BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="640">



<TR>

<TD>







<H3>

Create a form with a client edge

</H3>

<BR>

<P>

You can create a form with a client edge overriding the

<TT>CreateParams</TT> function and adding the <TT>WS_EX_CLIENTEDGE</TT>

style to <TT>Params.ExStyle</TT>.

</P>

<P>

<B>Step 1:</B> Add the <TT>CreateParams</TT> prototype to the form class.</P>

<pre>

    <b>private</b><b>:</b>

        <b>void</b> <b>__fastcall</b> CreateParams<b>(</b>TCreateParams <b>&</b>Params<b>)</b><b>;</b>

</pre>

<P>

<B>Step 2:</B> Code the function.

</P>

<pre>

    <b>void</b> <b>__fastcall</b> TForm1<b>:</b><b>:</b>CreateParams<b>(</b>TCreateParams <b>&</b>Params<b>)</b>

    <b>{</b>

        TForm<b>:</b><b>:</b>CreateParams<b>(</b>Params<b>)</b><b>;</b>         <font color="navy">// call base class first</font>

        Params<b>.</b>ExStyle <b>|=</b> WS_EX_CLIENTEDGE<b>;</b>  <font color="navy">// then add the style</font>

    <b>}</b>

</pre>

<P>

If you would rather not bother with <TT>CreateParams</TT>, you can achieve identical results

by placing a panel on your form. Set the <TT>Aligment</TT> property of the panel to <TT>alClient</TT>,

set both <TT>BevelInner</TT> and <TT>BevelOuter</TT> to <TT>bvNone</TT>, and set the panel's

<TT>BorderStyle</TT> property to <TT>bsSingle</TT>.

</P>               



</TD> </TR>



</TABLE>

</CENTER>

</BODY>

</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?