Programlama yapalım ve Öğrenelim. - Delphi Eğitim168
  Ana Sayfa
  .NET Eğitim Notları
  Visual C# .NET Örnek Kodları
  VisualBasic.NET Örnek Kodları
  J# Örnekleri
  ASP.NET Örnek Kodları
  Delphi Eğitim
  => Delphi Eğitim1
  => Delphi Eğitim2
  => Delphi Eğitim3
  => Delphi Eğitim4
  => Delphi Eğitim5
  => Delphi Eğitim6
  => Delphi Eğitim7
  => Delphi Eğitim8
  => Delphi Eğitim9
  => Delphi Eğitim10
  => Delphi Eğitim11
  => Delphi Eğitim13
  => Delphi Eğitim14
  => Delphi Eğitim15
  => Delphi Eğitim16
  => Delphi Eğitim17
  => Delphi Eğitim18
  => Delphi Eğitim19
  => Delphi Eğitim20
  => Delphi Eğitim21
  => Delphi Eğitim22
  => Delphi Eğitim23
  => Delphi Eğitim24
  => Delphi Eğitim25
  => Delphi Eğitim26
  => Delphi Eğitim27
  => Delphi Eğitim28
  => Delphi Eğitim29
  => Delphi Eğitim30
  => Delphi Eğtim31
  => Delphi Eğitim32
  => Delphi Eğitim33
  => Delphi Eğitim34
  => Delphi Eğitim35
  => Delphi Eğitim36
  => Delphi Eğitim37
  => Delphi Eğitim38
  => Delphi Eğitim39
  => Delphi Eğitim40
  => Delphi Eğitim41
  => Delphi Eğitim42
  => Delphi Eğitim43
  => Delphi Eğitim44
  => Delphi Eğitim45
  => Delphi Eğitim46
  => Delphi Eğitim47
  => Delphi Eğitim48
  => Delphi Eğitim49
  => Delphi Eğitim50
  => Delphi Eğitim51
  => Delphi Eğitim52
  => Delphi Eğitim53
  => Delphi Eğitim54
  => Delphi Eğitim55
  => Delphi Eğitim56
  => Delphi Eğitim57
  => Delphi Eğitim58
  => Delphi Eğitim59
  => Delphi Eğitim60
  => Delphi Eğitim61
  => Delphi Eğitim62
  => Delphi Eğitim63
  => Delphi Eğitim64
  => Delphi Eğitim65
  => Delphi Eğitim66
  => Delphi Eğitim67
  => Delphi Eğitim68
  => Delphi Eğitim69
  => Delphi Eğitim70
  => Delphi Eğitim71
  => Delphi Eğitim72
  => Delphi Eğitim73
  => Delphi Eğitim74
  => Delphi Eğitim75
  => Delphi Eğitim76
  => Delphi Eğitim77
  => Delphi Eğitim78
  => Delphi Eğitim79
  => Delphi Eğitim80
  => Delphi Eğitim81
  => Delphi Eğitim82
  => Delphi Eğitim83
  => Delphi Eğitim84
  => Delphi Eğitim85
  => Delphi Eğitim86
  => Delphi Eğitim87
  => Delphi Eğitim88
  => Delphi Eğitim89
  => Delphi Eğitim90
  => Delphi Eğitim91
  => Delphi Eğitim92
  => Delphi Eğitim93
  => Delphi Eğitim94
  => Delphi Eğitim95
  => Delphi Eğitim96
  => Delphi Eğitim97
  => Delphi Eğitim98
  => Delphi Eğitim99
  => Delphi Eğitim100
  => Delphi Eğitim101
  => Delphi Eğitim102
  => Delphi Eğitim103
  => Delphi Eğitim104
  => Delphi Eğitim105
  => Delphi Eğitim106
  => Delphi Eğitim107
  => Delphi Eğitim108
  => Delphi Eğitim109
  => Delphi Eğitim110
  => Delphi Eğitim111
  => Delphi Eğitim112
  => Delphi Eğitim113
  => Delphi Eğitim114
  => Delphi Eğitim115
  => Delphi Eğitim116
  => Delphi Eğitim117
  => Delphi Eğitim118
  => Delphi Eğitim119
  => Delphi Eğitim120
  => Delphi Eğitim121
  => Delphi Eğitim122
  => Delphi Eğitim123
  => Delphi Eğitim124
  => Delphi Eğitim125
  => Delphi Eğitim126
  => Delphi Eğitim127
  => Delphi Eğitim128
  => Delphi Eğitim129
  => Delphi Eğitim130
  => Delphi Eğitim131
  => Delphi Eğitim132
  => Delphi Eğitim133
  => Delphi Eğitim134
  => Delphi Eğitim135
  => Delphi Eğitim136
  => Delphi Eğitim137
  => Delphi Eğitim138
  => Delphi Eğitim139
  => Delphi Eğitim140
  => Delphi Eğitim141
  => Delphi Eğitim142
  => Delphi Eğitim143
  => Delphi Eğitim144
  => Delphi Eğitim145
  => Delphi Eğitim146
  => Delphi eğitim147
  => Delphi Eğitim148
  => Delphi Eğitim149
  => Delphi Eğitim150
  => Delphi Eğitim151
  => Delphi Eğitim152
  => Delphi Eğitim153
  => Delphi Eğitim154
  => Delphi Eğitim155
  => Delphi Eğitim156
  => Delphi Eğitim157
  => Delphi Eğitim158
  => Delphi Eğitim159
  => Delphi Eğitim160
  => Delphi Eğitim161
  => Delphi Eğitim162
  => Delphi Eğitim164
  => Delphi Eğitim165
  => Delphi Eğitim166
  => Delphi Eğitim167
  => Delphi Eğitim168
  => Delphi Eğitim169
  => Delphi Eğitim170
  => Delphi Eğitim171
  => Delphi Eğitim172
  => Delphi Eğitim173
  => Delphi Eğitim174
  => Delphi Eğitim175
  => Delphi Eğitim176
  => Delphi Eğitim177
  => Delphi Eğitim178
  => Delphi Eğitim179
  => Delphi Eğitim180
  => Delphi Eğitim181
  => Delphi Eğitim182
  => Delphi Eğitim183
  => Delphi Eğitim184
  => Delphi Eğitim185
  => Delphi Eğitim186
  => Delphi Eğitim187
  => Delphi Eğitim188
  => Delphi Eğitim189
  => Delphi Eğitim190
  => Delphi Eğitim191
  => Delphi Eğitim192
  => Delphi Eğitim193
  => Delphi Eğitim194
  => Delphi Eğitim195
  => Delphi Eğitim196
  => Delphi Eğitim197
  => Delphi Eğitim198
  => Delphi Eğitim199
  => Delphi Eğitim200
  => Delphi Eğitim201
  => Delphi Eğitim202
  => Delphi Eğitim203
  => Delphi Eğitim204
  => Delphi Eğitim205
  => Delphi Eğitim206
  => Delphi Eğitim207
  => Delphi Eğitim208
  => Delphi Eğitim209
  => Delphi Eğitim210
  => Delphi Eğitim211
  => Delphi Eğitim212
  => Delphi Eğitim213
  => Delphi Eğitim214
  => Delphi Eğitim215
  => Delphi Eğitim216
  => Delphi Eğitim217
  => Delphi Eğitim218
  => Delphi Eğitim219
  => Delphi Eğitim220
  => Delphi Eğitim221
  => Delphi Eğitim222
  => Delphi Eğitim223
  => Delphi Eğitim224
  => Delphi Eğitim225
  => Delphi Eğitim226
  => Delphi Eğitim227
  => Delphi Eğitim228
  => Delphi Eğitim229
  => Delphi Eğitim230
  => Delphi Eğitim231
  => Delphi Eğitim232
  => Delphi Eğitim233
  => Delphi Eğitim234
  => Delphi Eğitim235
  => Delphi Eğitim236
  => Delphi Eğitim237
  => Delphi Eğitim238
  => Delphi Eğitim239
  => Delphi Eğitim240
  => Delphi Eğitim241
  => Delphi Eğitim242
  İletişim

