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
[WF4] PASSAGE D'ARGUMENTS LITERAL, VISUALBASICVALUE OU LAMBDAVALUE?[WF4] PASSAGE D'ARGUMENTS LITERAL, VISUALBASICVALUE OU LAMBDAVALUE? par JeremyJeanson
Avec la sortie de la RC de Visual Studio 2010, Microsoft a mis un peu les points sur leS i en ce qui concernait le passage d'arguments. Mais nous somme un certain nombre à avoir pris ce changement comme un coup dur. Pour résumer la situation : à la sortie...
Cliquez pour lire la suite de l'article par JeremyJeanson [RIA SERVICES] INCLUDE ET DOMAINDATASOURCE[RIA SERVICES] INCLUDE ET DOMAINDATASOURCE par Audrey
Dans un de mes articles précédents , j'avais parlé des DomainDataSource avec RIA Services dans le cas d'une interface Maître - Détail. Dans le même principe, je vais parler d'une autre manière de mettre en forme ce cas d'interface avec RIA Services. Et po...
Cliquez pour lire la suite de l'article par Audrey ZUNE : VERSION ZUNE SOFTWARE V 4.2 ET LA SOCIALISATIONZUNE : VERSION ZUNE SOFTWARE V 4.2 ET LA SOCIALISATION par ROMELARD Fabrice
Une des nouveautés de la version V 3.0 était l'apparition de l'onglet Social qui ne fonctionnait que si le MarketPlace était activé sur son poste. Cela limitait donc son intérêt, car hors du cadre commercial USA-CANADA, peu de monde trouva...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice PRATIQUE DE SILVERLIGHT PAR ERIC AMBROSIPRATIQUE DE SILVERLIGHT PAR ERIC AMBROSI par MPOWARE
Je viens de finir la lecture du dernier livre d'
Eric Ambrosi
éditions PEARSON
Son livre donne une approche pratique de Silverlight qui sera aussi bien comprise par le développeur que par le designeur.
Tous les aspects du développement RIA sont abor...
Cliquez pour lire la suite de l'article par MPOWARE APPRENDRE à DéVELOPPER POUR LES MOBILES AVEC LA NOUVELLE GéNéRATION .NETAPPRENDRE à DéVELOPPER POUR LES MOBILES AVEC LA NOUVELLE GéNéRATION .NET par odewit
2 déclinaisons de Silverlight et 2 déclinaisons de Mono permettent dorénavant (ou permettront prochainement) de développer des applications .NET mobiles pour les principales plates-formes du marché :
Silverlight pour Symbian, basé sur Silverlight 2...
Cliquez pour lire la suite de l'article par odewit
Forum
CONFIGURER SMTPCONFIGURER SMTP par nsegi
Cliquez pour lire la suite par nsegi LES UTILISATEUR LES UTILISATEUR par bahij
Cliquez pour lire la suite par bahij
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|