|
님과 제 빌더가 다른것 같은데요.수정해서라도 쓰신다면 아래와 같이 해보십시요.
아마 대부분 의견이 권장할만한 방법은 아닐겁니다...
builder\include\vcl\StdCtrls.hpp 에서 아래 내용을 찾아보십시요.
보면 제것의 경우에는
__property Types::TPoint CaretPos = {read=GetCaretPos, write=SetCaretPos}; 가
public: 밑에 있습니다.
아마 님은 CaretPos 가 다른곳에 있을겁니다.
제것처럼 자리만 옮기고 저장해서 해보십시요.
아래는 제것에서 복사한것이니 참고 하시고요...
저는 6.0 이거든요.이렇게 해서 되면 다행이고요...-.-
class DELPHICLASS TCustomMemo;
class PASCALIMPLEMENTATION TCustomMemo : public TCustomEdit
{
typedef TCustomEdit inherited;
private:
Classes::TStrings* FLines;
Classes::TAlignment FAlignment;
TScrollStyle FScrollBars;
bool FWordWrap;
bool FWantReturns;
bool FWantTabs;
MESSAGE void __fastcall WMGetDlgCode(Messages::TWMNoParams &Message);
HIDESBASE MESSAGE void __fastcall WMNCDestroy(Messages::TWMNoParams &Message);
protected:
virtual Types::TPoint __fastcall GetCaretPos();
virtual void __fastcall SetCaretPos(const Types::TPoint &Value);
virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
virtual void __fastcall CreateWindowHandle(const Controls::TCreateParams &Params);
DYNAMIC void __fastcall KeyPress(char &Key);
virtual void __fastcall Loaded(void);
void __fastcall SetAlignment(Classes::TAlignment Value);
void __fastcall SetLines(Classes::TStrings* Value);
void __fastcall SetScrollBars(TScrollStyle Value);
void __fastcall SetWordWrap(bool Value);
__property Classes::TAlignment Alignment = {read=FAlignment, write=SetAlignment, default=0};
__property TScrollStyle ScrollBars = {read=FScrollBars, write=SetScrollBars, default=0};
__property bool WantReturns = {read=FWantReturns, write=FWantReturns, default=1};
__property bool WantTabs = {read=FWantTabs, write=FWantTabs, default=0};
__property bool WordWrap = {read=FWordWrap, write=SetWordWrap, default=1};
public:
__fastcall virtual TCustomMemo(Classes::TComponent* AOwner);
__fastcall virtual ~TCustomMemo(void);
DYNAMIC Classes::TAlignment __fastcall GetControlsAlignment(void);
__property Types::TPoint CaretPos = {read=GetCaretPos, write=SetCaretPos};
__property Classes::TStrings* Lines = {read=FLines, write=SetLines};
public:
#pragma option push -w-inl
/* TWinControl.CreateParented */ inline __fastcall TCustomMemo(HWND ParentWindow) : TCustomEdit(ParentWindow) { }
#pragma option pop
};
초보 님이 쓰신 글 :
: r->CaretPos=TPoint(0,y); 에서
: [C++ Error] Cess.cpp(73): E2247 'TCustomMemo::CaretPos' is not accessible
: 저만 그런가여?
:
: 방태윤 님이 쓰신 글 :
: : 초보 님이 쓰신 글 :
: : :
: : : r->CaretPos=TPoint(0,y); 에서 에러가 나네여..
: : :
: : : 방태윤 님이 쓰신 글 :
: : : : 이걸로 해 보세요..
: : : : void change_line_color(TRichEdit*r,int y,TColor c) // y=0 이 첫줄
: : : : {
: : : : if(y>r->Lines->Count-1)return;
: : : : r->CaretPos=TPoint(0,y);
: : : : r->SelLength=r->Lines->Strings[y].Length();
: : : : r->SelAttributes->Color=c;
: : : : }
: : : :
: : : :
: : : :
: : : : 초보 님이 쓰신 글 :
: : : : : RichEdit에서 라인의 위치를 찾아 그부분만 폰트 색깔 변하게 하는 방법중에서
: : : : : 어떤 분의 답변 중에 하나를 그대로 사용해 보았습니다..
: : : : : 그런데..
: : : : : void ChageColor(...)
: : : : : {
: : : : : ....
: : : : : char* s = (char*)malloc(sizeof(BYTE) *100);
: : : : : Form1->RichEdit->Lines->Add(" --------------------");
: : : : : Form1->RichEdit->SelAttributes->Color = clGreen;
: : : : : wsprintf(s," 제목...Software");
: : : : : //Form1->RichEdit->Lines->Add(s); // 1.
: : : : : Form1->RichEdit->Lines->Strings[Line] = s; // 2
: : : : :
: : : : : Form1->RichEdit->SelAttributes->Color = clBlack;
: : : : : Form1->RichEdit->Lines->Add(" --------------------");
: : : : : Line = Line + 4;
: : : : : free(s);
: : : : : ...
: : : : : }
: : : : :
: : : : : 위와 같이 1과 같이 하면 잘동작하는데..2와 같이 하면 처음 동작시 한번만 글자가 푸른색으로 나타나고
: : : : : 다음부터는 아예 글자가 생략되는군여,,
: : : : : 왜 저런 현상이 발생하죠?
: : : : : 결과)
: : : : : --------------------
: : : : : 제목...Software --> 푸른색
: : : : : --------------------
: : : : : --------------------
: : : : : --------------------
: : : : : --------------------
: : : : : --------------------
: : : : : --------------------
: : : : : --------------------
: : : : :
: : : : : 위 예제는 그냥 만들어 본거지만 원래는 Line의 위치를 위 함수를 호출할때 넘겨줍니다.
: : : : :
|