Hi,
I made my own Ownerdraw buttons. and there something wrong with the following code. I get GDI file read error, when I try to open the dialog which contains these buttons.
Please help
[tag]
Code:
{
/* DibB = new TDib("Close1.bmp");
try
{
pal = new TPalette(*DibB);
}
catch(...)
{
pal = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
TBitbtn = new TBitmap(*DibB,pal);
DibB2 = new TDib("Close2.bmp");
try
{
pal2 = new TPalette(*DibB2);
}
catch(...)
{
pal2 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
TBitbtn2 = new TBitmap(*DibB2,pal2);
DibB3 = new TDib("Close3.bmp");
try
{
pal3 = new TPalette(*DibB3);
}
catch(...)
{
pal3 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
TBitbtn3 = new TBitmap(*DibB3,pal3);
DibB4 = new TDib("txt1.bmp");
try
{
pal4 = new TPalette(*DibB4);
}
catch(...)
{
pal4 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Ttxt1 = new TBitmap(*DibB4,pal4);
DibB5 = new TDib("txt2.bmp");
try
{
pal5 = new TPalette(*DibB5);
}
catch(...)
{
pal5 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Ttxt2 = new TBitmap(*DibB5,pal5);
DibB6 = new TDib("txt3.bmp");
try
{
pal6 = new TPalette(*DibB6);
}
catch(...)
{
pal6 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Ttxt3 = new TBitmap(*DibB6,pal6);
DibB7 = new TDib("html1.bmp");
try
{
pal7 = new TPalette(*DibB7);
}
catch(...)
{
pal7 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Thtml1 = new TBitmap(*DibB7,pal7);
DibB8 = new TDib("html2.bmp");
try
{
pal8 = new TPalette(*DibB8);
}
catch(...)
{
pal8 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Thtml2 = new TBitmap(*DibB8,pal8);
DibB9 = new TDib("html3.bmp");
try
{
pal9 = new TPalette(*DibB9);
}
catch(...)
{
pal9 = new TPalette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
}
Thtml3 = new TBitmap(*DibB9,pal9);
Close1 = new TOwnerDrawButton(this, IDOK, TBitbtn, TBitbtn2, TBitbtn3);
Txt = new TOwnerDrawButton(this, IDTXT, Ttxt1, Ttxt2, Ttxt3);
html = new TOwnerDrawButton(this, IDHTML, Thtml1, Thtml2, Thtml3);*/
}
[/tag]
Ciao,
Shawn