Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
fr:data_grid [2012/05/16 10:00] navy57 |
fr:data_grid [2012/10/09 09:20] (Version actuelle) darcybarron [Anatomie d'un contrôle personnalisé (grille de données simple)] |
||
---|---|---|---|
Ligne 2: | Ligne 2: | ||
--- //David MacDermot 2008/09/17 19:55// | --- //David MacDermot 2008/09/17 19:55// | ||
- | Cet article décrit comment créer un contrôle personnalisé dans Pelles C. Le contrôle dans ce cas est une grille de données, utilisant comme composant un affichage de liste "listview" et une zone d'édition "editbox" avec un certain nombre de personnalisations pour améliorer l'apparence du contrôle. | + | Cet article décrit comment créer un contrôle personnalisé dans Pelles C. Le contrôle dans ce cas est une grille de données, utilisant comme composant un affichage de liste "listview" et une zone d'édition "editbox" avec un certain nombre de personnalisations pour améliorer l'apparence du contrôle. [[http://termpaper.biz/buy-paper-online.php|buy admission essay]] |
===== Projet ===== | ===== Projet ===== | ||
Ligne 282: | Ligne 283: | ||
</code> | </code> | ||
- | Here I set a global pointer to the struct associated with this instance of the control and then free the structure when it is no longer needed. | + | Ici j'ai mis un pointeur vers la structure globale associée à cette instance du contrôle et alors libre de la structure quand il n'est plus nécessaire. |
<code c> static VOID Grid_OnDestroy(HWND hwnd) | <code c> static VOID Grid_OnDestroy(HWND hwnd) | ||
Ligne 296: | Ligne 297: | ||
</code> | </code> | ||
- | ===== Points of interest ===== | + | ===== Points d'intérêt ===== |
- | ====Custom drawing the listview ==== | + | |
+ | ====Dessin personnalisé d'une liste ==== | ||
- | All of the customization and drawing, of the grid’s components, is handled in the NM_CUSTOMDRAW notification of the list view, this includes skinning the header, something that normally one cannot do, but is possible because the header is subclassed. For a detailed tutorial about simple customizations using this method see [[http://www.codeproject.com/KB/list/lvcustomdraw.aspx|Neat Stuff to Do in List Controls Using Custom Draw]]. | + | Toutes les personnalisations et dessins des composants de la grille, sont gérées dans la notification NM_CUSTOMDRAW de la liste, ce qui inclut le dépouillement l'en-tête, quelque chose qui normalement ne peut pas ce faire, mais il est possible que parce que l'en-tête est sous-classée. Pour un tutoriel détaillé sur les personnalisations simples en utilisant cette méthode voir [[http://www.codeproject.com/KB/list/lvcustomdraw.aspx|Trucs sympa à faire dans la liste des contrôles à l'aide dessin personnalisé]]. |
<code c>LRESULT Grid_OnCustomDraw (HWND hwnd, LPNMLVCUSTOMDRAW lplvcd) | <code c>LRESULT Grid_OnCustomDraw (HWND hwnd, LPNMLVCUSTOMDRAW lplvcd) | ||
Ligne 505: | Ligne 507: | ||
</code> | </code> | ||
- | ====Scrolling==== | + | ====Défilement==== |
- | Getting the scrolling to work right in this control was a challenge. I would resize the grid columns so that the horizontal scrollbar appeared, scroll over, then resize the columns back to the initial size. This caused the scrollbar to disappear leaving the view shifted and some of the control not visible. | + | Obtenir le fonctionnement du contrôle du défilement en plein écrand fut un défi. Je voudrais redimensionner les colonnes de la grille de sorte que la barre de défilement horizontale apparaît, faires défiler l'écran, puis redimensionner les colonnes pour retourner à la taille initiale. Cela a provoqué la disparition de la barre de défilement en laissant le point de vue décalé et une partie du contrôle n'est plus visible. |
- | The solution was to persist the vertical and horizontal scroll info in the control so that it wasn't lost when the bars vanished. In the case of horizontal scrolling, the control pans to the origin if the size of the listview reduces to fit within the parent window. | + | La solution est de conserver l'information verticale et horizontale de défilement dans le contrôle de sorte qu'il n'a pas été perdu lorsque les barres disparu. Dans le cas de défilement horizontal, le contrôle casseroles à l'origine, si la taille de la liste réduit pour tenir dans la fenêtre apparentés. |
- | Vertical scrolling units reflect row height and horizontal units are set by the width of the first visible column. I find that this gives the control the smoothest scrolling behavior while avoiding widowed or orphaned rows. Especially when navigating the control from the keyboard. | + | Unités de défilement verticales reflètent la hauteur des lignes et des unités horizontales qui sont fixées par la largeur de la première colonne visible. Je trouve que cela donne le contrôle du comportement plus doux de défilement tout en évitant les lignes veuves ou orphelins. Surtout lorsque vous naviguez dans le contrôle à partir du clavier. |
- | Horizontal scrolling: | + | Le défilement horizontale: |
<code c>void Grid_OnHScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) | <code c>void Grid_OnHScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) | ||
Ligne 573: | Ligne 575: | ||
</code> | </code> | ||
- | Vertical scrolling: | + | Le défilement vertical: |
<code c>static VOID Grid_OnVScroll(HWND hwnd, HWND hwndCtl, UINT code, INT pos) | <code c>static VOID Grid_OnVScroll(HWND hwnd, HWND hwndCtl, UINT code, INT pos) |