neoturk: ...Format a messagedlg ?...

procedure TForm1.Button1Click(Sender: TObject);

var

  f: TForm;

begin

  // Create the MessageDialog

  // Den MessageDialog erstellen

  f := Dialogs.CreateMessageDialog('HELLOWORLD', dialogs.mtInformation, dialogs.mbOKCancel);

  // Set the backcolor to blue.

  // färbt die Form blau.

  f.Color := clBlue;

  // Set textcolor to lime

  // Färbt die Schrift lime

  f.Font.Color := clLime;

  // Zeigt die Form an und wartet auf den ModalResult.

  // Shows the dialog and wait for the modalresult

  if f.ShowModal = mrOk then

    ShowMessage('OK Pressed, OK wurde gedrückt')

  else

    ShowMessage('Cancel pressed. Abbrechen wurde gedrückt');

end;

 

Delphi - .....................................

 

neoturk: ...Make a polygon hole on a form ?...

type

  PtsType = array [0..15, 0..1] of Integer;

 

const

  Pts: PtsType = ((0, 0), (800, 0), (800, 600),

    (200, 600), (200, 220), (300, 280),

    (265, 205), (350, 117), (205, 170),

    (120, 90), (130, 200), (60, 350), (200, 220),

    (200, 600), (0, 600), (0, 0));

 

