Programlama yapalım ve Öğrenelim. - Delphi Eğitim165
  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: ...Make each mdichild fill the entire client area of the main form ?...

unit Unit1;

 

interface

 

uses

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

 

type

  TMDIForm = class(TForm)

  private

    { Private declarations }

    FMainWindowClientCoordinates: TRect;

    procedure SetMainWindowClientCoordinates(const Value: TRect);

    procedure NewChild(Sender: TObject);

  public

    { Public declarations }

    // property used to read MainForm client coordinates

    property MainWindowClientCoordinates: TRect

      read FMainWindowClientCoordinates write SetMainWindowClientCoordinates;

  end;

 

var

  MDIForm: TMDIForm; // Main form, property "formStyle" has to be fsMdiForm

 

implementation

 

{$R *.DFM}

 

uses

  Child; // Defines TMDIchild class, property "formStyle" has to be fsMdiChild

 

procedure TMDIForm.SetMainWindowClientCoordinates(const Value: TRect);

begin

  FMainWindowClientCoordinates := Value;

end;

 

procedure TMDIForm.SetMainWindowCoordinates(const Value: TRect);

begin

  FMainWindowCoordinates := Value;

end;

 

procedure TMDIForm.FormShow(Sender: TObject);

begin

  // Reads MDIForm client coordinates

  Windows.GetClientRect(ClientHandle, fMainWindowClientCoordinates);

end;

 

procedure TMDIForm.NewChild(Sender: TObject);

var

  LocalMDIChildForm: TMDIChildForm;

begin

  // You can execute this procedure each time you

  // create a new child, for example you can call this

  // procedure from a button

  LocalMDIChildForm := TMDIChildForm.Create(Self);

  with LocalMDIChildForm do

  begin

    Caption := 'Child Form: ' + IntToStr(MDIChildCount);

    Top     := MainWindowClientCoordinates.Top;

    Left    := MainWindowClientCoordinates.Left;

    Width   := MainWindowClientCoordinates.Right;

    Height  := MainWindowClientCoordinates.Bottom;

    Show;

  end; // with ...

end;

 

end.

 

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

 

neoturk: ...Make each mdichild fill the entire client area of the main form ?...

unit Unit1;

 

interface

 

uses

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

 

type

  TMDIForm = class(TForm)

  private

    { Private declarations }

    FMainWindowClientCoordinates: TRect;

    procedure SetMainWindowClientCoordinates(const Value: TRect);

    procedure NewChild(Sender: TObject);

  public

    { Public declarations }

    // property used to read MainForm client coordinates

    property MainWindowClientCoordinates: TRect

      read FMainWindowClientCoordinates write SetMainWindowClientCoordinates;

  end;

 

var

  MDIForm: TMDIForm; // Main form, property "formStyle" has to be fsMdiForm

 

implementation

 

{$R *.DFM}

 

uses

  Child; // Defines TMDIchild class, property "formStyle" has to be fsMdiChild

 

procedure TMDIForm.SetMainWindowClientCoordinates(const Value: TRect);

begin

  FMainWindowClientCoordinates := Value;

end;

 

procedure TMDIForm.SetMainWindowCoordinates(const Value: TRect);

begin

  FMainWindowCoordinates := Value;

end;

 

procedure TMDIForm.FormShow(Sender: TObject);

begin

  // Reads MDIForm client coordinates

  Windows.GetClientRect(ClientHandle, fMainWindowClientCoordinates);

end;

 

procedure TMDIForm.NewChild(Sender: TObject);

var

  LocalMDIChildForm: TMDIChildForm;

begin

  // You can execute this procedure each time you

  // create a new child, for example you can call this

  // procedure from a button

  LocalMDIChildForm := TMDIChildForm.Create(Self);

  with LocalMDIChildForm do

  begin

    Caption := 'Child Form: ' + IntToStr(MDIChildCount);

    Top     := MainWindowClientCoordinates.Top;

    Left    := MainWindowClientCoordinates.Left;

    Width   := MainWindowClientCoordinates.Right;

    Height  := MainWindowClientCoordinates.Bottom;

    Show;

  end; // with ...

