|
I'm trying to load a bitmap into a imagelist, and to get a transparent background.
The imagelist is used in a CListCtrl.
When I load the bitmap directly I get transparent images, but wrong colors.
m_ilReport.Create(IDB_TOOLBAR_GRID256, 16, 1, RGB(255,0,255));
If I load it into a CBitmap first the colors look ok, the problem is that the mask color is replaced with black. SetBkColor seems to have no affect. I've tried with regular colors too.
m_ilReport.Create(16, 16, ILC_COLOR8, 16, 1);
CBitmap bmp;
bmp.LoadBitmap(IDB_TOOLBAR_GRID256);
m_ilReport.Add(&bmp, RGB(255, 0, 255));
m_ilReport.SetBkColor(CLR_NONE);
ctl.SetImageList(&m_ilReport);
What have I done wrong?
|
|
|
|
|
You are setting the transparency colour to be the bright pink that has
RGB(255,0,255). It's what I do in my code, as it's not a colour I use normally in the actual bitmap.
Snip of code that works for me:
m_ImageList.Create(IDB_ALARMBANNER ,16,32,RGB(255,0,255));<br />
m_nImageIndex[IMAGE_ALARMBANNER] = nImageIndex++;
<br />
AddBitmapToList(m_ImageList,IDB_ALARMCLIENT,IMAGE_ALARMCLIENT,nImageIndex++);<br />
<br />
void CMainDialog::AddBitmapToList(CImageList& ImageList, UINT nId, UINT nImageId, UINT nImageIndex)<br />
{<br />
CBitmap bm;<br />
bm.LoadBitmap(nId);<br />
ImageList.Add(&bm, RGB(255,0,255));
m_nImageIndex[nImageId] = nImageIndex;<br />
}
Debbie
|
|
|
|
|
thanks. But that doesnt help me. I want to know why it doesnt work.
Why do the colors look f***edup if I use the same overloaded version of create as you do? (The one where u specify the mask color)
Why do the mask become black when I first load the bmp into a CBitmap and then load the CBitmap into the imagelist?
|
|
|
|
|
Hallo there!
I need help... did you ever made a PS plugin??
if YES: HOW? where can i download the PhotoShop 7.0 SDK? (Not at Adobe.com)
if NO: ...
thanx for helping me;)
|
|
|
|
|
Sorry, if you want to get the official 7.0 SDK, you need to be an Adobe Solutions Network member (basic membership is US$195).
However, if you're just looking to make filter plugins, there are some more affordable options:
http://thepluginsite.com/knowhow/plugincreation.htm[^]
- Mike
|
|
|
|
|
thanx
but i realy need SDK... i know the price for it... but dont have that monny to pay
i will try to get it peer to peer...
thanx for your help anyway
|
|
|
|
|
Is there a "PreTranslateMessage" equivalent in ATL?
I need to pre-filter WM_CHAR for a dialog.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
.. about fixing a few bugs in some MFC controls, such as getting the actual selected element of a CTreeCtrl. There was also a few things about the CListCtrl in this article, which is very short but very useful. Please help me find it ...
~RaGE();
|
|
|
|
|
Hi
Anyone here at cp who works with Dbase IV database using the libraries of Codebase (www.codebase.com)? I need to add a database item to an existing db-file.
Can anyone help me out? Would appreciate it greatly!
Greetings
Jens
|
|
|
|
|
I want to send email with my SMTP server and I want to send attachments with it. For attaching file,I have to encode attached file to base64.So the question is how can I convert my data to base64?
Mazy
No sig. available now.
|
|
|
|
|
|
Thanks,I'll check it.
Mazy
No sig. available now.
|
|
|
|
|
In an MFC dialog application is there a way to trap the escape key so that when it is pressed the application won't shut down?
Thanks
|
|
|
|
|
yes, put this into your message map (.h) of that form
virtual void OnCancel();
void CMyDialog::OnCancel()
{
AfxMessageBox("escape");
}
i hope this helps.
Greetings
Jens
|
|
|
|
|
Jens,
Well after messing around with this for a little while I noticed a side effect that I had not expected. This method not only blocks the escape key but it blocks alt+F4 as well. Is there a way to know that the escape key has been pressed. I tried to capture it in OnKeyDown() but the escape key does not seem to register there. Any ideas?
Cheers,
Steve
|
|
|
|
|
You can override the OnCancel function (and not call CDialog::OnCancel() ).
|
|
|
|
|
Thanks,
That was overly easy
Steve
|
|
|
|
|
i edited a program to superclassing the editbox.
The superclassing succeeded,but when i create the superclassed editbox ,there is a problem:
i first create the superclassed editbox in the window's
wm_create message,but the editbox can not be showed out.
But it can be showed out after i move it to the winmain.
how strange it is.
Anyone can tell me why?
thanks.
<br />
#include<windows.h><br />
#include<tchar.h><br />
<br />
#define IDC_SUPERCLASS1 1<br />
<br />
static HWND hsuperedit1;<br />
<br />
WNDPROC g_editwndOrg;<br />
static LPCTSTR sz_editsuperclass=TEXT("SuperclassEdit");<br />
<br />
LRESULT WINAPI EditSuperclassWndProc(HWND hedit,UINT msg,WPARAM wParam,LPARAM lParam);<br />
<br />
LRESULT WINAPI WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)<br />
{<br />
int cx,cy;<br />
switch(msg)<br />
{<br />
case WM_CREATE:<br />
hsuperedit1=CreateWindow(sz_editsuperclass,NULL,ES_AUTOHSCROLL|ES_LEFT|ES_MULTILINE|WS_CHILD|WS_VISIBLE,100,200,300,400,hwnd,(HMENU)IDC_SUPERCLASS1,HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE),NULL);<br />
return 0;<br />
case WM_DESTROY:<br />
PostQuitMessage(0);<br />
return 0;<br />
}<br />
return DefWindowProc(hwnd,msg,wParam,lParam);<br />
}<br />
<br />
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR lpCmdLine,int nShowCmd)<br />
{<br />
static LPCSTR szClassName="Show Time";<br />
WNDCLASSEX wc_edit;<br />
WNDCLASSEX wc;<br />
<br />
ZeroMemory(&wc,sizeof(wc));<br />
wc.cbClsExtra =0;<br />
wc.cbSize =sizeof(WNDCLASSEX);<br />
wc.cbWndExtra =sizeof(LONG);<br />
wc.hbrBackground =(HBRUSH) GetStockObject (COLOR_BACKGROUND) ;<br />
wc.hCursor =LoadCursor (NULL, IDC_ARROW);<br />
wc.hIcon =NULL;<br />
wc.hIconSm =NULL;<br />
wc.hInstance =hInstance;<br />
wc.lpfnWndProc =WndProc;<br />
wc.lpszClassName =szClassName;<br />
wc.lpszMenuName =NULL;<br />
wc.style =CS_HREDRAW|CS_VREDRAW;<br />
<br />
ATOM atomclass=RegisterClassEx(&wc);<br />
if(atomclass==INVALID_ATOM)<br />
{<br />
MessageBox(NULL,"RegisterClass Error","RegisterClass Error",MB_OK);<br />
exit(1);<br />
}<br />
<br />
HWND hwnd=CreateWindowEx(NULL,szClassName,0,WS_OVERLAPPEDWINDOW,<br />
0,0,500,650,NULL,NULL,hInstance,NULL);<br />
<br />
ZeroMemory(&wc_edit,sizeof(wc_edit));<br />
GetClassInfoEx(NULL,"edit",&wc_edit);<br />
g_editwndOrg=wc_edit.lpfnWndProc;<br />
wc_edit.lpszClassName =sz_editsuperclass;<br />
wc_edit.hInstance =hInstance;<br />
wc_edit.lpfnWndProc =EditSuperclassWndProc;<br />
wc_edit.cbSize =sizeof(WNDCLASSEX);<br />
<br />
ATOM atomclass_edit=RegisterClassEx(&wc_edit);<br />
if(atomclass_edit==INVALID_ATOM)<br />
{<br />
MessageBox(NULL,"RegisterSuperClass Error","RegisterSuperClass Error",MB_OK);<br />
exit(1);<br />
}<br />
<br />
ShowWindow(hwnd,SW_SHOW); <br />
UpdateWindow(hwnd);<br />
<br />
<br />
MSG msg;<br />
while(GetMessage(&msg,NULL,NULL,NULL))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
return msg.wParam ;<br />
}<br />
<br />
LRESULT WINAPI EditSuperclassWndProc(HWND hedit,UINT msg,WPARAM wParam,LPARAM lParam)<br />
{<br />
LRESULT lResult;<br />
BOOL fCallOrgProc=TRUE;<br />
switch(msg)<br />
{<br />
case WM_CHAR:<br />
if(wParam=='a')<br />
{<br />
fCallOrgProc=FALSE;<br />
}<br />
break;<br />
}<br />
if(fCallOrgProc)<br />
{<br />
lResult=CallWindowProc(g_editwndOrg,hedit,msg,wParam,lParam);<br />
}<br />
return lResult;<br />
}<br />
<br />
|
|
|
|
|
How to locate an adress to write in a file?
I want to write some data to a file, and I want to realize the function:
every time write data to the end of the file without changing the previous data of the file.
How to do that?
Thank you.
|
|
|
|
|
Hi,
do you mean "Append"?
regards
~Hari~
|
|
|
|
|
We developed a tool to convert TTF character to BMP ,the tool run good on win2000,but error on win98.In the tool we can create
a bitmap for each character,the bitmap is good on win2000,but is disorder on win98.
I read book find that the GDI objects are shared on win98.If have a bitmap object,then next
the system will not create a new bitmap.
Can you give me some advice?;)
|
|
|
|
|
I don't know what I did by accident but my compiler has been behaving quite funny in the past hour (MS VC++ 6.0). Every time I press the build button it compiles the same three files (even if I don't make any changes). Then when I press the execute button it says that the .obj files of the matching c++ files are "out of date or do not exist" (they are in the directory) and it asks me to build again. All of this happens no matter if I make code changes or not. Does anyone recognize some settings I might have changed by accident?
|
|
|
|
|
The files in question have been forward dated (i.e. Jan 1st, 2010). Thus the compiler can never create an object which has been built since the last modification of the file.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
The files all have the same date May 11, 2003. Any other suggestions?
|
|
|
|
|
Close the IDE and delete the *.NCB files.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|