procedure TForm1.Button1Click(Sender: TObject);

var

  HRegion1: THandle;

begin

  HRegion1 := CreatePolygonRgn(Pts, SizeOf(Pts) div 8, alternate);

  SetWindowRgn(Handle, HRegion1, True);

end;

 

Delphi - .....................................

 

neoturk: ...Make a polygon hole on a form ?...

type

  PtsType = array [0..15, 0..1] of Integer;

 

const

  Pts: PtsType = ((0, 0), (800, 0), (800, 600),

    (200, 600), (200, 220), (300, 280),

    (265, 205), (350, 117), (205, 170),

    (120, 90), (130, 200), (60, 350), (200, 220),

    (200, 600), (0, 600), (0, 0));

 

procedure TForm1.Button1Click(Sender: TObject);

var

  HRegion1: THandle;

begin

  HRegion1 := CreatePolygonRgn(Pts, SizeOf(Pts) div 8, alternate);

  SetWindowRgn(Handle, HRegion1, True);

end;

 

Delphi - .....................................

 

neoturk: ...Implement an animated gradient ?...

{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I have taken two tipps from this site to work together:

   1. to draw a gradient from David Johannes Rieger

   2. the unit anithread form P. Below

 

what's coming out is a animated gradient. You know it maybe from

programms like VCDEasy.

 

There is nothing from me - all from this site!

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

Ich habe zwei Tipps von dieser Seite zusammengefügt:

   1. to draw a gradient from David Johannes Rieger

   2. the unit anithread form P. Below

 

Dadurch erhält man einen animierten Gradienten wie Bsp. in VCDEasy zu sehen.

 

Der Quelltext ist nicht von mir, alles ist von dieser Seite!

 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}

 

 

 

unit anithread;

 

interface

 

uses

  Classes, Windows, Controls, Graphics;

 

type

  TAnimationThread = class(TThread)

  private

    { Private declarations }

    FWnd: HWND;

    FPaintRect: TRect;

    FbkColor, FfgColor: TColor;

    FInterval: Integer;

    procedure DrawGradient(ACanvas: TCanvas; Rect: TRect; Horicontal: Boolean;

      Colors: array of TColor);

  protected

    procedure Execute; override;

  public

    constructor Create(paintsurface: TWinControl; {Control to paint on }

      paintrect: TRect;          {area for animation bar }

      bkColor, barcolor: TColor; {colors to use }

      interval: Integer);       {wait in msecs between

paints}

  end;

 

implementation

 

constructor TAnimationThread.Create(paintsurface: TWinControl;

  paintrect: TRect; bkColor, barcolor: TColor; interval: Integer);

begin

  inherited Create(True);

  FWnd       := paintsurface.Handle;

  FPaintRect := paintrect;

  FbkColor   := bkColor;

  FfgColor   := barColor;

  FInterval  := interval;

  FreeOnterminate := True;

  Resume;

end; { TAnimationThread.Create }

 

procedure TAnimationThread.Execute;

var

  image: TBitmap;

  DC: HDC;

  Left, Right: Integer;

  increment: Integer;

  imagerect: TRect;

  state: (incRight, decRight);

begin

  Image := TBitmap.Create;

  try

    with Image do

    begin

      Width     := FPaintRect.Right - FPaintRect.Left;

      Height    := FPaintRect.Bottom - FPaintRect.Top;

      imagerect := Rect(0, 0, Width, Height);

    end; { with }

    Left      := 0;

    Right     := 0;

    increment := imagerect.Right div 50;

    state     := Low(State);

    while not Terminated do

    begin

      with Image.Canvas do

      begin

        Brush.Color := FbkColor;

 

        //FillRect(imagerect); original!

 

        DrawGradient(Image.Canvas, imagerect, True, [clBtnShadow, clBtnFace]);

 

        case state of

          incRight:

            begin

              Inc(Right, increment);

              if Right > imagerect.Right then

              begin

                Right := imagerect.Right;

                Inc(state);

              end; // if

            end; // Case incRight }

          decRight:

            begin

              Dec(Right, increment);

              if Right <= 0 then

              begin

                Right := 0;

                state := incRight;

              end; // if

            end; // Case decLeft

        end; { Case }

        Brush.Color := FfgColor;

 

        //FillRect(Rect(left, imagerect.top, right, imagerect.bottom)); original!

 

        DrawGradient(Image.Canvas, Rect(Left, imagerect.Top, Right, imagerect.Bottom),

          True, [clBtnFace, clBtnShadow]);

      end; { with }

      DC := GetDC(FWnd);

      if DC <> 0 then

        try

          BitBlt(DC,

            FPaintRect.Left,

            FPaintRect.Top,

            imagerect.Right,

            imagerect.Bottom,

            Image.Canvas.Handle,

            0, 0,

            SRCCOPY);

        finally

          ReleaseDC(FWnd, DC);

        end;

      Sleep(FInterval);

    end; { While }

  finally

    Image.Free;

  end;

  InvalidateRect(FWnd, nil, True);

end; { TAnimationThread.Execute }

 

procedure TAnimationThread.DrawGradient(ACanvas: TCanvas; Rect: TRect;

  Horicontal: Boolean; Colors: array of TColor);

type

  RGBArray = array[0..2] of Byte;

var

  x, y, z, stelle, mx, bis, faColorsh, mass: Integer;

  Faktor: Double;

  A: RGBArray;

  B: array of RGBArray;

  merkw: Integer;

  merks: TPenStyle;

  merkp: TColor;

begin

  mx := High(Colors);

  if mx > 0 then

  begin

    if Horicontal then

      mass := Rect.Right - Rect.Left

    else

      mass := Rect.Bottom - Rect.Top;

    SetLength(b, mx + 1);

    for x := 0 to mx do

    begin

      Colors[x] := ColorToRGB(Colors[x]);

      b[x][0]   := GetRValue(Colors[x]);

      b[x][1]   := GetGValue(Colors[x]);

      b[x][2]   := GetBValue(Colors[x]);

    end;

    merkw     := ACanvas.Pen.Width;

    merks     := ACanvas.Pen.Style;

    merkp     := ACanvas.Pen.Color;

    ACanvas.Pen.Width := 1;

    ACanvas.Pen.Style := psSolid;

    faColorsh := Round(mass / mx);

    for y := 0 to mx - 1 do

    begin

      if y = mx - 1 then

        bis := mass - y * faColorsh - 1

      else

        bis := faColorsh;

      for x := 0 to bis do

      begin

        Stelle := x + y * faColorsh;

        faktor := x / bis;

        for z := 0 to 2 do

          a[z] := Trunc(b[y][z] + ((b[y + 1][z] - b[y][z]) * Faktor));

        ACanvas.Pen.Color := RGB(a[0], a[1], a[2]);

        if Horicontal then

        begin

          ACanvas.MoveTo(Rect.Left + Stelle, Rect.Top);

          ACanvas.LineTo(Rect.Left + Stelle, Rect.Bottom);

        end

        else

        begin

          ACanvas.MoveTo(Rect.Left, Rect.Top + Stelle);

          ACanvas.LineTo(Rect.Right, Rect.Top + Stelle);

        end;

      end;

    end;

    b := nil;

    ACanvas.Pen.Width := merkw;

    ACanvas.Pen.Style := merks;

    ACanvas.Pen.Color := merkp;

  end;

  {else

    // Please specify at least two colors

    raise EMathError.Create('Es müssen mindestens zwei Farben angegeben werden.');

 

 

    In diesem Fallnicht mehr als zwei Farben!

    Here not more than two colors!

    }

