Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

GraphicsTools.cs

Description du code

GraphicsTools.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System.Drawing;
  2. using System.Drawing.Drawing2D;
  3.  
  4. namespace be.gaudry.view.style
  5. {
  6. /// <summary>
  7. /// Provides tools for graphics processing
  8. /// </summary>
  9. /// <remarks>
  10. /// 2007 José Manuel Menéndez Poo
  11. /// Visit my blog for upgrades and other renderers - www.menendezpoo.com
  12. /// </remarks>
  13. internal static class GraphicsTools
  14. {
  15. /// <summary>
  16. /// Creates a rounded rectangle from the specified rectangle and radius
  17. /// </summary>
  18. /// <param name="rectangle">Base rectangle</param>
  19. /// <param name="radius">Radius of the corners</param>
  20. /// <returns>Rounded rectangle as a GraphicsPath</returns>
  21. public static GraphicsPath CreateRoundRectangle(Rectangle rectangle, int radius)
  22. {
  23. GraphicsPath path = new GraphicsPath();
  24.  
  25. int l = rectangle.Left;
  26. int t = rectangle.Top;
  27. int w = rectangle.Width;
  28. int h = rectangle.Height;
  29. int d = radius << 1;
  30.  
  31. path.AddArc(l, t, d, d, 180, 90); // topleft
  32. path.AddLine(l + radius, t, l + w - radius, t); // top
  33. path.AddArc(l + w - d, t, d, d, 270, 90); // topright
  34. path.AddLine(l + w, t + radius, l + w, t + h - radius); // right
  35. path.AddArc(l + w - d, t + h - d, d, d, 0, 90); // bottomright
  36. path.AddLine(l + w - radius, t + h, l + radius, t + h); // bottom
  37. path.AddArc(l, t + h - d, d, d, 90, 90); // bottomleft
  38. path.AddLine(l, t + h - radius, l, t + radius); // left
  39. path.CloseFigure();
  40.  
  41. return path;
  42. }
  43.  
  44. /// <summary>
  45. /// Creates a rectangle rounded on the top
  46. /// </summary>
  47. /// <param name="rectangle">Base rectangle</param>
  48. /// <param name="radius">Radius of the top corners</param>
  49. /// <returns>Rounded rectangle (on top) as a GraphicsPath object</returns>
  50. public static GraphicsPath CreateTopRoundRectangle(Rectangle rectangle, int radius)
  51. {
  52. GraphicsPath path = new GraphicsPath();
  53.  
  54. int l = rectangle.Left;
  55. int t = rectangle.Top;
  56. int w = rectangle.Width;
  57. int h = rectangle.Height;
  58. int d = radius << 1;
  59.  
  60. path.AddArc(l, t, d, d, 180, 90); // topleft
  61. path.AddLine(l + radius, t, l + w - radius, t); // top
  62. path.AddArc(l + w - d, t, d, d, 270, 90); // topright
  63. path.AddLine(l + w, t + radius, l + w, t + h); // right
  64. path.AddLine(l + w, t + h, l, t + h); // bottom
  65. path.AddLine(l, t + h, l, t + radius); // left
  66. path.CloseFigure();
  67.  
  68. return path;
  69. }
  70.  
  71. /// <summary>
  72. /// Creates a rectangle rounded on the bottom
  73. /// </summary>
  74. /// <param name="rectangle">Base rectangle</param>
  75. /// <param name="radius">Radius of the bottom corners</param>
  76. /// <returns>Rounded rectangle (on bottom) as a GraphicsPath object</returns>
  77. public static GraphicsPath CreateBottomRoundRectangle(Rectangle rectangle, int radius)
  78. {
  79. GraphicsPath path = new GraphicsPath();
  80.  
  81. int l = rectangle.Left;
  82. int t = rectangle.Top;
  83. int w = rectangle.Width;
  84. int h = rectangle.Height;
  85. int d = radius << 1;
  86.  
  87. path.AddLine(l + radius, t, l + w - radius, t); // top
  88. path.AddLine(l + w, t + radius, l + w, t + h - radius); // right
  89. path.AddArc(l + w - d, t + h - d, d, d, 0, 90); // bottomright
  90. path.AddLine(l + w - radius, t + h, l + radius, t + h); // bottom
  91. path.AddArc(l, t + h - d, d, d, 90, 90); // bottomleft
  92. path.AddLine(l, t + h - radius, l, t + radius); // left
  93. path.CloseFigure();
  94.  
  95. return path;
  96. }
  97. }
  98. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/style/vista/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1728171910 06/10/2024 01:45:10
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/style/vista/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csGraphicsTools.cs3.9 Ko31/10/2018 18:33:22-refusé-
Afficher le fichier .cs|.csWindowsVistaRenderer.cs26.15 Ko31/10/2018 18:33:22-refusé-
Afficher le fichier .cs|.csWindowsVistaColorTable.cs9.6 Ko31/10/2018 18:33:22-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 16/10/2009 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/cs-broldev-source-rf-view/style/vista/GraphicsTools.cs.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.