IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants VCL Delphi Discussion :

Redimensionnement dynamique des fiches et des contrôles


Sujet :

Composants VCL Delphi

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Octobre 2006
    Messages
    1
    Détails du profil
    Informations forums :
    Inscription : Octobre 2006
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Redimensionnement dynamique des fiches et des contrôles
    Bonjour,

    J'ai besoin d'une explication ou un exemple de code pour effectuer un redimensionnement dynamiques des contrôles de ma fiche VCL.

    Je souhaite qu'en fonction des différentes résolutions d'écrans ma fiche puisse afficher ses contrôles (Boutons, Edit, Label, etc) de manière proportionné.

    Merci pour toute info utile et je suis à votre dispo pour tout complément d'infos à ma requête.

    * J'utilise Rad Studio XE6

  2. #2
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 459
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 459
    Points : 24 873
    Points
    24 873
    Par défaut
    Soit tu utlises Top, Left, Width et Heigth
    Soit d'un coup via SetBounds
    mais mieux utilise Anchors et Align et c'est la VCL qui le fera automatiquement
    Si tes Align sont bien géré, tu peux utiliser ScaleBy pour faire un zoom,
    je fais cela pour prendre en compte le zoom vista (100, 125 ou 150)
    Mais je le faisais depuis au moins D6 sous WinXP via Delphi
    J'ai juste rendu le code compatible pour qu'il détecte le zoom OS

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
      TSliteFormZoom = record
      public
        class function BuildChangeZoomMenu(AMenuZoom: TMenuItem; ADefaultZoom: Integer = -1): Integer; static;
        class procedure Zoom(AForm: TForm); static;
        class procedure UnZoom(AForm: TForm); static;
        class function CurrentZoom(): Integer; static;
        class function HaveZoom(): Boolean; static;
      end;
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    { TSliteFormZoom }
     
    //------------------------------------------------------------------------------
    class function TSliteFormZoom.BuildChangeZoomMenu(AMenuZoom: TMenuItem; ADefaultZoom: Integer = -1): Integer;
    begin
      Result := TFormScaleSLTAssistant.BuildChangeZoomMenu(AMenuZoom, TFormScaleSLTAssistant.ZoomClickDefaultEventHandler, ADefaultZoom);
    end;
     
    //------------------------------------------------------------------------------
    class function TSliteFormZoom.CurrentZoom(): Integer;
    begin
      Result := TFormScaleSLTAssistant.CurrentZoom;
    end;
     
    //------------------------------------------------------------------------------
    class function TSliteFormZoom.HaveZoom(): Boolean;
    begin
      Result := TFormScaleSLTAssistant.CurrentZoom <> TFormScaleSLTAssistant.ReferenceZoom;
    end;
     
    //------------------------------------------------------------------------------
    class procedure TSliteFormZoom.UnZoom(AForm: TForm);
    begin
      TFormScaleSLTAssistant.CancelZoom(AForm);
    end;
     
    //------------------------------------------------------------------------------
    class procedure TSliteFormZoom.Zoom(AForm: TForm);
    begin
      TFormScaleSLTAssistant.ApplyCurrentZoom(AForm);
    end;
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
     
    //------------------------------------------------------------------------------
    (*                SoLuTions is an Versatile Library for Delphi                 -
     *                                                                             -
     *  Version alternative publiée sur "www.developpez.net"                       -
     *  Post : "ajuster la taille de l'image avec de la form"                      -
     *  Post Number : 3956247                                                      -
     *  Post URL = "http://www.developpez.net/forums/d676162/environnements-developpement/delphi/debutant/ajuster-taille-l-image-form/#post3956247"
     *                                                                             -
     *  Version alternative publiée sur "www.developpez.net"                       -
     *  Post : "Changement de résolution"                                          -
     *  Post Number : 3024532                                                      -
     *  Post URL = "http://www.developpez.net/forums/d503018/environnements-developpement/delphi/composants-vcl/changement-resolution/#post3024532"
     *                                                                             -
     *  Copyright ou © ou Copr. "SLT Solutions", (2006)                            -
     *  contributeur : ShaiLeTroll (2012) - Gestion des Styles sous C++BuilderXE2  -
     *  contributeur : ShaiLeTroll (2012) - Documentation Insight                  -
     *  contributeur : ShaiLeTroll (2014) - Traduction du code C++Builder vers DelphiXE2
     *                                                                             -
     * ShaiLeTroll@gmail.com                                                       -
     *                                                                             -
     * Ce logiciel est un programme informatique servant à aider les développeurs  -
     * Delphi avec une bibliothèque polyvalente, adaptable et fragmentable.        -
     *                                                                             -
     * Ce logiciel est régi par la licence CeCILL-C soumise au droit français et   -
     * respectant les principes de diffusion des logiciels libres. Vous pouvez     -
     * utiliser, modifier et/ou redistribuer ce programme sous les conditions      -
     * de la licence CeCILL-C telle que diffusée par le CEA, le CNRS et l'INRIA    -
     * sur le site "http://www.cecill.info".                                       -
     *                                                                             -
     * En contrepartie de l'accessibilité au code source et des droits de copie,   -
     * de modification et de redistribution accordés par cette licence, il n'est   -
     * offert aux utilisateurs qu'une garantie limitée.  Pour les mêmes raisons,   -
     * seule une responsabilité restreinte pèse sur l'auteur du programme,  le     -
     * titulaire des droits patrimoniaux et les concédants successifs.             -
     *                                                                             -
     * A cet égard  l'attention de l'utilisateur est attirée sur les risques       -
     * associés au chargement,  à l'utilisation,  à la modification et/ou au       -
     * développement et à la reproduction du logiciel par l'utilisateur étant      -
     * donné sa spécificité de logiciel libre, qui peut le rendre complexe à       -
     * manipuler et qui le réserve donc à des développeurs et des professionnels   -
     * avertis possédant  des  connaissances  informatiques approfondies.  Les     -
     * utilisateurs sont donc invités à charger  et  tester  l'adéquation  du      -
     * logiciel à leurs besoins dans des conditions permettant d'assurer la        -
     * sécurité de leurs systèmes et ou de leurs données et, plus généralement,    -
     * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.          -
     *                                                                             -
     * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez      -
     * pris connaissance de la licence CeCILL-C, et que vous en avez accepté les   -
     * termes.                                                                     -
     *                                                                             -
     *----------------------------------------------------------------------------*)
    unit SLT.Controls.VCL.FormsEx;
     
    interface
     
    uses Winapi.Windows, Winapi.Messages,
      System.Classes, System.SysUtils,
      Vcl.Forms, Vcl.Themes, Vcl.Graphics, Vcl.GraphUtil, Vcl.Menus;
     
    type
      /// <summary>Style alternatif pour les TCustomForm affichant une image de fond</summary>
      /// <remarks>Le TSLTBackgroundFormStyleHook et TSLTBackgroundWindowHook sont totalement incompatible, les deux ne doivent pas cohabiter dans le même programme à cause du détournement sauvage de la WndProc
      /// <para>Le TSLTBackgroundFormStyleHook fourni un fond uniquement sur les thèmes VCL personnalisés mais par sur le thème système</para></remarks>
      /// <seealso href="https://theroadtodelphi.wordpress.com/2012/03/26/vcl-styles-adding-background-images-and-colors-to-delphi-forms">Variante plus récente par Rodrigo sur The Road to Delphi </seealso>
      /// <remarks><para>Le TSLTBackgroundFormStyleHook utilise le TSLTBackgroundFormDrawer datant de delphi 5 sans prise en compte des Styles VCL,
      /// il serait intéressant d'étudier le TFormStyleHookBackround de Rodrigo qui offre plus de fonctionnalité et respecte mieux la différence entre PaintNC et PaintBackground
      /// ce que je ne respecte pas pour l'ancien Hook TSLTBackgroundWindowHook et son option BackgroundOnTitle</para></remarks>
      TSLTBackgroundFormStyleHook = class(TFormStyleHook)
      private class var
        FBackground: TBitmap;
        FTransparent: Boolean;
        FTransparentOnDarkStyle: Boolean;
        FMainFormOnly: Boolean;
      private
        class procedure SetBackground(const Value: TBitmap); static;
      protected
        procedure PaintBackground(Canvas: TCanvas); override;
      public
        class constructor Create();
        class destructor Destroy();
     
        class property Background: TBitmap read FBackground write SetBackground;
        class property Transparent: Boolean read FTransparent write FTransparent;
        class property TransparentOnDarkStyle: Boolean read FTransparentOnDarkStyle write FTransparentOnDarkStyle;
        class property MainFormOnly: Boolean read FMainFormOnly write FMainFormOnly;
      end;
     
      /// <summary>STSLTBackgroundWindowHook affiche une image de fond</summary>
      /// <remarks>Le STSLTBackgroundWindowHook n'est pas un class helper car lors de sa création en 2002 sous Delphi 5, le code était procédural,
      /// lors de la refonte en classe en 2007, la version utilisée était Delphi 7, en s'inspirant du concept des Assistances de classes (Class Helper) du Delphi.NET</remarks>
      /// <remarks>Le TSLTBackgroundFormStyleHook et TSLTBackgroundWindowHook sont totalement incompatible, les deux ne doivent surtout pas cohabiter dans le même programme.
      /// <para>Le STSLTBackgroundWindowHook fourni un fond uniquement sur le thème système et NE supporte PAS que l'on change de style en cours de route</para></remarks>
      TSLTBackgroundWindowHook = class(TObject)
      private
        FForm: TForm;
        FBackground: TBitmap;
        FBackgroundOnTitle: Boolean;
        FNewWndProc : TFarProc; // Pointer ça serait pareil, c'est juste plus lisible
        FOldWndProc : TFarProc;
      private
        procedure FormWndProc(var Message: TMessage);
      public
        constructor Create(AForm: TForm);
        destructor Destroy(); override;
     
        procedure LoadBackgroundByResName(const ABackgroundResName: string);
     
        property Form: TForm read FForm;
        property BackgroundOnTitle: Boolean read FBackgroundOnTitle write FBackgroundOnTitle;
      end;
     
      TSLTBackgroundFormDrawer = class(TObject)
      private
        FBackground: TBitmap;
        FhDestDC: HDC;
        FDestWidth: Integer;
        FDestHeight: Integer;
        FSourceWidth: Integer;
        FSourceHeight: Integer;
        FTransparent: Boolean;
        FTransparentOnDarkStyle: Boolean;
        FStartOffSet: TPoint;
      private
        procedure BackGroungBlt();
        procedure TransparentBackGroungBlt();
      public
        constructor Create(ABackground: TBitmap; AFormSize: TSize; ACanvas: TCanvas);
     
        function EraseBackGround(): Boolean;
     
        property Transparent: Boolean read FTransparent write FTransparent;
        property TransparentOnDarkStyle: Boolean read FTransparentOnDarkStyle write FTransparentOnDarkStyle;
        property StartOffSet: TPoint read FStartOffSet write FStartOffSet;
      end;
     
      /// <summary>Assistance de la classe TForm, en particulier la Méthode ScaleBy</summary>
      /// <remarks>Le TFormScaleSLTAssistant n'est pas un class helper car lors de sa création la version utilisée était Delphi7 puis C++Builder2007
      /// Traduction C++Builder vers Delphi en concervant ce concept des Assistances de classes (Class Helper) du Delphi.NET</remarks>
      TFormScaleSLTAssistant = class(TObject)
      private
        class var FReferenceZoom: Integer;
        class var FCurrentZoom: Integer;
      public
        class constructor Create();
     
        /// <summary>BuildChangeZoomMenu ajoute comme menus enfants dans un TMenuItem listant plusieurs niveau de Zoom</summary>
        /// <param name="AMenuZoom">Menu dans lequel seront insérés comme sous-menu chaque niveau de zoom géré par l'application</param>
        /// <param name="AOnClick">Gestionnaire d'évèmenent commun à chaque sous-menu, le Tag permet de trouver le style concerné, il recommandé d'utiliser ZoomClickDefaultEventHandler</param>
        /// <param name="ADefaultZoom">Zoom fixé à l'origine</param>
        /// <returns>Zoom actuel</returns>
        class function BuildChangeZoomMenu(AMenuZoom: TMenuItem; AOnClick: TNotifyEvent; ADefaultZoom: Integer = -1): Integer;
        class procedure ZoomClickDefaultEventHandler(Sender: TObject);
        class procedure ZoomAllForms(AZoom: Integer);
        class procedure ApplyCurrentZoom(AForm: TForm);
        class procedure CancelZoom(AForm: TForm);
     
        class property CurrentZoom: Integer read FCurrentZoom;
        class property ReferenceZoom: Integer read FReferenceZoom;
      end;
     
     
    implementation
     
    uses System.Math,
      SLT.Controls.VCL.GraphicsEx;
     
    { TSLTBackgroundFormStyleHook }
     
    //------------------------------------------------------------------------------
    class constructor TSLTBackgroundFormStyleHook.Create();
    begin
      FBackground := TBitmap.Create();
    end;
     
    //------------------------------------------------------------------------------
    class destructor TSLTBackgroundFormStyleHook.Destroy();
    begin
      FreeAndNil(FBackground);
    end;
     
    //------------------------------------------------------------------------------
    procedure TSLTBackgroundFormStyleHook.PaintBackground(Canvas: TCanvas);
    begin
      inherited PaintBackground(Canvas);
     
      if not FBackground.Empty and (not FMainFormOnly or (Form = Application.MainForm)) then
      begin
        with TSLTBackgroundFormDrawer.Create(FBackground, TSize.Create(Form.ClientWidth, Form.ClientHeight), Canvas) do
        try
          Transparent := Self.Transparent;
          TransparentOnDarkStyle := Self.TransparentOnDarkStyle;
          EraseBackGround();
        finally
          Free();
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    class procedure TSLTBackgroundFormStyleHook.SetBackground(const Value: TBitmap);
    begin
      FBackground.Assign(Value);
    end;
     
    { TSLTBackgroundWindowHook }
     
    //------------------------------------------------------------------------------
    constructor TSLTBackgroundWindowHook.Create(AForm: TForm);
    begin
      inherited Create();
     
      FForm := AForm;
    end;
     
    //------------------------------------------------------------------------------
    destructor TSLTBackgroundWindowHook.Destroy();
    begin
      if Assigned(FOldWndProc) and Assigned(FForm) and not (csDestroying in FForm.ComponentState) then
        SetWindowLong(FForm.Handle, GWL_WNDPROC, NativeInt(FOldWndProc));
     
      System.Classes.FreeObjectInstance(FNewWndProc);
      FNewWndProc := nil;
     
      FreeAndNil(FBackground);
     
      inherited Destroy();
    end;
     
    //------------------------------------------------------------------------------
    procedure TSLTBackgroundWindowHook.FormWndProc(var Message: TMessage);
    var
      HasHandled: Boolean;
     
      procedure EraseBackGround();
      var
        Canvas: TCanvas;
        CanvasSize: TSize;
        CanvasOffset: TPoint;
        CaptionWidth: Integer;
      begin
        if FBackgroundOnTitle then
          Message.Result := CallWindowProc(FOldWndProc, FForm.Handle, Message.Msg, Message.WParam, Message.LParam);
     
        if not FBackground.Empty then
        begin
          if FBackgroundOnTitle then
          begin
            Canvas := TCanvas.Create();
            Canvas.Handle := GetWindowDC(FForm.Handle); // récupère le Handle de la zone de dessin
            CaptionWidth := TFontSLTToolHelp.GetTextWidth(Form.Caption, Screen.CaptionFont) + TFontSLTToolHelp.GetTextWidth(' ', Screen.CaptionFont) * 3;
            CanvasOffset := TPoint.Create(GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CXSMSIZE) + CaptionWidth, 0);
            if CheckWin32Version(6, 0) and StyleServices.Enabled then
              CanvasSize := TSize.Create(Form.Width - (CanvasOffset.X + GetSystemMetrics(SM_CXMIN) - GetSystemMetrics(SM_CXSMICON)), FBackground.Height)
            else
              CanvasSize := TSize.Create(Form.Width - (CanvasOffset.X + GetSystemMetrics(SM_CXMIN) - GetSystemMetrics(SM_CXSMICON)), GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFIXEDFRAME));
          end
          else
          begin
            Canvas := FForm.Canvas;
            CanvasSize := TSize.Create(Form.ClientWidth, Form.ClientHeight);
            CanvasOffset := TPoint.Create(0, 0);
          end;
          try
            with TSLTBackgroundFormDrawer.Create(FBackground, CanvasSize, Canvas) do
            try
              StartOffSet := CanvasOffset;
              Transparent := FBackgroundOnTitle;
              HasHandled := EraseBackGround();
            finally
              Free();
            end;
          finally
            if FBackgroundOnTitle then
            begin
              ReleaseDC(FForm.Handle, Canvas.Handle); // relache le Handle de la zone de dessin
              Canvas.Free();
            end;
          end;
        end;
     
        Message.Result := 0;// renvoie un message nul pour pas que l'ancienne WindowProc "intervienne"
      end;
     
      procedure QueryNewPalette();
      var
        LocalHDC: HDC;
      begin
        if FBackgroundOnTitle then
          LocalHDC := GetWindowDC(FForm.Handle)
        else
          LocalHDC := GetDC(FForm.Handle); // récupère le Handle de la zone de dessin
        try
          SelectPalette(LocalHDC, FBackground.Palette, True);
          // récupère la palette de l'image que l'on a choisi pour fond
          RealizePalette(LocalHDC);// applique la palette
          InvalidateRect(FForm.Handle, nil, true); // provoque le raffraichissement de la zone de dessin
        finally
          ReleaseDC(FForm.Handle, LocalHDC); // relache le Handle de la zone de dessin
        end;
     
        Message.Result := 0; // renvoie un message nul pour pas que l'ancienne WindowProc "intervienne"
      end;
     
      procedure PaletteChanged();
      var
        LocalHDC: HDC;
      begin
        // si le Handle transmis par le message est différent du Handle de la fenêtre
        if (Message.WParam <> FForm.Handle) then
        begin
          if FBackgroundOnTitle then
            LocalHDC := GetWindowDC(FForm.Handle)
          else
            LocalHDC := GetDC(FForm.Handle); // récupère le Handle de la zone de dessin
          try
            SelectPalette(LocalHDC, FBackground.Palette, True);
            // récupère la palette de l'image que l'on a choisi pour fond
            RealizePalette(LocalHDC); // applique la palette
            UpdateColors(LocalHDC); // raffraichit les couleurs
          finally
            ReleaseDC(FForm.Handle, LocalHDC); // relache le Handle de la zone de dessin
          end;
        end;
     
        Message.Result := 0; // renvoie un message nul pour pas que l'ancienne WindowProc "intervienne"
      end;
     
    begin
      case Message.Msg of
        WM_ERASEBKGND: EraseBackGround();
        WM_QUERYNEWPALETTE: QueryNewPalette();
        WM_PALETTECHANGED: PaletteChanged();
      else
        case Message.Msg of
          WM_HSCROLL, WM_VSCROLL, WM_SIZE : InvalidateRect(FForm.Handle, nil, True);
        end;
     
        Message.Result := CallWindowProc(FOldWndProc, FForm.Handle, Message.Msg, Message.WParam, Message.LParam);
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TSLTBackgroundWindowHook.LoadBackgroundByResName(const ABackgroundResName: string);
    begin
      if not StyleServices.Enabled or StyleServices.IsSystemStyle then
      begin
        if ABackgroundResName <> '' then
        begin
          if not Assigned(FBackground) then
            FBackground := TBitmap.Create();
     
          if not Assigned(FNewWndProc) then
            FNewWndProc := System.Classes.MakeObjectInstance(FormWndProc);
     
          try
            FBackground.LoadFromResourceName(HInstance, ABackgroundResName);
            FOldWndProc := TFarProc(SetWindowLong(FForm.Handle, GWL_WNDPROC, NativeInt(FNewWndProc)));
          except
            if Assigned(FOldWndProc) then
              SetWindowLong(FForm.Handle, GWL_WNDPROC, NativeInt(FOldWndProc));
            FreeAndNil(FBackground);
          end;
        end
        else
        begin
          if Assigned(FOldWndProc) then
            SetWindowLong(FForm.Handle, GWL_WNDPROC, NativeInt(FOldWndProc));
     
          System.Classes.FreeObjectInstance(FNewWndProc);
          FNewWndProc := nil;
     
          FreeAndNil(FBackground);
        end;
      end;
    end;
     
    { TSLTBackgroundFormDrawer }
     
    //------------------------------------------------------------------------------
    constructor TSLTBackgroundFormDrawer.Create(ABackground: TBitmap; AFormSize: TSize; ACanvas: TCanvas);
    begin
      inherited Create();
     
      FBackground := ABackground; // Utilise la référence directement !
      FhDestDC := ACanvas.Handle;
      FDestWidth := AFormSize.Width;
      FDestHeight := AFormSize.Height;
      FSourceWidth := ABackground.Width;
      FSourceHeight := ABackground.Height;
    end;
     
    //------------------------------------------------------------------------------
    procedure TSLTBackgroundFormDrawer.BackGroungBlt();
    var
      hSourceDC: HDC;
      X, Y, RX, RY, W, H: Integer;
    begin
      hSourceDC := FBackground.Canvas.Handle;
     
      X := FStartOffSet.X;
      RX := FDestWidth;
      while RX > 0 do
      begin
        W := FSourceWidth;
        if RX < FSourceWidth then
          W := RX;
     
        Y := FStartOffSet.Y;
        RY := FDestHeight;
        while RY > 0 do
        begin
          H := FSourceHeight;
          if RY < FSourceHeight then
            H := RY;
     
          BitBlt(FhDestDC, X, Y, W, H, hSourceDC, 0, 0, SRCCOPY); // Copie l'image sur le "fond" de la zone client
     
          Inc(Y, FSourceHeight);
          Dec(RY, FSourceHeight);
        end;
        Inc(X, FSourceWidth);
        Dec(RX, FSourceWidth);
      end;
    end;
     
    //------------------------------------------------------------------------------
    procedure TSLTBackgroundFormDrawer.TransparentBackGroungBlt();
    var
      hSourceDC: HDC;
      X, Y, RX, RY, W, H: Integer;
      TransparentColor: TColor;
    begin
      hSourceDC := FBackground.Canvas.Handle;
      TransparentColor := FBackground.TransparentColor;
     
      X := FStartOffSet.X;
      RX := FDestWidth;
      while RX > 0 do
      begin
        W := FSourceWidth;
        if RX < FSourceWidth then
          W := RX;
     
        Y := FStartOffSet.Y;
        RY := FDestHeight;
        while RY > 0 do
        begin
          H := FSourceHeight;
          if RY < FSourceHeight then
            H := RY;
     
          TransparentBlt(FhDestDC, X, Y, W, H, hSourceDC, 0, 0, W, H, TransparentColor); // Copie l'image sur le "fond" de la zone client
     
          Inc(Y, FSourceHeight);
          Dec(RY, FSourceHeight);
        end;
        Inc(X, FSourceWidth);
        Dec(RX, FSourceWidth);
      end;
    end;
     
    //------------------------------------------------------------------------------
    function TSLTBackgroundFormDrawer.EraseBackGround(): Boolean;
    var
      TransparentMode: Boolean;
      StyleColor: TColor;
      H, S, L, L2: Word;
    begin
      Result := False;
     
      if (FhDestDC <> 0) and (FDestWidth > 0) and (FDestHeight > 0) then
      begin
        SelectPalette(FhDestDC, FBackground.Palette, True);
        // récupère la palette de l'image que l'on a choisi pour fond
        RealizePalette(FhDestDC); // applique la palette
        // appelle la fonction "Affichage de l'image"
     
        TransparentMode := FTransparent;
        if not TransparentMode and FTransparentOnDarkStyle then
        begin
          StyleColor := StyleServices.GetStyleColor(scWindow); // semble la même couleur que scGenericBackground
          ColorRGBToHLS(ColorToRGB(StyleColor), H, L, S);
          ColorRGBToHLS(ColorToRGB(FBackground.TransparentColor), H, L2, S);
          TransparentMode := L + 24 < L2;
        end;
     
        if TransparentMode then
          TransparentBackGroungBlt()
        else
          BackGroungBlt();
     
        Result := True;
      end;
    end;
     
    { TFormScaleSLTAssistant }
     
    //------------------------------------------------------------------------------
    class procedure TFormScaleSLTAssistant.CancelZoom(AForm: TForm);
    begin
      if FCurrentZoom <> FReferenceZoom then
        AForm.ScaleBy(FReferenceZoom, FCurrentZoom);
    end;
     
    //------------------------------------------------------------------------------
    class constructor TFormScaleSLTAssistant.Create();
    begin
      FReferenceZoom := 100;
    end;
     
    //------------------------------------------------------------------------------
    class procedure TFormScaleSLTAssistant.ApplyCurrentZoom(AForm: TForm);
    begin
      if FCurrentZoom <> FReferenceZoom then
      begin
        AForm.ScaleBy(FCurrentZoom, FReferenceZoom);
     
        if AForm.Width > Screen.WorkAreaWidth then
          AForm.Width := Screen.WorkAreaWidth;
        if AForm.Height > Screen.WorkAreaHeight then
          AForm.Height := Screen.WorkAreaHeight;
     
        if AForm.Top + AForm.Height > Screen.WorkAreaHeight then
          AForm.Top := Max(Screen.WorkAreaHeight - AForm.Height, 0);
        if AForm.Left + AForm.Width > Screen.WorkAreaWidth then
          AForm.Left := Max(Screen.WorkAreaWidth - AForm.Width, 0);
      end;
    end;
     
    //------------------------------------------------------------------------------
    class function TFormScaleSLTAssistant.BuildChangeZoomMenu(AMenuZoom: TMenuItem; AOnClick: TNotifyEvent; ADefaultZoom: Integer = -1): Integer;
    var
      I: Integer;
      DPI, Pourcent: Integer;
      Sub: TMenuItem;
    begin
      AMenuZoom.AutoHotkeys := maManual;
      AMenuZoom.Clear();
     
      for I := 0 to 4 do
      begin
        DPI := 96 + I * 24;
        Pourcent := 100 + I * 25;
     
        Sub := TMenuItem.Create(AMenuZoom);
        AMenuZoom.Add(Sub);
        Sub.Tag := Pourcent;
        Sub.RadioItem := True;
        Sub.GroupIndex := 1;
        Sub.AutoHotkeys := maManual;
        Sub.Caption := IntToStr(Pourcent) + ' %';
     
        if CheckWin32Version(6, 0) and (Screen.PixelsPerInch = DPI) then
          FReferenceZoom := Pourcent;
     
        if ADefaultZoom in [100..200] then
        begin
          if ADefaultZoom = Pourcent then
          begin
            FCurrentZoom := Pourcent;
            Sub.Checked := True;
          end;
        end
        else
        begin
          if CheckWin32Version(6, 0) and (Screen.PixelsPerInch = DPI) then
          begin
            FCurrentZoom := Pourcent;
            Sub.Checked := True;
          end
          else
          begin
            if Pourcent = 100 then
            begin
              FCurrentZoom := Pourcent;
              Sub.Checked := True;
            end;
          end;
        end;
     
        Sub.OnClick := AOnClick;
      end;
     
      if AMenuZoom.Owner is TForm then
        ApplyCurrentZoom(TForm(AMenuZoom.Owner));
     
      Result := FCurrentZoom;
    end;
     
    //------------------------------------------------------------------------------
    class procedure TFormScaleSLTAssistant.ZoomAllForms(AZoom: Integer);
    var
      I, M, D: Integer;
    begin
      if AZoom in [100..200] then
      begin
        M := AZoom;
        D := FCurrentZoom;
        FCurrentZoom := M;
     
        for I := 0 to Screen.FormCount - 1 do
          Screen.Forms[I].ScaleBy(M, D);
     
        Application.BringToFront();
      end;
    end;
     
    //------------------------------------------------------------------------------
    class procedure TFormScaleSLTAssistant.ZoomClickDefaultEventHandler(Sender: TObject);
    begin
      if Sender is TMenuItem then
      begin
        TMenuItem(Sender).Checked := True;
        ZoomAllForms(TMenuItem(Sender).Tag);
      end;
    end;
     
    end.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
     
    //------------------------------------------------------------------------------
    (*                SoLuTions is an Versatile Library for Delphi                 -
     *                                                                             -
     *  Copyright ou © ou Copr. "SLT Solutions", (2006)                            -
     *  contributeur : ShaiLeTroll (2010) - Migration en C++Builder 2007           -
     *  contributeur : ShaiLeTroll (2012) - Renommage Fichier et Correction C++Builder XE2
     *  contributeur : ShaiLeTroll (2012) - Documentation Insight                  -
     *  contributeur : ShaiLeTroll (2014) - Reprise du TCanvasAssistant dans le TCanvasSLTAssistant
     *                                                                             -
     * ShaiLeTroll@gmail.com                                                       -
     *                                                                             -
     * Ce logiciel est un programme informatique servant à aider les développeurs  -
     * Delphi avec une bibliothèque polyvalente, adaptable et fragmentable.        -
     *                                                                             -
     * Ce logiciel est régi par la licence CeCILL-C soumise au droit français et   -
     * respectant les principes de diffusion des logiciels libres. Vous pouvez     -
     * utiliser, modifier et/ou redistribuer ce programme sous les conditions      -
     * de la licence CeCILL-C telle que diffusée par le CEA, le CNRS et l'INRIA    -
     * sur le site "http://www.cecill.info".                                       -
     *                                                                             -
     * En contrepartie de l'accessibilité au code source et des droits de copie,   -
     * de modification et de redistribution accordés par cette licence, il n'est   -
     * offert aux utilisateurs qu'une garantie limitée.  Pour les mêmes raisons,   -
     * seule une responsabilité restreinte pèse sur l'auteur du programme,  le     -
     * titulaire des droits patrimoniaux et les concédants successifs.             -
     *                                                                             -
     * A cet égard  l'attention de l'utilisateur est attirée sur les risques       -
     * associés au chargement,  à l'utilisation,  à la modification et/ou au       -
     * développement et à la reproduction du logiciel par l'utilisateur étant      -
     * donné sa spécificité de logiciel libre, qui peut le rendre complexe à       -
     * manipuler et qui le réserve donc à des développeurs et des professionnels   -
     * avertis possédant  des  connaissances  informatiques approfondies.  Les     -
     * utilisateurs sont donc invités à charger  et  tester  l'adéquation  du      -
     * logiciel à leurs besoins dans des conditions permettant d'assurer la        -
     * sécurité de leurs systèmes et ou de leurs données et, plus généralement,    -
     * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.          -
     *                                                                             -
     * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez      -
     * pris connaissance de la licence CeCILL-C, et que vous en avez accepté les   -
     * termes.                                                                     -
     *                                                                             -
     *----------------------------------------------------------------------------*)
    unit SLT.Controls.VCL.GraphicsEx;
     
    interface
     
    uses System.SysUtils, System.Classes,
      Vcl.Themes, Vcl.Graphics, Winapi.Windows;
     
    type
      /// <summary>Boite à outil pour la classe TFont </summary>
      /// <remarks>Le TFontSLTToolHelp n'est pas un class helper car lors de sa création la version utilisée était C++Builder 2007,
      /// Traduction C++Builder vers Delphi en concervant ce concept des Assistances de classes (Class Helper) du Delphi.NET</remarks>
      TFontSLTToolHelp = class(TObject)
      public
        // Méthodes Publiques
        class function GetTextWidth(const AText: string; AFont: TFont): Integer; static;
        class function GetTextHeight(const AText: string; AFont: TFont): Integer; static;
        class function GetTextSize(const AText: string; AFont: TFont): TSize; static;
      end;
     
      /// <summary>Erreur liée à l'assistant TCanvasSLTAssistant de la classe TCanvas</summary>
      ECanvasSLTAssistantError = class(Exception);
     
      /// <summary>Assistance de la classe TCanvas </summary>
      /// <remarks>Le TCanvasSLTToolHelp n'est pas un class helper car lors de sa création en 2002 sous Delphi 5, le code était procédural,
      /// lors de la refonte en classe en 2007 et 2014, la version utilisée était Delphi 7 puis Delphi XE2, en s'inspirant du concept des Assistances de classes (Class Helper) du Delphi.NET</remarks>
      TCanvasSLTAssistant = class(TObject)
      private
        // Membres privés
        FCanvas: TCanvas;
     
      public
        // Constructeurs
        constructor Create(ACanvas: TCanvas); overload;
        constructor Create(Sender: TObject); overload;
     
        // Méthodes de dessin personnalisé
     
        /// <summary>Dessine une case à cocher centré dans la zone définie par ARect</summary>
        /// <param name="ARect">Zone à dessiner</param>
        /// <param name="AChecked">Etat de la case à cocher</param>
        /// <param name="AEnabled">la case à cocher est-elle active</param>
        procedure DrawCheckBox(const ARect: TRect; AChecked: Boolean; AEnabled: Boolean = True);
     
        /// <summary>Tente de fournir une couleur avec un fort constrate, généralement une couleur quasi inverse</summary>
        /// <param name="AColor">Couleur de référence</param>
        /// <returns>Couleur a fort contraste</returns>
        class function GetConstratedColor(AColor: TColor): TColor; static;
     
        // Propriétés
        property Canvas: TCanvas read FCanvas;
     
      end;
     
    implementation
     
    uses Vcl.GraphUtil;
     
    const
      ERR_UNASSISTED_CLASS = 'La Classe d''Assistance %s ne prend pas en charge la classe %s mais la classe %s';
     
    { TFontSLTToolHelp }
     
    //------------------------------------------------------------------------------
    class function TFontSLTToolHelp.GetTextHeight(const AText: string; AFont: TFont): Integer;
    begin
      Result := GetTextSize(AText, AFont).cy;
    end;
     
    //------------------------------------------------------------------------------
    class function TFontSLTToolHelp.GetTextSize(const AText: string; AFont: TFont): TSize;
    var
      Len: Integer;
      DC: HDC;
      SaveFont: HFONT;
    begin
      ZeroMemory(@Result, SizeOf(Result));
      Len := Length(AText);
      if Len > 0 then
      begin
        DC := GetDC(0);
        try
          SaveFont := HFONT(SelectObject(DC, AFont.Handle));
          try
            GetTextExtentPoint32W(DC, PChar(AText), Len, Result);
          finally
            SelectObject(DC, SaveFont);
          end;
        finally
          ReleaseDC(0, DC);
        end;
      end;
    end;
     
    //------------------------------------------------------------------------------
    class function TFontSLTToolHelp.GetTextWidth(const AText: string; AFont: TFont): Integer;
    begin
      Result := GetTextSize(AText, AFont).cx;
    end;
     
    { TCanvasSLTAssistant }
     
    //------------------------------------------------------------------------------
    constructor TCanvasSLTAssistant.Create(ACanvas: TCanvas);
    begin
      inherited Create();
     
      FCanvas := ACanvas;
    end;
     
    //------------------------------------------------------------------------------
    constructor TCanvasSLTAssistant.Create(Sender: TObject);
    begin
      inherited Create();
     
      if Assigned(Sender) then
      begin
        if Sender is TCanvas then
          FCanvas := TCanvas(Sender)
        else
          raise ECanvasSLTAssistantError.CreateFmt(ERR_UNASSISTED_CLASS, [ClassName(), Sender.ClassName(), TCanvas.ClassName()]);
      end
      else
        raise ECanvasSLTAssistantError.CreateFmt(ERR_UNASSISTED_CLASS, [ClassName(), '[nil]', TCanvas.ClassName()])
    end;
     
    //------------------------------------------------------------------------------
    procedure TCanvasSLTAssistant.DrawCheckBox(const ARect: TRect; AChecked: Boolean; AEnabled: Boolean = True);
    var
      uState: UINT;
      tbState: TThemedButton;
      Details: TThemedElementDetails;
      Buffer: Vcl.Graphics.TBitmap;
      BufferRect: TRect;
    begin
      if StyleServices.Enabled then
      begin
        // Pour ne pas pertuber le Canvas en cours, utilisation d'un Tampon intermédiaire
        Buffer := Vcl.Graphics.TBitmap.Create();
        try
          BufferRect := Rect(0, 0, ARect.Width, ARect.Height);
          Buffer.SetSize(BufferRect.Width, BufferRect.Height);
     
          tbState := tbCheckBoxUncheckedNormal;
          if AChecked then
            tbState := tbCheckBoxCheckedNormal;
     
          if not AEnabled then
          begin
            if AChecked then
              tbState := tbCheckBoxCheckedDisabled
            else
              tbState := tbCheckBoxUncheckedDisabled;
          end;
     
          Details := StyleServices.GetElementDetails(tbState);
          StyleServices.DrawElement(Buffer.Canvas.Handle, Details, BufferRect, BufferRect);
          // Dessin final
          Canvas.Draw(ARect.Left, ARect.Top, Buffer);
        finally
          Buffer.Free();
        end;
      end
      else
      begin
        uState := DFCS_BUTTONCHECK;
        if AChecked then
          uState := uState or DFCS_CHECKED;
     
        if not AEnabled then
          uState := uState or DFCS_INACTIVE;
     
        Canvas.FillRect(ARect);
        DrawFrameControl(Canvas.Handle, ARect, DFC_BUTTON, uState);
      end;
    end;
     
    //------------------------------------------------------------------------------
    class function TCanvasSLTAssistant.GetConstratedColor(AColor: TColor): TColor;
    var
      H, S, L: Word;
    begin
      ColorRGBToHLS(ColorToRGB(AColor), H, L, S);
      if L > 120 then
      begin
        if L < 168 then
        begin
          if H < 140  then
            Result := clBlack // Foncé sur rouge, jaune et vert moyen
          else
            Result := clWhite // Clair sur bleu ou violet moyen
        end
        else
          Result := clBlack // Foncé sur Clair
      end
      else
        Result := clWhite; // Clair sur Foncé
    end;
     
     
     
    end.
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    62
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 62
    Points : 61
    Points
    61
    Par défaut S'adapter à la résolution de l'écran
    Nom : resolutions.jpg
