Foros del Web » Programando para Internet » ASPX (.net) »

personalizar el color skins

Estas en el tema de personalizar el color skins en el foro de ASPX (.net) en Foros del Web. Hola a todos: Estoy haciendo una aplicación en la que quiero que el usuario pueda personalizar el color. que haciendo click en un bottom se ...
  #1 (permalink)  
Antiguo 28/06/2006, 09:14
 
Fecha de Ingreso: marzo-2004
Mensajes: 198
Antigüedad: 20 años, 1 mes
Puntos: 1
personalizar el color skins

Hola a todos:

Estoy haciendo una aplicación en la que quiero que el usuario pueda personalizar el color.

que haciendo click en un bottom se le abra un componente que le muestre todos los colores disponibles y pueda eleginr uno.

Hay algun componente que haga esto o donde me podria informar sobre como hacerlo?

Gracias anticipadas
  #2 (permalink)  
Antiguo 28/06/2006, 11:26
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 22 años, 2 meses
Puntos: 50
solo copia y pega en un archivo .aspx

Código:
<%@ Page language="c#" %>
<html>
<head>
<title>Color Picker</title>
<style>
.cc {
	width:10;height:8;
}
</style>
<script launguage="JavaScript">
function colorOver(theTD) {
	previewColor(theTD.style.backgroundColor);
	setTextField(theTD.style.backgroundColor);
}
function colorClick(theTD) {
	setTextField(theTD.style.backgroundColor);
	returnColor(theTD.style.backgroundColor);
}
function setTextField(ColorString) {
	document.getElementById("ColorText").value = ColorString.toUpperCase();
}
function returnColor(ColorString) {
	window.returnValue = ColorString;
	window.close();	
}		
function userInput(theinput) {
	previewColor(theinput.value);
}
function previewColor(theColor) {
	try {
		PreviewDiv.style.backgroundColor = theColor;
	} catch (e) {
	}
}
</script>		
</head>

<body style="background-color:d4d0c8; margin: 2 2 2 2;">
<form runat="server">

<table cellpadding=0 cellspacing=0 border=0>
<tr><td colspan=3>
	<asp:Literal id="Colors" 
		runat="server" EnableViewState="false" />
</td></tr>
<tr>	
	<td><input type="text" name="ColorText" id="ColorText" style="width:60;height:22;" onkeyup="userInput(this);"></td>
	<td align=center><div id="PreviewDiv" style="width:50;height:20;border: 1 solid black; background-color: #ffffff;">&nbsp;</div></td>
	<td align=right><input type="button" value="Use Color" onclick="returnColor(ColorText.value);" id="ColorButton"  style="width:80;"></td>
</tr>
</table>

</form>
</body>
</html>
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
	int onrow=1;
	int oncol=1;
	int count=1;
	string s ="";
	string set1 = "";
	string set2 = "";
	for (int r=5; r>=0; r--) {
		for (int g=5; g>=0; g--) {
			for (int b=5; b>=0; b--) {
				if (oncol==1) s += "<tr>\n";
				s += "\t<td onmouseover=\"colorOver(this);\" onclick=\"colorClick(this);\" style=\"background-color:"+ReturnHex(r)+ReturnHex(g)+ReturnHex(b)+";\" class=cc></td>\n";
				oncol++;
				if (oncol >= 19) {
					s+="</tr>\n";
					oncol = 1;
					
					if (onrow % 2 == 0) {
						set2 += s;
					} else {
						set1 += s;
					}
					s = "";
					onrow++;
				}				
				count++;
			}
		}
	}
	Colors.Text = "<table cellpadding=0 cellspacing=1 style=\"background-color:ffffff;\" border=0 >" + set1 + set2 + "</table>";
}

string ReturnHex(int i) {
	switch (i) {
		default:
		case 0:
			return "00";
		case 1:
			return "33";
		case 2:
			return "66";
		case 3:
			return "99";			
		case 4:
			return "CC";
		case 5:
			return "FF";			
	}
}
</script>
Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:39.