begin process at 2012 02 14 02:00:54
  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 :11 171

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) GUESTBOOK AVEC GRIDVIEW par DanMor498
Source avec Zip CHECKED DROPDOWNLIST par fredzool
Source avec Zip Source avec une capture Source .NET (Dotnet) GRIDVIEW WITH TREEVIEW AND CALLBACK par fredzool
Source avec Zip APPELLER UN WEBSERVICE DEPUIS JAVASCRIPT par fredzool
Source avec Zip Source .NET (Dotnet) MONEY TEXTBOX WITH EMBEDED JAVASCRIPT par fredzool

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

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 : 3,432 sec (3)

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