end;

 

end.

 

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

 

neoturk: ...Use the animatewindow function ?...

{

  The AnimateWindow function enables you to produce

  special effects when showing or hiding windows.

 

  Mit der AnimateWindow Funktion kann man spezielle Effekte

  erzeugen beim Zeigen, Unsichtbarmachen (hide) einer Form.

}

 

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  Form2.BringToFront;

  AnimateWindow(Form2.Handle, 3000, AW_BLEND);

  Form2.Show;

 {

  The 3. parameter can be one or more of the following values:

  Der 3. parameter kan folgende Werte annehmen:

 

  AW_BLEND : Uses a fade effect

  AW_SLIDE : Uses slide animation.

  AW_ACTIVATE : Activates the window

  AW_HIDE : Hides the window.

  AW_CENTER : Makes the window appear to collapse inward

  AW_HOR_POSITIVE : Animates the window from left to right.

  AW_HOR_NEGATIVE : Animates the window from right to left

  AW_VER_POSITIVE : Animates the window from top to bottom

  AW_VER_NEGATIVE : Animates the window from bottom to top

 }

end;

 

 

{

 

Requirements:

  Windows NT/2000/XP: Included in Windows 2000 and later.

  Windows 95/98/Me: Included in Windows 98 and later.

}

 

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

 

neoturk: ...Use the animatewindow function ?...

{

  The AnimateWindow function enables you to produce

  special effects when showing or hiding windows.

 

  Mit der AnimateWindow Funktion kann man spezielle Effekte

  erzeugen beim Zeigen, Unsichtbarmachen (hide) einer Form.

}

 

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  Form2.BringToFront;

  AnimateWindow(Form2.Handle, 3000, AW_BLEND);

  Form2.Show;

 {

  The 3. parameter can be one or more of the following values:

  Der 3. parameter kan folgende Werte annehmen:

 

  AW_BLEND : Uses a fade effect

  AW_SLIDE : Uses slide animation.

  AW_ACTIVATE : Activates the window

  AW_HIDE : Hides the window.

  AW_CENTER : Makes the window appear to collapse inward

  AW_HOR_POSITIVE : Animates the window from left to right.

  AW_HOR_NEGATIVE : Animates the window from right to left

  AW_VER_POSITIVE : Animates the window from top to bottom

  AW_VER_NEGATIVE : Animates the window from bottom to top

 }

end;

 

 

{

 

Requirements:

  Windows NT/2000/XP: Included in Windows 2000 and later.

  Windows 95/98/Me: Included in Windows 98 and later.

}

 

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

 

neoturk: ...Add several forms to taskbar-task manager ?...

{

  By default, when you create the application in Delphi, in Windows Task

  Manager will be included a main form handle only. If you want to add the additional

  form, you must override the CreateParams procedure:

}

 

{

  Standardmässig wenn eine Anwendung in Delphi erstellt wird, so wird nur das Haupt

  Formular im Windows Task Manager angezeigt. Wenn auch andere Formulare im Task

  Manager angezeigt werden sollen, muss deren CreateParams Prozedur überschrieben

  werden.

}

 

{....}

 

type

  TForm2 = class(TForm)

  protected

    procedure CreateParams(var Params: TCreateParams); override;

  end;

 

  {....}

 

implementation

 

{....}

 

procedure TForm2.CreateParams(var Params: TCreateParams);

begin

  inherited;

  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;

end;

 

 

 

// To Show a Form in the taskbar anytime:

 

SetWindowLong(FromX.Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);

 

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

 

neoturk: ...Add several forms to taskbar-task manager ?...

{

  By default, when you create the application in Delphi, in Windows Task

  Manager will be included a main form handle only. If you want to add the additional

  form, you must override the CreateParams procedure:

}

 

{

  Standardmässig wenn eine Anwendung in Delphi erstellt wird, so wird nur das Haupt

  Formular im Windows Task Manager angezeigt. Wenn auch andere Formulare im Task

  Manager angezeigt werden sollen, muss deren CreateParams Prozedur überschrieben

  werden.

}

 

{....}

 

type

  TForm2 = class(TForm)

  protected

    procedure CreateParams(var Params: TCreateParams); override;

  end;

 

  {....}

 

implementation

 

{....}

 

procedure TForm2.CreateParams(var Params: TCreateParams);

begin

  inherited;

  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;

end;

 

 

 

// To Show a Form in the taskbar anytime:

 

SetWindowLong(FromX.Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);

 

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

 

neoturk: ...Use visual styles from xp in the own application ?...

{

  To benefit from the new look and feel (Visual Styles) for the Windows XP

  environment, you must include a Manifest in your application.

  (Either as resource or as file in the same directory where your application

  resides)

 

  The manifest is a XML document. It will allow Windows XP to decide which

  version of the comctl32.dll to use when binding.

  The XML document contains information about the application you are

  writing as well as information concerning the version of the comctl32.dll to use.

 

  The following instruction shows how to

   * create the manifest document

   * create the XP resource file

   * include the file in your application

 

  The steps 1-4 show how to create the files.

  You can also download the manifest and resource file from the

  Demo-download.

 

}

 

{

  Damit eine Anwendung das neue Look-and-Feel (Visual Styles) von Windows XP

  annimmt, muss eine Manifest Datei in der Applikation enthalten sein.

  (Entweder als Ressource oder im gleichen Verzeichnis, wo sich die Applikation

  befindet)

 

  Das Manifest ist ein XML Dokument.

  Wenn Windows dieses in einer EXE Datei vorfindet, wird automatisch die Version 6

  von comctl32.dll geladen und die Controls erscheinen im XP Design.

 

  Die Folgende Anleitung zeigt, wie man

  * das manifest Dokument erstellt

  * die Ressourcen Datei erstellt

  * die Ressource in die Anwendung einbindet.

 

  Das Manifest und die Ressourcen Datei können auch über das "Demo-Download" heruntergeladen

  werden. Dann können die Schritte 1-4 ausgelassen werden.

}

 

 

{1)

  Copy this sample manifest and paste it into notepad or any text editor.

  Kopiere das Beispiel Manifest und füge es in einen Texteditor ein (z.B Notepad}

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

    version="1.0.0.0"

    processorArchitecture="X86"

    name="CompanyName.ProductName.MyProgram"

    type="win32"

/>

<description>Your Application Description</description>

<dependency>

    <dependentAssembly>

        <assemblyIdentity

            type="win32"

            name="Microsoft.Windows.Common-Controls"

            version="6.0.0.0"

            processorArchitecture="X86"

            publicKeyToken="6595b64144ccf1df"

            language="*"

        />

    </dependentAssembly>

</dependency>

</assembly>

 

{2)

  To customize to fit your application, replace "name" from assemblyIdentity and the

  "description" string with your own data. Then save the file as WinXP.manifest

 

  Ändere im Manifest den "name" von assemblyIdentity und die

  "description" mit eigenen Angaben. Speichere das Manifest als WinXP.manifest}

 

{3)

  Create another file which contains instructions to include the

  WinXP.manifest (XML) document.

  The contents of the WinXP.rc looks like this:

 

  Erstelle eine weitere Datei, welche die Instruktionen zur Erstellung

  der Ressourcen Datei enthält.

  Der Inhalt von WinXP.rc schaut so aus:}

 

 

  1 24 "WinXP.manifest"

 

 

{4)

 

  Now we need to use Delphi's resource compiler (brcc32.exe) to compile the WinXP.rc file.

  Doing so will result in a WinXP.res

  From the command line, type the following:

 

  Compilire nun mit Borland's Resource Compiler (brcc32.exe),

  die Datei WinXP.rc. Es wird dann eine WinXP.res Datei erstellt.

  Gibt im MS-DOS Prompt, im Verzeichnis wo sich WinXP.rc befindet, nun folgendes ein:}

 

  brcc32 WinXP.rc

 

 

