喫茶XRAYトップページ


[5681] 今更StringGrid返信 削除
2012/1/26 (木) 18:35:15 Syake
何気なくふと気づいたのですが
ないげないコード

procedure TForm1.FormCreate(Sender: TObject);
begin
  with Self do
  begin
    ClientHeight := 253;
    ClientWidth := 458;
    Self.Position := poOwnerFormCenter;
  end;
  with StringGrid1 do
  begin
    DefaultDrawing := False;
    Align := alClient;
    ColCount := 7;
    RowCount := 10;
    FixedCols := 0;
    FixedRows := 0;
    DefaultRowHeight := 24;
    DefaultColWidth := 64;
  end;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject;
    ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  BRect :TRect;
begin
  with (Sender as TStringGrid) do
  begin
    with Canvas do
    begin
      Pen.Color := clBlack;
      Pen.Width := 1;
      if ACol = 0 then
      begin
        Rect := CellRect(0,0);
        Rect.Top := CellRect(0,0).Top;
        Rect.Bottom := CellRect(0,RowCount-1).Bottom;
        FillRect(Rect);
        Rectangle(Rect.Left-1,Rect.Top-1,Rect.Right+1,Rect.Bottom+1);
      end else begin
        MoveTo(Rect.Left-1,Rect.Top);
        LineTo(Rect.Left-1,Rect.Bottom);
        MoveTo(Rect.Left,Rect.Bottom);
        LineTo(Rect.Right,Rect.Bottom);
        MoveTo(Rect.Right,Rect.Bottom);
        LineTo(Rect.Right,Rect.Top);
      end;
    end;
  end;
end;

左画像)まあ普通に罫線黒で表示されますね。
中画像)モニタ枠からはみ出すように右に隠し(左でも同じですが)
    じわっと、フォームを引き戻します。
右画像)モニタ枠からはみ出すように画面下側に隠します。
    同じくじわっと画面下側から引上げます。

早く引き戻したらダメですよ。
ほら罫線消えたでしょ!?

・・・う〜む。

[5682] Re:今更StringGrid返信 削除
2012/1/26 (木) 20:24:20 Mr.XRAY
▼ Syakeさん

> 早く引き戻したらダメですよ。
> ほら罫線消えたでしょ!?


ハハハッ.ヌヌッ,微妙.そういうことをやってはいけません!!

> ・・・う〜む。

同じくう〜む.


INCM/CMT
Cyclamen v3.82