Affichages : 946
Taille : 46,1 Ko

    Bonjour, j'ai fait un test avant de poster le code. ça marche très bien. Je pense que tu peux toujours améliorer le code.
    A+

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    interface
     
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;
     
    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Button1: TButton;
        Panel1: TPanel;
        Memo1: TMemo;
        procedure FormCreate(Sender: TObject);
        procedure FormResize(Sender: TObject);
      private
        { Déclarations privées }
        FrmWidth :Integer ;
      public
        { Déclarations publiques }
      end;
     
    var
      Form1: TForm1;
     
    implementation
    Type   // propriété font protégé
    TFClass = class(TControl);
     
    {$R *.dfm}
     
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    FrmWidth:=Width;
    Scaled:=true;
    end;
     
    procedure TForm1.FormResize(Sender: TObject);
    var
    i:Integer;
    begin
     Scaleby(Width,FrmWidth); //mettre les compos à la taille corespondant à la résolution et du ratio
     for I := ControlCount-1 Downto  0 do
     TFClass(Controls[I]).Font.Height :=
     (Width div  FrmWidth)*
     TFClass(Controls[I]).Font.Height; // adapter la police
     FrmWidth:=Width;
    end;
    end.

  4. #4
    Expert confirmé
    Avatar de Ph. B.
    Homme Profil pro
    Freelance
    Inscrit en
    Avril 2002
    Messages
    1 784
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2002
    Messages : 1 784
    Points : 5 915
    Points
    5 915
    Par défaut
    Bonjour,
    Citation Envoyé par 94340DB Voir le message
    Bonjour, j'ai fait un test avant de poster le code. ça marche très bien. Je pense que tu peux toujours améliorer le code.
    En particulier pour les contrôles qui sont eux-mêmes parents d'autres contrôles.
    C.a.d. un petit traitement récursif...
    Philippe.

Discussions similaires

  1. Réponses: 7
    Dernier message: 04/09/2010, 12h51
  2. Trigger pour mettre des droits sur des procedures et des vues
    Par briino dans le forum Développement
    Réponses: 3
    Dernier message: 23/09/2009, 09h44
  3. Réponses: 4
    Dernier message: 02/04/2008, 17h51
  4. Réponses: 3
    Dernier message: 13/09/2007, 18h11
  5. Réponses: 3
    Dernier message: 23/01/2007, 08h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo