Autor Beitrag
hansg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 168

Win XP Professional SP3, Vista Ultimate 32 SP1
Delphi 6 Professional
BeitragVerfasst: Fr 14.10.05 20:18 
Hallo,


ich habe folgende Fragen zum Stringgrid.

1. Wie kann ichn einzelne Zellen für Eingaben freigeben bzw. sperren?

2. Kann ich den Inhalt einer Zelle zentrieren?



Gruß Hans

_________________
Gruß Hans
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 14.10.05 20:37 
user profile iconhansg hat folgendes geschrieben:

ich habe folgende Fragen zum Stringgrid.

2 Fragen , 2 threads
user profile iconhansg hat folgendes geschrieben:
1. Wie kann ichn einzelne Zellen für Eingaben freigeben bzw. sperren?

im onselectcell:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if odd(acol) then
  stringgrid1.options:=stringgrid1.options+[goediting]
 else
  stringgrid1.options:=stringgrid1.options-[goediting]

jede zweite spalte wäre editierbar/nicht editierbar

user profile iconhansg hat folgendes geschrieben:
2. Kann ich den Inhalt einer Zelle zentrieren?

selberzeichnen im Ondrawcell. Zentrieren am einfachsten mit Drawtext Suche in: Delphi-Forum, Delphi-Library ONDRAWCELL DRAWTEXT

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
hansg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 168

Win XP Professional SP3, Vista Ultimate 32 SP1
Delphi 6 Professional
BeitragVerfasst: Sa 15.10.05 09:08 
Hallo,

danke für die Info, komme ich leider nicht mit weit.

Ich möchte einige Zeilen / Spalten bzw. Zellen vom Grid gezielt für Eingaben sperren, ist aber keine feste Reihenfolge dabei.

Gruß Hans

_________________
Gruß Hans
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 15.10.05 09:48 
Hallo,

so kannst Du Bereiche zur Eingabe sperren/freigeben.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if (aCol in [1,3,5]) or (aRow in [2..5,7]) then//entsprechend anpassen
    stringgrid1.options:=stringgrid1.options-[goediting]
    else
      stringgrid1.options:=stringgrid1.options+[goediting];

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mo 17.10.05 09:45 
Hallo :wink2:

Du könntest das TGrid ableiten und die Funciton CanEditModify überschreiben.

Lg Martin