end;

 

 

end.

 

 

 

{Usage:

 Place a TPanel on a form, size it as appropriate.Create an instance of the

 TanimationThread call like this: procedure TForm1.Button1Click(Sender : TObject);

}

 

procedure TForm1.Button1Click(Sender: TObject);

var

  ani: TAnimationThread;

  r: TRect;

  begin  r := panel1.ClientRect;

  InflateRect(r, - panel1.bevelwidth, - panel1.bevelwidth);

  ani := TanimationThread.Create(panel1, r, panel1.Color, clBlue, 25);

  Button1.Enabled := False;

  Application.ProcessMessages;

  Sleep(30000);  // replace with query.Open or such

  Button1.Enabled := True;

  ani.Terminate;

  ShowMessage('Done');

  end;

 

Delphi - .....................................

 

neoturk: ...Implement an animated gradient ?...

{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I have taken two tipps from this site to work together:

   1. to draw a gradient from David Johannes Rieger

   2. the unit anithread form P. Below

 

what's coming out is a animated gradient. You know it maybe from

programms like VCDEasy.

 

There is nothing from me - all from this site!

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

Ich habe zwei Tipps von dieser Seite zusammengefügt:

   1. to draw a gradient from David Johannes Rieger

   2. the unit anithread form P. Below

 

Dadurch erhält man einen animierten Gradienten wie Bsp. in VCDEasy zu sehen.

 

Der Quelltext ist nicht von mir, alles ist von dieser Seite!

 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}

 

 

 

unit anithread;

 

interface

 

uses

  Classes, Windows, Controls, Graphics;

 

type

  TAnimationThread = class(TThread)

  private

    { Private declarations }

    FWnd: HWND;

    FPaintRect: TRect;

    FbkColor, FfgColor: TColor;

    FInterval: Integer;

    procedure DrawGradient(ACanvas: TCanvas; Rect: TRect; Horicontal: Boolean;

      Colors: array of TColor);

  protected

    procedure Execute; override;

  public

    constructor Create(paintsurface: TWinControl; {Control to paint on }

      paintrect: TRect;          {area for animation bar }

      bkColor, barcolor: TColor; {colors to use }

      interval: Integer);       {wait in msecs between

paints}

  end;

 

implementation

 

constructor TAnimationThread.Create(paintsurface: TWinControl;

  paintrect: TRect; bkColor, barcolor: TColor; interval: Integer);

begin

  inherited Create(True);

  FWnd       := paintsurface.Handle;

  FPaintRect := paintrect;

  FbkColor   := bkColor;

  FfgColor   := barColor;

  FInterval  := interval;

  FreeOnterminate := True;

  Resume;

end; { TAnimationThread.Create }

 

procedure TAnimationThread.Execute;

var

  image: TBitmap;

  DC: HDC;

  Left, Right: Integer;

  increment: Integer;

  imagerect: TRect;

  state: (incRight, decRight);

begin

  Image := TBitmap.Create;

  try

    with Image do

    begin

      Width     := FPaintRect.Right - FPaintRect.Left;

      Height    := FPaintRect.Bottom - FPaintRect.Top;

      imagerect := Rect(0, 0, Width, Height);

    end; { with }

    Left      := 0;

    Right     := 0;

    increment := imagerect.Right div 50;

    state     := Low(State);

    while not Terminated do

    begin

      with Image.Canvas do

      begin

        Brush.Color := FbkColor;

 

        //FillRect(imagerect); original!

 

        DrawGradient(Image.Canvas, imagerect, True, [clBtnShadow, clBtnFace]);

 

        case state of

          incRight:

            begin

              Inc(Right, increment);

              if Right > imagerect.Right then

              begin

                Right := imagerect.Right;

                Inc(state);

              end; // if

            end; // Case incRight }

          decRight:

            begin

              Dec(Right, increment);

              if Right <= 0 then

              begin

                Right := 0;

                state := incRight;

              end; // if

            end; // Case decLeft

        end; { Case }

        Brush.Color := FfgColor;

 

        //FillRect(Rect(left, imagerect.top, right, imagerect.bottom)); original!

 

        DrawGradient(Image.Canvas, Rect(Left, imagerect.Top, Right, imagerect.Bottom),

          True, [clBtnFace, clBtnShadow]);

      end; { with }

      DC := GetDC(FWnd);

      if DC <> 0 then

        try

          BitBlt(DC,

            FPaintRect.Left,

            FPaintRect.Top,

            imagerect.Right,

            imagerect.Bottom,

            Image.Canvas.Handle,

            0, 0,

            SRCCOPY);

        finally

          ReleaseDC(FWnd, DC);

        end;

      Sleep(FInterval);

    end; { While }

  finally

    Image.Free;

  end;

  InvalidateRect(FWnd, nil, True);

end; { TAnimationThread.Execute }

 

procedure TAnimationThread.DrawGradient(ACanvas: TCanvas; Rect: TRect;

  Horicontal: Boolean; Colors: array of TColor);

type

  RGBArray = array[0..2] of Byte;

var

  x, y, z, stelle, mx, bis, faColorsh, mass: Integer;

  Faktor: Double;

  A: RGBArray;

  B: array of RGBArray;

  merkw: Integer;

  merks: TPenStyle;

  merkp: TColor;

begin

  mx := High(Colors);

  if mx > 0 then

  begin

    if Horicontal then

      mass := Rect.Right - Rect.Left

    else

      mass := Rect.Bottom - Rect.Top;

    SetLength(b, mx + 1);

    for x := 0 to mx do

    begin

      Colors[x] := ColorToRGB(Colors[x]);

      b[x][0]   := GetRValue(Colors[x]);

      b[x][1]   := GetGValue(Colors[x]);

      b[x][2]   := GetBValue(Colors[x]);

    end;

    merkw     := ACanvas.Pen.Width;

    merks     := ACanvas.Pen.Style;

    merkp     := ACanvas.Pen.Color;

    ACanvas.Pen.Width := 1;

    ACanvas.Pen.Style := psSolid;

    faColorsh := Round(mass / mx);

    for y := 0 to mx - 1 do

    begin

      if y = mx - 1 then

        bis := mass - y * faColorsh - 1

      else

        bis := faColorsh;

      for x := 0 to bis do

      begin

        Stelle := x + y * faColorsh;

        faktor := x / bis;

        for z := 0 to 2 do

          a[z] := Trunc(b[y][z] + ((b[y + 1][z] - b[y][z]) * Faktor));

        ACanvas.Pen.Color := RGB(a[0], a[1], a[2]);

        if Horicontal then

        begin

          ACanvas.MoveTo(Rect.Left + Stelle, Rect.Top);

          ACanvas.LineTo(Rect.Left + Stelle, Rect.Bottom);

        end

        else

        begin

          ACanvas.MoveTo(Rect.Left, Rect.Top + Stelle);

          ACanvas.LineTo(Rect.Right, Rect.Top + Stelle);

        end;

      end;

    end;

    b := nil;

    ACanvas.Pen.Width := merkw;

    ACanvas.Pen.Style := merks;

    ACanvas.Pen.Color := merkp;

  end;

  {else

    // Please specify at least two colors

    raise EMathError.Create('Es müssen mindestens zwei Farben angegeben werden.');

 

 

    In diesem Fallnicht mehr als zwei Farben!

    Here not more than two colors!

    }

end;

 

 

end.

 

 

 

{Usage:

 Place a TPanel on a form, size it as appropriate.Create an instance of the

 TanimationThread call like this: procedure TForm1.Button1Click(Sender : TObject);

}

 

procedure TForm1.Button1Click(Sender: TObject);

var

  ani: TAnimationThread;

  r: TRect;

  begin  r := panel1.ClientRect;

  InflateRect(r, - panel1.bevelwidth, - panel1.bevelwidth);

  ani := TanimationThread.Create(panel1, r, panel1.Color, clBlue, 25);

  Button1.Enabled := False;

  Application.ProcessMessages;

  Sleep(30000);  // replace with query.Open or such

  Button1.Enabled := True;

  ani.Terminate;

  ShowMessage('Done');

  end;

 

Delphi - .....................................

 

neoturk: ...Zoom the content of a stringgrid ?...

