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

C++빌더 팁&트릭
C++Builder Programming Tip&Tricks
[872] 모서리를 둥글게 처리한 TGroupBox
김태선 [cppbuilder] 8820 읽음    2009-03-17 16:54
빌더 2006 이상으로 가면 그룹박스의 모퉁이가 라운딩처리가 되어 있는 것을 흉내낸 것입니다.
빌더 6에서는 XP Style을 리소스에 적용해도 그룹박스 모양은 바뀌지 않는데,
이는 TGroupBox에서Theme를 써서 그리지 않기 때문에 적용이 되지 않는 것입니다.
빌더 6에서 기존 그룹박스 모양을 조금 다르게 주고 싶을 때 쓰면 됩니다.
Theme가 적용된 빌더  2006 이상과 완전히 똑같은 모양으로 만들 수도 있고 좀 더 이쁘게 만들 수도 있습니다.
Ctl3D 속성을 false로 하면 좀 더 비슷해지지요.

//---------------------------------------------------------------------------

#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include < Classes.hpp >
#include < Controls.hpp >
#include < StdCtrls.hpp >
#include < Forms.hpp >
#include < Buttons.hpp >
#include < ComCtrls.hpp >
#include < ExtCtrls.hpp >
#include < jpeg.hpp >
//---------------------------------------------------------------------------
class TGroupBox : public Stdctrls::TGroupBox
{
protected:
	void __fastcall  Paint()
	{
		int	  	H;
		TRect  	R;
		ULONG 	Flags;
		TRect	CaptionRect, OuterRect;
		TSize	Size;

		TCanvas *C = Canvas;
		C->Font = Font;
		H = C->TextHeight("0");
		R = Rect(0, H / 2 - 1, Width, Height);
		if (Ctl3D)
		{
			R.Left++;
			R.Top++;
			C->Brush->Color = clBtnHighlight;
			C->FrameRect(R);
			OffsetRect(R, -1, -1);
			C->Brush->Color = clBtnShadow;
		}
		else
			C->Brush->Color = clWindowFrame;
		//C->FrameRect(R);	//org
		C->Brush->Style = bsClear;
		C->Pen->Color = clBtnShadow;
		C->RoundRect(R.left, R.top, R.right, R.bottom, 5, 5);
		if (Text != "")
		{
			if (!UseRightToLeftAlignment())
				R = Rect(8, 0, 0, H);
			else
				R = Rect(R.Right - C->TextWidth(Text) - 8, 0, 0, H);
			Flags = DrawTextBiDiModeFlags(DT_SINGLELINE);
			DrawText(C->Handle, Text.c_str(), Text.Length(), (tagRECT *)&R, Flags | DT_CALCRECT);
			C->Brush->Color = Color;
			DrawText(C->Handle, Text.c_str(), Text.Length(), (tagRECT *)&R, Flags);
		}
	}
};
#define TGroupBox			::TGroupBox

class TFormMain : public TForm
{
__published:	// IDE-managed Components
	TBitBtn *BRun;
	TMemo *Memo1;
	TStatusBar *StatusBar1;
	TPanel *Panel1;
	TLabel *LFileCount;
	TLabel *LLine;
	TGroupBox *GroupBox1;
	TCheckBox *CBCPP;
	TCheckBox *CBCPPBak;
	TGroupBox *GroupBox2;
	TCheckBox *CBCutBlockRemark;
	TCheckBox *CBCutLineMark;
	TGroupBox *GroupBox3;
	TEdit *EditSrcDir;
	TLabel *Label1;
	TEdit *EditDesDir;
	TLabel *Label2;
	TButton *Button1;
	TButton *Button2;
	TSpeedButton *SpeedButton1;
	TShape *Shape1;
	TImage *Image1;
	TLabel *Label3;
	TLabel *Label5;
	TLabel *Label4;
	TGroupBox *GroupBox4;
	TShape *Shape2;
	TLabel *Label6;
	void __fastcall BRunClick(TObject *Sender);
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall FormDestroy(TObject *Sender);
	void __fastcall SpeedButton1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TFormMain(TComponent* Owner);

public:		// User declarations
	int		GetFileList(String path, TStringList *list, TOption op);
	void	Print(String s);
	bool	DoConvert(String SrcDir, String DesDir, TOption op);
	void	MakeTOption(TOption &op);
	bool	ConvertSrc(String SrcDir, String DesDir, String filename, TOption op);
	bool	ConvertLine(char *out, char *in, TOption op);


};
//---------------------------------------------------------------------------
extern PACKAGE TFormMain *FormMain;
//---------------------------------------------------------------------------
#endif

+ -

관련 글 리스트
872 모서리를 둥글게 처리한 TGroupBox 김태선 8820 2009/03/17
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.