Article View: borland.public.cppbuilder.nativeapi
Article #14513Re: How to resize a control when run-time
From: bcb
Date: Sat, 09 Aug 2003 18:50
Date: Sat, 09 Aug 2003 18:50
49 lines
2193 bytes
2193 bytes
Hi.
My http connection doesn't work at the moment but this tip was taken from:
Quick and easy re-sizeable controls
by Damon Chandler
This doesn't work will all controls, e.g. the TRichEdit so place the control
on a panel and set Align to alClient and the Panel's AutoSize to true(or
false, don't remember so try both). But you can try the code with a TMemo.
// grab a handle to the panel
HWND hPanel = Panel1->Handle;
// get the current styles
LONG current_style = GetWindowLong(hPanel, GWL_STYLE);
// add the WS_SIZEBOX style
SetWindowLong(
hPanel, GWL_STYLE,
current_style | WS_SIZEBOX
);
// remove the WS_SIZEBOX style
// SetWindowLong( hPanel, GWL_STYLE, current_style & ~WS_SIZEBOX );
// have the panel redraw its border
SetWindowPos(
hPanel, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOMOVE |
SWP_NOSIZE | SWP_NOZORDER
);
Just search Google to find the link to the full article.
"Sky" <huangc@motic.com.cn> wrote in message
news:3f345db9@newsgroups.borland.com...
> Hi all,
>
> As everybody know we can change the postion and size when design-time,
> but how to do it when run-time, I know how to move a control, use drag and
> dock,
> but how to resize it? TIA
>
> Sky
>
>
Technical Details
Message-ID:
<3f35430d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f345db9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,61501f292d40a59 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-09 11:57:12 PST From: "bcb" <noemail@sorry.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f345db9@newsgroups.borland.com> Subject: Re: How to resize a control when run-time Date: Sat, 9 Aug 2003 14:50:26 -0400 Lines: 51 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 172.167.229.77 Message-ID: <3f35430d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060455181 172.167.229.77 (9 Aug 2003 11:53:01 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail