Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
AnswerRe: Atom table Pin
Sabry190512-Oct-05 21:06
Sabry190512-Oct-05 21:06 
Questionlosing focus totally after some.ShowDialog() Pin
FreeClimber11-Oct-05 23:20
FreeClimber11-Oct-05 23:20 
QuestionSlow speed on second query Pin
AesopTurtle11-Oct-05 23:03
AesopTurtle11-Oct-05 23:03 
QuestionDynamic images in imagelist-Urgent!!!!!!!!!!!!!! Pin
tanishq151011-Oct-05 22:04
tanishq151011-Oct-05 22:04 
AnswerRe: Dynamic images in imagelist-Urgent!!!!!!!!!!!!!! Pin
David Stone12-Oct-05 7:06
sitebuilderDavid Stone12-Oct-05 7:06 
GeneralRe: Dynamic images in imagelist-Urgent!!!!!!!!!!!!!! Pin
Anonymous12-Oct-05 20:11
Anonymous12-Oct-05 20:11 
GeneralRe: Dynamic images in imagelist-Urgent!!!!!!!!!!!!!! Pin
tanishq151012-Oct-05 20:39
tanishq151012-Oct-05 20:39 
AnswerSolution : Dynamic images in imagelist-Urgent!!!!!!!!!!!!!! Pin
tanishq151013-Oct-05 5:09
tanishq151013-Oct-05 5:09 
Hi,

I have got the solutionLaugh | :laugh: .I made a very stupid mistake in loading the images to the imagelist.Here is the complete solution...

This code could be useful to those who want to create a dynamic image programatically and add it to the imagelist.

I fetch the colors from the database and create a square image and fill it with the database color and display in the combobox as images.The colors are stored in the database as integers.

Formload():
CreateImage();
myImageList = new ImageList();
if (myList.Count != 0)
{
foreach(Bitmap ic in myList)
{
myImageList.Images.Add(ic);
}
}
int k = 0;
foreach (TwigCategory cat in m_TwigCategories)
{
this.cmb_CATEGORY.ImageList = myImageList;
Item = new ComboBoxExItem(cat.Description,k, cat.ID);
this.cmb_CATEGORY.Items.Add(Item);
k += 1;
}


private void CreateImage()
{
foreach (TwigCategory cat in m_TwigCategories)
{
Color color = new Color();
color = Color.FromArgb((int)cat.RGB);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(16, 16, PixelFormat.Format32bppArgb);
bmp.MakeTransparent(Color.Transparent);
int i, j;
for (i = 0; i < bmp.Width; i++)
{
for (j = 0; j < bmp.Height; j++)
{
Color pixelColor = bmp.GetPixel(i, j);
int r = color.R; // the Red component
int b = color.B; // the Blue component
int g = color.G;
Color newColor = Color.FromArgb(r, g, b);
bmp.SetPixel(i, j, newColor);
}
}
myList.Add(bmp);
}
m_TwigCategories.Reset();
}
Questionowndraw for a scrollbar Pin
Sasuko11-Oct-05 21:29
Sasuko11-Oct-05 21:29 
AnswerRe: owndraw for a scrollbar Pin
David Stone12-Oct-05 6:56
sitebuilderDavid Stone12-Oct-05 6:56 
QuestionWindows Search Gif Pin
Greeky11-Oct-05 20:40
Greeky11-Oct-05 20:40 
AnswerRe: Windows Search Gif Pin
XRaheemX13-Oct-05 3:48
XRaheemX13-Oct-05 3:48 
GeneralRe: Windows Search Gif Pin
Greeky13-Oct-05 3:57
Greeky13-Oct-05 3:57 
QuestionC# and animated GIFs (VS.Net 2003) Pin
raysot77711-Oct-05 19:14
raysot77711-Oct-05 19:14 
Questiondataadapter fill question Pin
theStorminMormon11-Oct-05 16:49
theStorminMormon11-Oct-05 16:49 
AnswerRe: dataadapter fill question Pin
Wjousts12-Oct-05 3:38
Wjousts12-Oct-05 3:38 
GeneralRe: dataadapter fill question Pin
theStorminMormon12-Oct-05 4:17
theStorminMormon12-Oct-05 4:17 
GeneralRe: dataadapter fill question Pin
Wjousts12-Oct-05 7:42
Wjousts12-Oct-05 7:42 
GeneralRe: dataadapter fill question Pin
theStorminMormon14-Oct-05 7:01
theStorminMormon14-Oct-05 7:01 
Questionadminstrator Pin
momoo11-Oct-05 16:47
momoo11-Oct-05 16:47 
AnswerRe: adminstrator Pin
Dave Kreskowiak12-Oct-05 3:50
mveDave Kreskowiak12-Oct-05 3:50 
QuestionWTF is my task list? Pin
theStorminMormon11-Oct-05 16:18
theStorminMormon11-Oct-05 16:18 
AnswerRe: WTF is my task list? Pin
leppie11-Oct-05 16:21
leppie11-Oct-05 16:21 
GeneralRe: WTF is my task list? Pin
theStorminMormon11-Oct-05 16:43
theStorminMormon11-Oct-05 16:43 
AnswerRe: WTF is my task list? Pin
tatchung11-Oct-05 16:40
tatchung11-Oct-05 16:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.