|
As John mentioned...
Use the ILC_MASK flag when creating your image list if you want masked bitmaps.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
But it is already there.
From the MSDN documentation of CImageList::Add, crMask parameter:
"crMask
Color used to generate the mask. Each pixel of this color in the given bitmap is changed to black and the corresponding bit in the mask is set to one."
Does it mean that the given bitmap will be modified? It happens so.
- NS -
|
|
|
|
|
Add the flag when you create the image list.
When you add the bitmap, the color will be used to generate the mask, but the image list has
to be created to use a mask.
See CImageList::Create() nFlags parameter.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think my code just like that you said.
HIMAGELIST hImageList = ImageList_Create( stBitmapsize.bmWidth, stBitmapsize.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 2 );<br />
m_ImageList.Attach( hImageList );<br />
m_ImageList.Add( &bitmap, clrTransparent_i );
Could you please tell me whether there is any problem?
- NS -
|
|
|
|
|
So the bitmap you add gets changed? I didn't know that. I guess I've never had to reuse the
bitmap - I use alot of image lists
All you can do is make a copy of the source bitmap or reload it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: All you can do is make a copy of the source bitmap or reload it.
I think so... I will try.
Thank you
- NS -
|
|
|
|
|
|
Please don't post the same question multiple times, once is enough and in some cases more than enough.
|
|
|
|
|
If you know the file format of the respective image files, you could very well extract RGB compnoents of the pixel.
Regards,
Paresh.
|
|
|
|
|
How can I extract the RGB components of Images with formats
MNG,PNG,TIFF.Kindly tell me where I could find some sample codes
|
|
|
|
|
|
Thank u,
but all the Zip files downloaded are corrupted.
they are .htm files renamed as .zip
|
|
|
|
|
I am sorry. I am not sure about that.
But here I could download it... I just did download the full source code now.
- NS -
|
|
|
|
|
For png and I think tiff you can use of CImage class.
|
|
|
|
|
Hi
Nowadays I am learning MFC and i have a problem with CMainFrame.
I am looking codes which VS2005 MFC wizard create, something different.
When i write a MFC App, i create a class which is derived from CWinApp and then create a CFrameWnd.
I handle menu messages in FrameWnd's message map.
But in VS 2005 codes. There is message map in Application class and menu messages are associated with application class message map.
For example:
MFCSingle.exe -> MFCSingle.cpp
BEGIN_MESSAGE_MAP(CMFCSingleApp, CWinApp)<br />
ON_COMMAND(ID_APP_ABOUT, &CMFCSingleApp::OnAppAbout)<br />
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)<br />
END_MESSAGE_MAP()
So where is CMainFrame?
Isn't menu control belong to CMAinFrame?
|
|
|
|
|
You probably made a Dialog based Application or did unselect Doc/View.
Failure is not an option - it's built right in.
|
|
|
|
|
in a standard MFC Project CMainFrame will be in files called MAINFRM.H and MAINFRM.CPP
For the MSDN description of Command Routing see here[^]
|
|
|
|
|
Hi All,
I use this code to change the color of some words in the text, using GDI+ (it based on the example from MSDN). I want to change the color of words in range specified by the charRanges. But the result is kind of weird, the words are not displayed as specified by the range, and the position is moving to right-bottom a little bit.
--edit--
I think I know the problem. The text displayed in the new region is trimmed and positioned based on the region's size. So, I wonder if there any other way to do this?
Below is some of the code... If you have any experience with GDI+ pls help me...
Thank you!
...<br />
int p[3] = {4,17,39};<br />
int q[3] = {5,3,13};<br />
CharacterRange charRanges[3] = { CharacterRange(4, 5),<br />
CharacterRange(17, 3),<br />
CharacterRange(39, 13), };<br />
<br />
Font myFont(L"Times New Roman", 12);<br />
StringFormat strFormat;<br />
StringFormat stringFormat;<br />
<br />
Region* pCharRangeRegions;
short i;
int count;
CString strMsg = "The quick, brown fox easily jumps over the lazy dog.";<br />
LPWSTR string;<br />
string = CStringToWchar(strMsg);<br />
strFormat.SetMeasurableCharacterRanges(3, charRanges);<br />
<br />
count = strFormat.GetMeasurableCharacterRangeCount();<br />
pCharRangeRegions = new Region[count];<br />
<br />
graphics.MeasureCharacterRanges(string, -1,<br />
&myFont, layoutRect, &strFormat, count, pCharRangeRegions);<br />
RectF *enclosingRect;<br />
enclosingRect = new RectF[count];<br />
graphics.DrawString(string, -1,&myFont, layoutRect, &strFormat, &blueBrush);<br />
<br />
for ( i = 0; i < count; i++)<br />
{<br />
string = CStringToWchar(strMsg.Mid(p[i],q[i]));<br />
graphics.SetClip(&pCharRangeRegions[i]);<br />
graphics.GetClipBounds(&enclosingRect[i]);<br />
graphics.DrawString(string, -1, &myFont, enclosingRect[i], &stringFormat, &redBrush);<br />
}
-- modified at 4:28 Thursday 26th July, 2007
-Houari
|
|
|
|
|
LINK : fatal error LNK1104: cannot open file "mfc42u.lib"
I am getting this error...How to resolve this error??
Thanks in advance
|
|
|
|
|
What respose did you get when you tried google for this error ?
It's looking for a unicode MFC library, did you change your applications UNICODE settings ?
|
|
|
|
|
It says that it cannot find the specified library file, which is a MFC library from VC6.
So what did you do exactly do get this error ? Did you convert a VC6 project to another visual Studio ? Did you create a new project ? ...
Could you give more informations ?
|
|
|
|
|
It seems to be that you didnt specified the unicode libraries at the time of VC installation
- NS -
|
|
|
|
|
Do you have this file on your system?
|
|
|
|
|
hello
my project is mouse control through hand gestures in which i connected Matlab7 with VC++ 6.0.Matlab and VC connected successfully and the project also run sucessfully but i got a prolem in running the project which is
"server busy: this action cannot be completed because
the other program is busy.choose 'switch to' activate
the busy program and correct the problem"
please give me replay. i am waiting
good bye.
azeema anees
|
|
|
|
|
Sound like a endless loop, and your application is not reacting on reveived messages.
Stop your program with the debugger and look at the call stack. Something you recognize? Is there an error somewhere.
If not, try inserting a Breakpoint in the InitInstance of your application and step through it.
Failure is not an option - it's built right in.
|
|
|
|