Q&A

  • StringGrid에서 셀 위치 알아내는 법...
StringGrid에서 셀의 위치를 알아내서...

자료를 셀 위치에 있는 레코드만 삭제를 하려 합니다

StringGrid에서 셀 위치 찾는 법 알려주세요

1  COMMENTS
  • Profile
    최석기 1999.06.02 00:15
    김동수 께서 말씀하시기를...

    > StringGrid에서 셀의 위치를 알아내서...

    > 자료를 셀 위치에 있는 레코드만 삭제를 하려 합니다

    > StringGrid에서 셀 위치 찾는 법 알려주세요



    StringGrid에 OnDrawDataSell 이벤트에서 다음과 같은 코딩으로 해결 가능합니다.



    procedure TForm1.DrawGrid1DrawDataCell(Sender: TObject; const Rect: TRect;

    Field: TField; State: TGridDrawState);

    var

    RowHeight: Integer;

    begin

    if gdFocused in State then

    begin

    RowHeight := Rect.Bottom - Rect.Top;

    Row := (Rect.Top div RowHeight) - 1;

    Col := Field.Index;

    edit1.text := inttostr(row);

    edit2.text := inttostr(col);

    end;

    end;