Accueil > > > LISTER LES COULEURS WEB GRACE A LA REFLEXION
LISTER LES COULEURS WEB GRACE A LA REFLEXION
Information sur la source
Description
genere un panel avec toutes les couleurs et leur nom en se servant de la recuperation du type : Private oT As Type = System.Drawing.Color.Beige.GetType ici n'importe quelle couleur (beige) fait l'affaire
Source
- -------------------------------------------------------------------------------------------
- ------------------------------------- couleur.aspx -------------------------------------
- -------------------------------------------------------------------------------------------
-
- <%@ Page Language="vb" Codebehind="couleurs. vb" Inherits="ymages.couleur"%>
- <html>
- <body>
- <form id="frm" method="post" runat="server">
- <asp:PlaceHolder id="pl_couleur" runat="server" />
- </form>
- </body>
- </html>
-
- -------------------------------------------------------------------------------------------
- --------------------------------------- couleur.vb --------------------------------------
- -------------------------------------------------------------------------------------------
-
- Public Class couleur
-
- Protected WithEvents pl_couleur As PlaceHolder
-
- Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
-
- Dim mcoul As New TableauCouleurs()
- pl_couleur.Controls.Add(mcoul.DisplayCouleurs)
-
- End Sub
-
- End Class
-
- Public Class TableauCouleurs
-
- #Region " variables "
-
- Private _Colonnes As Int32
- Private _Font As String
-
- Const nbCoul As Int32 = 141
- Const LargCoulPercent As Int32 = 4
-
- Private oT As Type = System.Drawing.Color.Beige.GetType
- Private oProperties() As System.Reflection.PropertyInfo = oT.GetProperties
- Private oP As System.Reflection.PropertyInfo
-
- #End Region
-
- #Region " constructeurs "
-
- Sub New()
-
- MyBase.new()
- _Colonnes = 5
- _Font = "courier new"
-
- End Sub
-
- #End Region
-
- #Region " proprietes "
-
- Public Property Font() As String
- Get
- Return _Font
- End Get
- Set(ByVal Value As String)
- _Font = Value
- End Set
- End Property
-
- Public Property Colonnes() As Int32
- Get
- Return _Colonnes
- End Get
- Set(ByVal Value As Int32)
- _Colonnes = Value
- End Set
- End Property
-
- #End Region
-
- #Region " methodes "
-
- Public Function DisplayCouleurs() As Panel
-
- Dim pn As New Panel()
-
- pn.Width = Unit.Percentage(100)
- pn.Height = Unit.Percentage(100)
-
- Dim nbParCol As Int32 = CType((nbCoul / Colonnes), Int32)
-
- Dim TexteLarge As Int32 = (CType((100 / Colonnes), Int32)) - LargCoulPercent
- Dim TexteHaut As Int32 = (CType((100 / nbParCol), Int32)) - 1
-
- For Each oP In oProperties
-
- If oP.CanRead Then
- Try
- Dim lblC As New Label()
- Dim lblT As New Label()
-
- With lblT
- .Text = oP.Name
- .Width = Unit.Percentage(TexteLarge)
- .Height = Unit.Percentage(TexteHaut)
- With .Style
- .Add("text-align", "right")
- .Add("padding-right", "8px")
- .Add("margin-bottom", "1px")
- .Add("font-size", "8pt")
- .Add("font-family", Font)
- End With
- End With
-
- With lblC
- .Text = ""
- .Width = Unit.Percentage(LargCoulPercent)
- .Height = Unit.Percentage(TexteHaut)
- .BackColor = CType(oP.GetValue(oT, Nothing), Color)
- .ToolTip = (CType(oP.GetValue(oT, Nothing), Color)).ToString + " / " + CType(oP.GetValue(oT, Nothing), Color).ToArgb.ToString
- With .Style
- .Add("margin-bottom", "1px")
- .Add("border", "1px solid black")
- End With
- End With
-
- pn.Controls.Add(lblT)
- pn.Controls.Add(lblC)
-
- Catch ex As Exception
- End Try
- End If
- Next
-
- Return pn
-
- End Function
-
-
- #End Region
-
- End Class
-
- -------------------------------------------------------------------------------------------
-
-------------------------------------------------------------------------------------------
------------------------------------- couleur.aspx -------------------------------------
-------------------------------------------------------------------------------------------
<%@ Page Language="vb" Codebehind="couleurs. vb" Inherits="ymages.couleur"%>
<html>
<body>
<form id="frm" method="post" runat="server">
<asp:PlaceHolder id="pl_couleur" runat="server" />
</form>
</body>
</html>
-------------------------------------------------------------------------------------------
--------------------------------------- couleur.vb --------------------------------------
-------------------------------------------------------------------------------------------
Public Class couleur
Protected WithEvents pl_couleur As PlaceHolder
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim mcoul As New TableauCouleurs()
pl_couleur.Controls.Add(mcoul.DisplayCouleurs)
End Sub
End Class
Public Class TableauCouleurs
#Region " variables "
Private _Colonnes As Int32
Private _Font As String
Const nbCoul As Int32 = 141
Const LargCoulPercent As Int32 = 4
Private oT As Type = System.Drawing.Color.Beige.GetType
Private oProperties() As System.Reflection.PropertyInfo = oT.GetProperties
Private oP As System.Reflection.PropertyInfo
#End Region
#Region " constructeurs "
Sub New()
MyBase.new()
_Colonnes = 5
_Font = "courier new"
End Sub
#End Region
#Region " proprietes "
Public Property Font() As String
Get
Return _Font
End Get
Set(ByVal Value As String)
_Font = Value
End Set
End Property
Public Property Colonnes() As Int32
Get
Return _Colonnes
End Get
Set(ByVal Value As Int32)
_Colonnes = Value
End Set
End Property
#End Region
#Region " methodes "
Public Function DisplayCouleurs() As Panel
Dim pn As New Panel()
pn.Width = Unit.Percentage(100)
pn.Height = Unit.Percentage(100)
Dim nbParCol As Int32 = CType((nbCoul / Colonnes), Int32)
Dim TexteLarge As Int32 = (CType((100 / Colonnes), Int32)) - LargCoulPercent
Dim TexteHaut As Int32 = (CType((100 / nbParCol), Int32)) - 1
For Each oP In oProperties
If oP.CanRead Then
Try
Dim lblC As New Label()
Dim lblT As New Label()
With lblT
.Text = oP.Name
.Width = Unit.Percentage(TexteLarge)
.Height = Unit.Percentage(TexteHaut)
With .Style
.Add("text-align", "right")
.Add("padding-right", "8px")
.Add("margin-bottom", "1px")
.Add("font-size", "8pt")
.Add("font-family", Font)
End With
End With
With lblC
.Text = ""
.Width = Unit.Percentage(LargCoulPercent)
.Height = Unit.Percentage(TexteHaut)
.BackColor = CType(oP.GetValue(oT, Nothing), Color)
.ToolTip = (CType(oP.GetValue(oT, Nothing), Color)).ToString + " / " + CType(oP.GetValue(oT, Nothing), Color).ToArgb.ToString
With .Style
.Add("margin-bottom", "1px")
.Add("border", "1px solid black")
End With
End With
pn.Controls.Add(lblT)
pn.Controls.Add(lblC)
Catch ex As Exception
End Try
End If
Next
Return pn
End Function
#End Region
End Class
-------------------------------------------------------------------------------------------
Conclusion
pour un editeur autre que visual studio remplacer Codebehind par src
------------------------------------------- ------------------------------------------------ e rb
ebwm@ymages.com
http://ymages.com http://isoc ele.net
----------------------------------------- --------------------------------------------------
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio [WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz
Forum
RE : FORMULAIRERE : FORMULAIRE par ap24dp
Cliquez pour lire la suite par ap24dp RE : FORMULAIRERE : FORMULAIRE par jopop
Cliquez pour lire la suite par jopop RE : FORMULAIRERE : FORMULAIRE par ap24dp
Cliquez pour lire la suite par ap24dp RE : FORMULAIRERE : FORMULAIRE par jopop
Cliquez pour lire la suite par jopop
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|