(*5)

  Now include the resource in your application.

  Include the following compiler directive:

  immediately after {$R *.DFM}:

 

  Nun muss noch eine Compiler Directive dem Sourcecode hinzugefügt werden.

  Der Eintrag sollte unmittelbar nach der Form Directive {$R *.DFM} folgen,

  so wie hier:*)

 

  {$R WinXP.res}

 

 

{6)

  Compile your application and run it!

  Compiliere die Anwendung und starte sie!}

 

 

{7)

  Test it if it runs correctly.

  Note that some controls don't adapt the new XP design such

  as TGroupBox, TSpeedButton and some others.

  If you use the TListView component with the view style of vsReport, have a look at this tip:

 

  Überprüf nun, ob die Anwendung korrekt läuft. Einige Controls nehmen das neue XP Design

  nicht an (TGroupBox, TSpeedButton und andere)

  Bei der ListView mit vsReport Style muss dies beachtet werden:

}

 

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

 

neoturk: ...Use visual styles from xp in the own application ?...

{

  To benefit from the new look and feel (Visual Styles) for the Windows XP

  environment, you must include a Manifest in your application.

  (Either as resource or as file in the same directory where your application

  resides)

 

  The manifest is a XML document. It will allow Windows XP to decide which

  version of the comctl32.dll to use when binding.

  The XML document contains information about the application you are

  writing as well as information concerning the version of the comctl32.dll to use.

 

  The following instruction shows how to

   * create the manifest document

   * create the XP resource file

   * include the file in your application

 

  The steps 1-4 show how to create the files.

  You can also download the manifest and resource file from the

  Demo-download.

 

}

 

{

  Damit eine Anwendung das neue Look-and-Feel (Visual Styles) von Windows XP

  annimmt, muss eine Manifest Datei in der Applikation enthalten sein.

  (Entweder als Ressource oder im gleichen Verzeichnis, wo sich die Applikation

  befindet)

 

  Das Manifest ist ein XML Dokument.

  Wenn Windows dieses in einer EXE Datei vorfindet, wird automatisch die Version 6

  von comctl32.dll geladen und die Controls erscheinen im XP Design.

 

  Die Folgende Anleitung zeigt, wie man

  * das manifest Dokument erstellt

  * die Ressourcen Datei erstellt

  * die Ressource in die Anwendung einbindet.

 

  Das Manifest und die Ressourcen Datei können auch über das "Demo-Download" heruntergeladen

  werden. Dann können die Schritte 1-4 ausgelassen werden.

}

 

 

{1)

  Copy this sample manifest and paste it into notepad or any text editor.

  Kopiere das Beispiel Manifest und füge es in einen Texteditor ein (z.B Notepad}

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

    version="1.0.0.0"

    processorArchitecture="X86"

    name="CompanyName.ProductName.MyProgram"

    type="win32"

/>

<description>Your Application Description</description>

<dependency>

    <dependentAssembly>

        <assemblyIdentity

            type="win32"

            name="Microsoft.Windows.Common-Controls"

            version="6.0.0.0"

            processorArchitecture="X86"

            publicKeyToken="6595b64144ccf1df"

            language="*"

        />

    </dependentAssembly>

</dependency>

</assembly>

 

{2)

  To customize to fit your application, replace "name" from assemblyIdentity and the

  "description" string with your own data. Then save the file as WinXP.manifest

 

  Ändere im Manifest den "name" von assemblyIdentity und die

  "description" mit eigenen Angaben. Speichere das Manifest als WinXP.manifest}

 

{3)

  Create another file which contains instructions to include the

  WinXP.manifest (XML) document.

  The contents of the WinXP.rc looks like this:

 

  Erstelle eine weitere Datei, welche die Instruktionen zur Erstellung

  der Ressourcen Datei enthält.

  Der Inhalt von WinXP.rc schaut so aus:}

 

 

  1 24 "WinXP.manifest"

 

 

