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
[43517] Re:스트링그리드 특정 Row 지우기 질문이요
smleelms [smleelms] 1621 읽음    2006-02-02 13:35
음.. Insert 함수에서는 Row를 늘이시고 Row의 내용들을 한줄씩 밑으로 내리신 후에 해당 Row를 clear시키셨는데, delete 함수에서는 그냥 RowCount를 하나 줄이셨네요. 따라서 제일 아래의 Row내용이 삭제가 되겠지요..

따라서 Insert함수처럼 해당 Row를 Clear 시키신 후에 아래 Row의 내용들을 한줄씩 올리신 후에, RowCount를 하나 줄이시는게 맞겠지요.

그럼, 좋은 결과 있으시기를...

사랑니 님이 쓰신 글 :
: 안녕하세요 ^^ 많은 도움 부탁드립니다
: AfterIndex 를 인자로 Row를 추가 삭제하는 함수입니다.
: Row추가 함수는 특정 Row에 추가되는것이 확인되었는데 Row삭제 함수는
: 무조건 제일 밑에있는 Row가 삭제되네요...
: 원인이 무엇일까요?
: 고수님들에 조언 부탁드릴께요 ^^
: 그럼 즐거운하루 되세요~~
: // Row추가함수
:  void __fastcall TForm1::InsertRow(TStringGrid *StringGrid, long AfterIndex)
:  {
:      SNDMSG(StringGrid->Handle, WM_SETREDRAW, false, 0);
:      try
:      {
:          int row_count = StringGrid->RowCount;
:          StringGrid->RowCount = row_count + 1;
:
:          for (int row = row_count; row > AfterIndex + 1; row--)
:              StringGrid->Rows[row] = StringGrid->Rows[row - 1];
:
:          StringGrid->Rows[AfterIndex +1]->Clear();
:      }
:      catch (...)
:      {
:          SNDMSG(StringGrid->Handle, WM_SETREDRAW, true, 0);
:          throw;
:      }
:      SNDMSG(StringGrid->Handle, WM_SETREDRAW, true, 0);
:
:      RECT R = StringGrid->CellRect(0, AfterIndex);
:      InflateRect(&R, StringGrid->Width, StringGrid->Height);
:      InvalidateRect(StringGrid->Handle, &R, false);
:     
:  }
: //Row 삭제함수 <--요놈이 안되는놈입니다
:  void __fastcall TForm1::DeleteRow(TStringGrid *StringGrid, long AfterIndex)
:  {
:      SNDMSG(StringGrid->Handle,WM_SETREDRAW,false,0);
:      try
:      {
:           int row_count = StringGrid->RowCount ;
:           StringGrid->RowCount = row_count - 1;
:      }
:      catch(...)
:      {
:           SNDMSG(StringGrid->Handle,WM_SETREDRAW,true,0);
:           throw;
:      }
:      SNDMSG(StringGrid->Handle,WM_SETREDRAW,true,0);
:      RECT R = StringGrid->CellRect(-1,AfterIndex);
:      InflateRect(&R,StringGrid->Width*-1,StringGrid->Height*-1 );
:      InvalidateRect(StringGrid->Handle ,&R,false);
:  }

+ -

관련 글 리스트
43515 스트링그리드 특정 Row 지우기 질문이요 사랑니 1425 2006/02/02
43517     Re:스트링그리드 특정 Row 지우기 질문이요 smleelms 1621 2006/02/02
43520         Re:Re:스트링그리드 특정 Row 지우기 질문이요 사랑니 2731 2006/02/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.