Q&A

  • stringGrid 에서 체크박스를 올리고 나서 스크롤바가 생기니까 이상해져요~~~~~~~
스트링 그리드에 체크박스를 올리는데 row카운트가 증가할때마다 자동생성으로 올렸습니다.

그런데 데이트가 화면에 보여지는 stringgrid 의 크기보다 커져서 수직 스크롤바가 생기니까 row(0) 인 타이틀에 체크박스가 올라가네요. 왜 이런지 좀 갈쳐 주세요?





1  COMMENTS
  • Profile
    홍성락 2001.10.19 06:00
    바이오맨(초보) wrote:

    > 스트링 그리드에 체크박스를 올리는데 row카운트가 증가할때마다 자동생성으로 올렸습니다.

    > 그런데 데이트가 화면에 보여지는 stringgrid 의 크기보다 커져서 수직 스크롤바가 생기니까 row(0) 인 타이틀에 체크박스가 올라가네요. 왜 이런지 좀 갈쳐 주세요?

    /////////////////////////////////////////////////////////////////////////

    화면에 안보이는 셀의 RECT값은 실제값이 아닙니다.

    전에 문의하신분 맞나요. 그때 소스를 이용하겠습니다.



    procedure TForm1.BitBtn1Click(Sender: TObject);

    var

    i : integer;

    Rect: TRect;

    begin

    SGstock.Cells[0,0] := '입고여부';

    SGstock.cells[1,0] := '바코드';

    SGstock.cells[2,0] := '부품상태';

    for i := 1 to 4 do

    begin

    sgstock.objects[2,i] := Tcombobox.create(sgstock); //////

    with Tcombobox(sgstock.objects[2,i]) do

    begin

    parent := SGstock; ////

    Rect:=SGstock.cellrect(2,i);

    if (Rect.Top<=0)then

    Visible := False;

    boundsrect := Rect;

    width := SGstock.colwidths[2]; //CBpart_state.//

    height := SGstock.rowheights[2];

    Style := csDropDownList;

    ClientHeight:=100;

    //=====================================================================

    items.add('');

    items.add(inttostr(i));

    items.add(inttostr(i+1));

    items.add(inttostr(i+2));

    end;

    end;

    end;



    procedure TForm1.SGstockDrawCell(Sender: TObject; ACol, ARow: Integer;

    Rect: TRect; State: TGridDrawState);

    begin

    SDrawCell;

    end;

    procedure TForm1.SDrawCell;

    var

    i : integer;

    Rect: TRect;

    begin

    for i := 1 to 4 do begin

    if sgstock.objects[2,i] <> nil then begin

    Rect:=SGstock.cellrect(2,i);

    //Tcombobox(sgstock.objects[2 ,i]).Visible := True;

    Tcombobox(sgstock.objects[2 ,i]).top := Rect.Top;

    Tcombobox(sgstock.objects[2 ,i]).Left := Rect.Left;

    Tcombobox(sgstock.objects[2 ,i]).BringToFront;

    if (Rect.Top<=0)then

    Tcombobox(sgstock.objects[2 ,i]).Visible := False

    else begin

    Tcombobox(sgstock.objects[2 ,i]).Visible := True;

    end;

    Tcombobox(sgstock.objects[2 ,i]).Refresh;

    end;

    end;

    end;