{4)

 

  Now we need to use Delphi's resource compiler (brcc32.exe) to compile the WinXP.rc file.

  Doing so will result in a WinXP.res

  From the command line, type the following:

 

  Compilire nun mit Borland's Resource Compiler (brcc32.exe),

  die Datei WinXP.rc. Es wird dann eine WinXP.res Datei erstellt.

  Gibt im MS-DOS Prompt, im Verzeichnis wo sich WinXP.rc befindet, nun folgendes ein:}

 

  brcc32 WinXP.rc

 

 

(*5)

  Now include the resource in your application.

  Include the following compiler directive:

  immediately after {$R *.DFM}:

 

  Nun muss noch eine Compiler Directive dem Sourcecode hinzugefügt werden.

  Der Eintrag sollte unmittelbar nach der Form Directive {$R *.DFM} folgen,

  so wie hier:*)

 

  {$R WinXP.res}

 

 

{6)

  Compile your application and run it!

  Compiliere die Anwendung und starte sie!}

 

 

{7)

  Test it if it runs correctly.

  Note that some controls don't adapt the new XP design such

  as TGroupBox, TSpeedButton and some others.

  If you use the TListView component with the view style of vsReport, have a look at this tip:

 

  Überprüf nun, ob die Anwendung korrekt läuft. Einige Controls nehmen das neue XP Design

  nicht an (TGroupBox, TSpeedButton und andere)

  Bei der ListView mit vsReport Style muss dies beachtet werden:

}

 

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

 

neoturk: ...Show a second form with a active title bar ?...

{

  To show a from/window with an active titlebar, send a WM_NCACTIVATE message to it.

 

  Um eine Form mit aktiver Titelleiste anzuzeigen, kann ihr eine WM_NCACTIVATE

  Nachricht geschickt werden.

}

 

procedure TForm2.FormActivate(Sender: TObject);

begin

  SendMessage(Application.MainForm.Handle, WM_NCACTIVATE, Boolean(True), 0);

end;

 

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

 

neoturk: ...Show a second form with a active title bar ?...

{

  To show a from/window with an active titlebar, send a WM_NCACTIVATE message to it.

 

  Um eine Form mit aktiver Titelleiste anzuzeigen, kann ihr eine WM_NCACTIVATE

  Nachricht geschickt werden.

}

 

procedure TForm2.FormActivate(Sender: TObject);

begin

  SendMessage(Application.MainForm.Handle, WM_NCACTIVATE, Boolean(True), 0);

end;

 

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

 

neoturk: ...Determine whether a window is 'topmost' ?...

function IsWindowTopMost(hWindow: HWND): Boolean;

begin

  Result := (GetWindowLong(hWindow, GWL_EXSTYLE) and WS_EX_TOPMOST) <> 0

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if isWindowTopMost(FindWindow('notepad', nil)) then

    Label1.Caption := 'Window ist topmost'

  else

    Label1.Caption := 'Window ist not topmost';

end;

 

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

 

neoturk: ...Determine whether a window is 'topmost' ?...

function IsWindowTopMost(hWindow: HWND): Boolean;

begin

  Result := (GetWindowLong(hWindow, GWL_EXSTYLE) and WS_EX_TOPMOST) <> 0

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if isWindowTopMost(FindWindow('notepad', nil)) then

    Label1.Caption := 'Window ist topmost'

  else

    Label1.Caption := 'Window ist not topmost';

end;

 

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

 

neoturk: ...Disable a form movement ?...

{....}

 

  private

    procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;

 

{....}

 

procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);

begin

  inherited;

 

  with Message do

  begin

    if Result = HTCAPTION then

      Result := HTNOWHERE;

  end;

end;

 

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

 

neoturk: ...Disable a form movement ?...

{....}

 

  private

    procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;

 

{....}

 

procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);

begin

  inherited;

 

  with Message do

  begin

    if Result = HTCAPTION then

      Result := HTNOWHERE;

  end;

end;

 

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

 

neoturk: ...Disable a menuitem without greying it ?...

procedure TForm1.Button1Click(Sender: TObject);

var

  M: TMenu;

