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
[43515] 스트링그리드 특정 Row 지우기 질문이요
사랑니 [shibuara] 1425 읽음    2006-02-02 10:55
안녕하세요 ^^ 많은 도움 부탁드립니다
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 1622 2006/02/02
43520         Re:Re:스트링그리드 특정 Row 지우기 질문이요 사랑니 2731 2006/02/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.