473,498 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show Color Palette

Hello,

I am developing an application in which the user has to select his
choice of colors and displaying the images with that color. How can I
display color palette to the user and return the selected color?

thanx in advance

Jul 4 '06 #1
1 5303
Hi,

You can create a colorpalette as the UserControl. ColorPalette is a table
structure .when you choose a color , the background color in the <tdwill
be changed.

The Code for colorpallete:

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="ColourPicker.ascx.cs" Inherits="ColourPicker" %>

<style.CPCell { border:1px #FFFFFF solid; padding:2px; }

..CPCell_Over { border:1px #4B4B6F solid; background-color:#FFEEC2;
padding:2px; }

..CPImg { border:1px #999999 solid; }

..CPChosen { background-color:#FFC06F; border:1px #4B4B6F solid;
font-family:tahoma; font-size:11px; padding:2px; }

</style>

<script language="JavaScript">

function SetColor(colImg)

{

var chosen = document.getElementById('ChosenColor');

chosen.style.backgroundColor=colImg.style.backgrou ndColor;

chosen.innerHTML = colImg.alt;

}

</script>

<table cellpadding="0" cellspacing="0" border="0">

<tr>

<td id="ChosenColor" colspan="8" class="CPChosen" align="center">No
Fill</td>

</tr>

<tr>

<td colspan="8"><img src="images/spacer.gif" width="100" height="1"
border="0"></td>

</tr>

<tr>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Black"
style="BACKGROUND-COLOR:#000000"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Brown"
style="BACKGROUND-COLOR:#993300"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Olive Green"

style="BACKGROUND-COLOR:#333300" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Dark Green"

style="BACKGROUND-COLOR:#003300" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Dark Teal"

style="BACKGROUND-COLOR:#003366" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Dark Blue"

style="BACKGROUND-COLOR:#000080" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Indigo"
style="BACKGROUND-COLOR:#333399"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Gray-80%"
style="BACKGROUND-COLOR:#333333"

width="12" height="12" border="0"></td>

</tr>

<tr>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Dark Red"
style="BACKGROUND-COLOR:#800000"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Orange"
style="BACKGROUND-COLOR:#ff6600"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Dark Yellow"

style="BACKGROUND-COLOR:#808000" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Green"
style="BACKGROUND-COLOR:#008000"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Teal"
style="BACKGROUND-COLOR:#008080"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Blue"
style="BACKGROUND-COLOR:#0000ff"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Blue-Gray"

style="BACKGROUND-COLOR:#666699" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Gray-50%"
style="BACKGROUND-COLOR:#808080"

width="12" height="12" border="0"></td>

</tr>

<tr>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Red"
style="BACKGROUND-COLOR:#ff0000"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Light Orange"

style="BACKGROUND-COLOR:#ff9900" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Lime"
style="BACKGROUND-COLOR:#99cc00"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Sea Green"

style="BACKGROUND-COLOR:#339966" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Aqua"
style="BACKGROUND-COLOR:#33cccc"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Light Blue"

style="BACKGROUND-COLOR:#3366ff" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Violet"
style="BACKGROUND-COLOR:#800080"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Gray-40%"
style="BACKGROUND-COLOR:#969696"

width="12" height="12" border="0"></td>

</tr>

<tr>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Pink"
style="BACKGROUND-COLOR:#ff00ff"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Gold"
style="BACKGROUND-COLOR:#ffcc00"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Yellow"
style="BACKGROUND-COLOR:#ffff00"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Bright Green"

style="BACKGROUND-COLOR:#00ff00" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Turquoise"

style="BACKGROUND-COLOR:#00ffff" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Sky Blue"
style="BACKGROUND-COLOR:#00ccff"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Plum"
style="BACKGROUND-COLOR:#993366"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Gray-25%"
style="BACKGROUND-COLOR:#c0c0c0"

width="12" height="12" border="0"></td>

</tr>

<tr>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Rose"
style="BACKGROUND-COLOR:#ff99cc"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Tan"
style="BACKGROUND-COLOR:#ffcc99"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Light Yellow"

style="BACKGROUND-COLOR:#ffff99" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Light Green"

style="BACKGROUND-COLOR:#ccffcc" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Light Turquoise"

style="BACKGROUND-COLOR:#ccffff" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Pale Blue"

style="BACKGROUND-COLOR:#99ccff" width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="Lavander"
style="BACKGROUND-COLOR:#cc99ff"

width="12" height="12" border="0"></td>

<td class="CPCell" onmouseover="this.className='CPCell_Over'"
onmouseout="this.className='CPCell'"><img src="images/spacer.gif"
class="CPImg" onclick="SetColor(this);" alt="White"
style="BACKGROUND-COLOR:#ffffff"

width="12" height="12" border="0"></td>

</tr>

</table>

Place this in our .aspx file and get it work.

Let me know if you have any doubts.

Regards,

Valli.

www.syncfusion.com


<mr************@gmail.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Hello,

I am developing an application in which the user has to select his
choice of colors and displaying the images with that color. How can I
display color palette to the user and return the selected color?

thanx in advance

Jul 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2171
by: Kathy | last post by:
How do I add a color palette to the font dialog? I want the font dialog to look like the standard Microsoft office Font Dialog but am unable to find any information on how to do this.
0
1504
by: James Dean | last post by:
How do i define my own Color Palette in a bitmap?........ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
3235
by: eng_nahswa | last post by:
hiiiii everybody i want to know how can i create a color dialog box in asp.net application or a color palette.
1
1638
by: Merdaad | last post by:
Hi and happy new year to all I would like to have a color Pallette from which I can use colors that I can use into rows of data that I am creating. Like I want the background of one row to be...
2
3011
by: jai | last post by:
c++ code to include color palette for writing a 8- bit BMP file
15
2022
by: active | last post by:
Below is a small but complete program that appears to show you can't retrive a Palette from the clipboard. This is true whether the palette is placed on the clipboard by Photoshop or Photoshop...
8
2450
by: active | last post by:
Guess I'm looking for someone who likes to work difficult puzzles. I can't seem to ever retrieve a palette handle from the clipboard. Below is a simple test program that demonstrates the...
2
1053
by: SuvarnaChaudhari | last post by:
any one plz tell me how to insert color palette on clicking button.I want to change color of selected text.Thanking you!
6
6371
by: Trevor2007 | last post by:
I am trying to call the color palette in access, but the only thing I keep coming accross is xldialog.paintpalette for excel but nothing for access. I would like to do this to allow the end user...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.