begin

  M := Application.MainForm.Menu;

  // Den ersten Menueintrag deaktivieren

  // The first Item will be disabled

  EnableMenuItem(M.Handle, M.Items[0].Command, MF_BYCOMMAND or MF_DISABLED);

end;

 

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

 

neoturk: ...Disable a menuitem without greying it ?...

procedure TForm1.Button1Click(Sender: TObject);

var

  M: TMenu;

begin

  M := Application.MainForm.Menu;

  // Den ersten Menueintrag deaktivieren

  // The first Item will be disabled

  EnableMenuItem(M.Handle, M.Items[0].Command, MF_BYCOMMAND or MF_DISABLED);

end;

 

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

 

neoturk: ...Get the active twincontrol under the mouse cursor ?...

{ Sie können z.B diese Funktion in einer allgemein gültigen

  Prozedure aufrufen, die Sie dann allen betroffenen Ereignisse

  zuweisen. }

 

{ You may call this function in a global event procedure,

  linking as many components events to it as you need. }

 

function FindControlAtPos: TWinControl;

var

  Pt: TPoint;

begin

  GetCursorPos(Pt);

  Result := FindControl(WindowFromPoint(Pt));

end;

 

 

{ (Beispiel) Hier die allgemein gültige Procedure für OnMouseUp.

  Die Behandlung von OnClick bleibt dabei erhalten:

  die Funktionalität aus OnMouseUp kommt dazu. }

 

{ (example) There's the global proc for the OnMouseUp event.

  Note: OnClick keeps working, so you can "add" the OnMouseUp

  facility to no cost. }

 

procedure TForm1.GenericMouseUp(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

var

  TWC: TWinControl;

begin

  TWC := FindControlAtPos;

  //what for a class !

  Showmessage('Here we are: ' + TWC.ClassName);

  //Let it blink...

  TWC.Visible := False;

  Sleep(150);

  TWC.Visible := True;

end;

 

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

 

neoturk: ...Get the active twincontrol under the mouse cursor ?...

{ Sie können z.B diese Funktion in einer allgemein gültigen

  Prozedure aufrufen, die Sie dann allen betroffenen Ereignisse

  zuweisen. }

 

{ You may call this function in a global event procedure,

  linking as many components events to it as you need. }

 

function FindControlAtPos: TWinControl;

var

  Pt: TPoint;

begin

  GetCursorPos(Pt);

  Result := FindControl(WindowFromPoint(Pt));

end;

 

 

{ (Beispiel) Hier die allgemein gültige Procedure für OnMouseUp.

  Die Behandlung von OnClick bleibt dabei erhalten:

  die Funktionalität aus OnMouseUp kommt dazu. }

 

{ (example) There's the global proc for the OnMouseUp event.

  Note: OnClick keeps working, so you can "add" the OnMouseUp

  facility to no cost. }

 

procedure TForm1.GenericMouseUp(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

var

  TWC: TWinControl;

begin

  TWC := FindControlAtPos;

  //what for a class !

  Showmessage('Here we are: ' + TWC.ClassName);

  //Let it blink...

  TWC.Visible := False;

  Sleep(150);

  TWC.Visible := True;

end;

 

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

 

neoturk: ...Change a hint's font ?...

{

  When the application displays a Help Hint,

  it creates an instance of HintWindowClass to represent

  the window used for displaying the hint.

  Applications can customize this window by creating a

  descendant of THintWindow and assigning it to the

  HintWindowClass variable at application startup.

}

 

type

  TMyHintWindow = class(THintWindow)

    constructor Create(AOwner: TComponent); override;

  end;

 

 

implementation

 

{....}

 

constructor TMyHintWindow.Create(AOwner: TComponent);

begin

  inherited Create(AOwner);

  with Canvas.Font do

  begin

    Name := 'Arial';

    Size := Size + 5;

    Style := [fsBold];

  end;

end;

 

procedure TForm2.FormCreate(Sender: TObject);

begin

  HintWindowClass := TMyHintWindow;

  Application.ShowHint := False;

  Application.ShowHint := True;

end;

 

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

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