begin process at 2010 03 22 14:00:08
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

ASP.Net

 > LISTER LES COULEURS WEB GRACE A LA REFLEXION

LISTER LES COULEURS WEB GRACE A LA REFLEXION


 Information sur la source

Note :
2 / 10 - par 1 personne
2,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :ASP.Net Source .NET ( DotNet ) Niveau :Initié Date de création :10/01/2003 Date de mise à jour :10/01/2003 10:51:33 Vu :7 779

Auteur : ErB

Ecrire un message privé
Site perso
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 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

Source .NET (Dotnet) SUITE DE NOMBRES ALESATOIRES DIFFERENTS
Source .NET (Dotnet) ECHANGE DE VALEURS ENTRE 3 PAGES (TRANSFER / EXECUTE)
Source .NET (Dotnet) LISTER LES FICHIERS D'UN DOSSIER
Source .NET (Dotnet) IP / HOSTNAME
Source .NET (Dotnet) AJOUTER DES OPTIONS A ADROTATOR

 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) UTILISATION DE LA MÉTHODE SORT ET SORTDIRECTION AVEC UN GRID... par jesusonline
Source avec Zip Source .NET (Dotnet) CUSTOM DATEPIKER DÉRIVANT DE COMPOSITECONTROL par fredzool
Source avec Zip UN MODULE POUR APPRENDRE SQL par Elmarzougui
Source avec Zip Source .NET (Dotnet) BOUTON QUI EMPECHE LE MULTI CLIC AVANT LA FIN DU TRAITEMENT.... par fredzool
Source avec Zip Source .NET (Dotnet) BOUTON AVEC CSS ET USERCONTROL WITH EVENT par fredzool

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Appels d'offres

Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,421 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales