Announcement

Collapse
No announcement yet.

nochmal Stringgrid

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • nochmal Stringgrid

    Soweit läuft nun alles, ich habe nun nur noch eine kleiner optische Frage.
    Wenn man sich in Explorer die Details anschaltet, ist hinter dem Feld wonach die Dateien sortiert sind, so ein kleiner Pfeil für die Richtung. ALso ob abwärts oder aufwärts. Hat hier jemand ne Idee, wie ich sowas in die Fixedrow bei einem Stringgrid einbauen kann??

    Würde mich über ne Antwort sehr freuen.

    Christopher

  • #2
    Hallo Christian,<br>
    im OnDrawCell Event, kannst Du checken, ob Row 0 gezeichnet wird.<br>
    Dann kannst Du eine kleine Bitmap in die passende Zelle malen.<br>
    Jens Schumann<br&gt

    Comment


    • #3
      hm...
      ich habe glaube, ich nicht ganz verstanden was du meinst. Ich habe mehrere Spalten, die jeweils auf Click erst aufwärts, beim zweiten Click abwärts sortiert werden können. Eben genau so wie wenn man Dateien mit Details sortieren lässt.
      Nun soll halt einfach hinter dem jeweiligen Titel (z.B. Nachname, Vorname usw.) ein Pfeil Symbol nach oben oder unten zeigen, so wie in Windows. Dabei wird aber der Rest der Zeile nicht ausgeblendet.
      Wenn du dazu auch noch ne Lösung hast, fände ich das Klasse.

      Christophe

      Comment


      • #4
        Hallo Christopher,<br>
        der folgende Code schreibt in jede fixe Zelle eines TStringGrid eine kleine Bitmap.<br>
        In ähnlicher Weise solltest Du auch vorgehen.<br>
        <pre>
        unit Unit1;

        interface

        uses
        Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
        ImgList, Grids;

        type
        TForm1 = class(TForm)
        SG: TStringGrid;
        ImageList1: TImageList;
        procedure FormCreate(Sender: TObject);
        procedure SGDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect;
        State: TGridDrawState);
        private
        { Private-Deklarationen }
        public
        { Public-Deklarationen }
        end;

        var
        Form1: TForm1;

        implementation

        {$R *.DFM}

        procedure TForm1.FormCreate(Sender: TObject);
        var
        iCnt : Integer;
        begin
        For iCnt:=0 to SG.ColCount-1 do
        SG.Cells[iCnt,0]:='Test '+IntToStr(iCnt+1);
        end;

        procedure TForm1.SGDrawCell(Sender: TObject; ACol, ARow: Integer;
        Rect: TRect; State: TGridDrawState);
        begin
        If gdFixed in State then
        begin
        ImageList1.Draw(SG.Canvas,Rect.Right-16,Rect.Top,0);
        end;
        end;

        end.

        Hier das Formular
        object Form1: TForm1
        Left = 305
        Top = 214
        Width = 363
        Height = 179
        Caption = 'Form1'
        Color = clBtnFace
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        OldCreateOrder = False
        OnCreate = FormCreate
        PixelsPerInch = 96
        TextHeight = 13
        object SG: TStringGrid
        Left = 12
        Top = 12
        Width = 329
        Height = 128
        DefaultRowHeight = 18
        ScrollBars = ssNone
        TabOrder = 0
        OnDrawCell = SGDrawCell
        end
        object ImageList1: TImageList
        Left = 32
        Top = 100
        Bitmap = {
        494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFF FFFFFF424D3600
        00000000000036000000280000004000000010000000010020 00000000000010
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        00000000000000000000000000000000000000000000000000 00000000000000
        0000000000000000000000000

        Comment


        • #5
          Hallo Christopher,<br>
          der folgende Code schreibt in jede fixe Zelle eines TStringGrid eine kleine Bitmap.<br>
          In ähnlicher Weise solltest Du auch vorgehen.<br>
          <pre>
          <font face="Verdana" size="1" color="#000000">unit Unit1;

          interface

          uses
          Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
          ImgList, Grids;

          type
          TForm1 = class(TForm)
          SG: TStringGrid;
          ImageList1: TImageList;
          procedure FormCreate(Sender: TObject);
          procedure SGDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect;
          State: TGridDrawState);
          private
          { Private-Deklarationen }
          public
          { Public-Deklarationen }
          end;

          var
          Form1: TForm1;

          implementation

          {$R *.DFM}

          procedure TForm1.FormCreate(Sender: TObject);
          var
          iCnt : Integer;
          begin
          For iCnt:=0 to SG.ColCount-1 do
          SG.Cells[iCnt,0]:='Test '+IntToStr(iCnt+1);
          end;

          procedure TForm1.SGDrawCell(Sender: TObject; ACol, ARow: Integer;
          Rect: TRect; State: TGridDrawState);
          begin
          If gdFixed in State then
          begin
          ImageList1.Draw(SG.Canvas,Rect.Right-16,Rect.Top,0);
          end;
          end;

          end.</font>
          </pre>
          <br>
          Jens Schumann<br&gt

          Comment

          Working...
          X