{

Stringgrid zoomen:

 

benötigt wird ein Formular mit einem Stringgrid namens grid und zwei TBitBtn.

 

der Funktion gridZoom(Fact) wird ein Realzahlenfaktor übergeben, der den Zoomgrad angibt:

1.0 - keine Veränderung

0.9 - Kleiner

1.1 - Größer

 

Diese Funktion multipliziert nun zu Breite und Höhe der jeweiligen Spalten / Zeilen

den angegebenen Faktor.

Die Schriftgröße wird anhand der Zeilenhöhe der Zeile 0 bestimmt (*0.8).

Zu empfehlen ist hier eine TrueType-Schriftart (z.Bsp. Arial), da sonnst die Schrift

sehr eckig wirkt.

}

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  Grids, StdCtrls, Buttons;

 

type

  TForm1 = class(TForm)

    grid: TStringGrid;

    BitBtn1: TBitBtn;

    BitBtn2: TBitBtn;

    procedure BitBtn1Click(Sender: TObject);

    procedure BitBtn2Click(Sender: TObject);

  private

    { Private-Deklarationen }

    procedure gridZoom(FFact: Real);

  public

    { Public-Deklarationen }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

 

procedure TForm1.gridZoom(FFact: Real);

var

  x: Integer;

begin

  for x := 0 to grid.colcount - 1 do

    grid.colwidths[x] := round(grid.colwidths[x] * FFact);

 

  for x := 0 to grid.RowCount - 1 do

    grid.rowheights[x] := round(grid.rowheights[x] * FFact);

 

  grid.Font.Size := round(grid.rowheights[0] * 0.65);

end;

 

//Grösser:

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

  gridZoom(1.1);

end;

 

//Kleiner:

procedure TForm1.BitBtn2Click(Sender: TObject);

begin

  gridZoom(0.9);

end;

 

end.

 

Delphi - .....................................

 

neoturk: ...Zoom the content of a stringgrid ?...

{

Stringgrid zoomen:

 

benötigt wird ein Formular mit einem Stringgrid namens grid und zwei TBitBtn.

 

der Funktion gridZoom(Fact) wird ein Realzahlenfaktor übergeben, der den Zoomgrad angibt:

1.0 - keine Veränderung

0.9 - Kleiner

1.1 - Größer

 

Diese Funktion multipliziert nun zu Breite und Höhe der jeweiligen Spalten / Zeilen

den angegebenen Faktor.

Die Schriftgröße wird anhand der Zeilenhöhe der Zeile 0 bestimmt (*0.8).

Zu empfehlen ist hier eine TrueType-Schriftart (z.Bsp. Arial), da sonnst die Schrift

sehr eckig wirkt.

}

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  Grids, StdCtrls, Buttons;

 

type

  TForm1 = class(TForm)

    grid: TStringGrid;

    BitBtn1: TBitBtn;

    BitBtn2: TBitBtn;

    procedure BitBtn1Click(Sender: TObject);

    procedure BitBtn2Click(Sender: TObject);

  private

    { Private-Deklarationen }

    procedure gridZoom(FFact: Real);

  public

    { Public-Deklarationen }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

 

procedure TForm1.gridZoom(FFact: Real);

var

  x: Integer;

begin

  for x := 0 to grid.colcount - 1 do

    grid.colwidths[x] := round(grid.colwidths[x] * FFact);

 

  for x := 0 to grid.RowCount - 1 do

    grid.rowheights[x] := round(grid.rowheights[x] * FFact);

 

  grid.Font.Size := round(grid.rowheights[0] * 0.65);

end;

 

//Grösser:

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

  gridZoom(1.1);

end;

 

//Kleiner:

procedure TForm1.BitBtn2Click(Sender: TObject);

begin

  gridZoom(0.9);

end;

 

end.

 

Delphi - .....................................

 

neoturk: ...Early trap then close window procedure ?...

Procedure TForm1.HandleMessage(var Msg:TMessage);

begin

 if msg.msg = WM_CLOSE //You can insert there other message constans from windows unit.

 then

  begin

   {Your code when user clicked close button}

   showmessage('You can not close this window!');

  end

 else form1.wndproc(msg); //if not closed system handle the message default

end;

procedure TForm1.Create(Sender:Tobject);

begin

 form1.Windowproc:=form1.handlemessage; //run handling

end;

 

Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol