Autor Beitrag
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 24.10.02 14:47 
... unterstützt. Und am besten auch rangeselect für rightclick

Danke
Ken
CenBells Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 24.10.02 17:01 
also, ich habe es selber erledigt.

ihr müsst folgende Variable
FSelectionGrid: TGridRect;
im private teil, oder wo ihr wollt (für die unit global) deklarieren und dann die beiden folgenden prozeduren verwenden

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
//------------------------------------------------------------------------------
procedure TMyFrame.vSGResevierungMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Var
  acol, arow: Integer;
begin
  if button = mbright then
  With Sender As TStringgrid Do Begin
    if (Selection.right - selection.Left > 1) then exit;
    MouseToCell( X, Y, acol, arow );
    If arow >= FixedRows Then Begin
      With FSelectionStart Do Begin
        left := acol;
        right := acol;
        top := arow;
        bottom := arow;
      End; { With }
      Selection := FSelectionStart;
    End; { If }
  End; { With }
end;


//------------------------------------------------------------------------------
procedure TMyFrame.vSGResevierungMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
Var
  acol, arow: Integer;
  gr: TGridRect;
begin
  if ssRight in Shift then
  With Sender As TStringgrid Do Begin
    MouseToCell( X, Y, acol, arow );
    If arow >= FixedRows Then Begin
      gr := selection;
      With gr Do Begin
        if ACol < Left then
          left := acol
        else if (acol <= FSelectionStart.Left) and (acol > left) then
          left := acol
        else if ACol > right then
          right := acol
        else if (acol >= FSelectionStart.Right) and (acol < right) then
          right := acol;

        if arow < FSelectionStart.Top then
          top := arow
        else if (arow <= FSelectionStart.Bottom) and  (arow > top) then
          top := arow
        else if (arow > FSelectionStart.Bottom) then
          bottom := arow
        else if (arow >= FSelectionStart.top) and (arow < Bottom) then
          bottom := arow;
      End; { With }
      Selection := gr;
    End; { If }
  End; { With }
end;


Gruß
Ken