C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[8411] Re:[질문] 폼 크기 제한하려면... (예쁘게...)
방태윤 [nabty] 1461 읽음    2001-06-22 13:01
책에있는 겁니다.
님께서는
Msg.MinMaxInfo->ptMinTrackSize.x=170; //ptMinTrackSize = min size allowed
Msg.MinMaxInfo->ptMinTrackSize.y=150; //by dragging with the mouse.
부분을 사용하시면 될것같은데...
마우스 고정은 안되지만 깔끔하지요..

//---------------------------------------------------------------------------
#ifndef MAINFORMH
#define MAINFORMH
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
  TLabel *Label1;
  void __fastcall FormResize(TObject *Sender);
private:    // User declarations
  void __fastcall WMGetMinMaxInfo(TWMGetMinMaxInfo &Msg);  // prototype for msg handler
public:        // User declarations
  __fastcall TForm1(TComponent* Owner);
BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_GETMINMAXINFO,TWMGetMinMaxInfo,WMGetMinMaxInfo)
END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "MAINFORM.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WMGetMinMaxInfo(TWMGetMinMaxInfo &Msg)
{
  Msg.MinMaxInfo->ptMaxSize.x=300; //ptMaxSize is the size of the window
  Msg.MinMaxInfo->ptMaxSize.y=250; //when the window is fully maximized

  // ptMaxPosition is the coordinate of the frame뭩 upper left
  // corner when it뭩 maximized.
  Msg.MinMaxInfo->ptMaxPosition.x=GetSystemMetrics(SM_CXSCREEN)-300;
  Msg.MinMaxInfo->ptMaxPosition.y=0;

  Msg.MinMaxInfo->ptMaxTrackSize.x=300; //ptMaxTrackSize = max size allowed
  Msg.MinMaxInfo->ptMaxTrackSize.y=250; //by dragging with the mouse

  Msg.MinMaxInfo->ptMinTrackSize.x=170; //ptMinTrackSize = min size allowed
  Msg.MinMaxInfo->ptMinTrackSize.y=150; //by dragging with the mouse.

}

void __fastcall TForm1::FormResize(TObject *Sender)
{

  Label1->Caption = "Width = "    + AnsiString(Width)  +
                    "  Height = " + AnsiString(Height);
}
//---------------------------------------------------------------------------
.끝.

샘이 님이 쓰신 글 :
: 만약 TMainForm 이라는 것이 있을 때...
: 폼크기의 최소크기가 320x200 일 때...
:
: TMainForm::FormResize(...)
: {
:   if (Width<320) Width=320;
:   if (Height<200) Height=200;
: }
:
: 위와 같이 하면 폼크기 최소값을 유지하지만
: 마우스가 폼크기 최소값보다 적은 위치에 갈 수 있게 됩니다.
: 따라서 폼크기가 작아졌다 커졌다하면서 최소값을 유지하게 되는데
: 최소값이 되었을 때는 마우스가 더이상 움직이지 않았으면 합니다.
: 어떻게 하면 되죠?

+ -

관련 글 리스트
8409 [질문] 폼 크기 제한하려면... (예쁘게...) 샘이 984 2001/06/22
8411     Re:[질문] 폼 크기 제한하려면... (예쁘게...) 방태윤 1461 2001/06/22
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.