How to make the custom icon tranparent in MFC?











up vote
-1
down vote

favorite












I have a small problem: I built an MFC application using MSVC 14.0 it works fine but somehow I wanted to change the default Icon so I added another icon to "res" folder and Named it as the main icon.



Now after build I get the new icon on my Dialog and in taskbar but it show the background! (white color) I need the background to be Transparent as the IDE does with my default MFC Icon.



After searching I had been suggested to use Image Editor on MSVC but I can't find that toolbar there! I only get the colors when opening the icon to edit in MSVC.



So how could I make the Icon background transparent? I used to use WINAPI where to use BitBlt but I don't know how here in MFC. Thank you.




  • I also see that Toolbar Editor is grayed in Image menu.










share|improve this question
























  • @user4581301: Would you suggest a workaround?
    – Maestro
    Nov 21 at 20:25






  • 1




    Icons are complex. You'll find all the information you will ever need in the references section of this answer.
    – IInspectable
    Nov 21 at 21:02






  • 1




    In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
    – Barmak Shemirani
    Nov 22 at 0:32








  • 1




    I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
    – Barmak Shemirani
    Nov 22 at 13:48






  • 1




    The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
    – Constantine Georgiou
    Nov 23 at 12:36















up vote
-1
down vote

favorite












I have a small problem: I built an MFC application using MSVC 14.0 it works fine but somehow I wanted to change the default Icon so I added another icon to "res" folder and Named it as the main icon.



Now after build I get the new icon on my Dialog and in taskbar but it show the background! (white color) I need the background to be Transparent as the IDE does with my default MFC Icon.



After searching I had been suggested to use Image Editor on MSVC but I can't find that toolbar there! I only get the colors when opening the icon to edit in MSVC.



So how could I make the Icon background transparent? I used to use WINAPI where to use BitBlt but I don't know how here in MFC. Thank you.




  • I also see that Toolbar Editor is grayed in Image menu.










share|improve this question
























  • @user4581301: Would you suggest a workaround?
    – Maestro
    Nov 21 at 20:25






  • 1




    Icons are complex. You'll find all the information you will ever need in the references section of this answer.
    – IInspectable
    Nov 21 at 21:02






  • 1




    In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
    – Barmak Shemirani
    Nov 22 at 0:32








  • 1




    I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
    – Barmak Shemirani
    Nov 22 at 13:48






  • 1




    The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
    – Constantine Georgiou
    Nov 23 at 12:36













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have a small problem: I built an MFC application using MSVC 14.0 it works fine but somehow I wanted to change the default Icon so I added another icon to "res" folder and Named it as the main icon.



Now after build I get the new icon on my Dialog and in taskbar but it show the background! (white color) I need the background to be Transparent as the IDE does with my default MFC Icon.



After searching I had been suggested to use Image Editor on MSVC but I can't find that toolbar there! I only get the colors when opening the icon to edit in MSVC.



So how could I make the Icon background transparent? I used to use WINAPI where to use BitBlt but I don't know how here in MFC. Thank you.




  • I also see that Toolbar Editor is grayed in Image menu.










share|improve this question















I have a small problem: I built an MFC application using MSVC 14.0 it works fine but somehow I wanted to change the default Icon so I added another icon to "res" folder and Named it as the main icon.



Now after build I get the new icon on my Dialog and in taskbar but it show the background! (white color) I need the background to be Transparent as the IDE does with my default MFC Icon.



After searching I had been suggested to use Image Editor on MSVC but I can't find that toolbar there! I only get the colors when opening the icon to edit in MSVC.



So how could I make the Icon background transparent? I used to use WINAPI where to use BitBlt but I don't know how here in MFC. Thank you.




  • I also see that Toolbar Editor is grayed in Image menu.







mfc transparency






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 0:49









Barmak Shemirani

20.3k42044




20.3k42044










asked Nov 21 at 20:16









Maestro

599




599












  • @user4581301: Would you suggest a workaround?
    – Maestro
    Nov 21 at 20:25






  • 1




    Icons are complex. You'll find all the information you will ever need in the references section of this answer.
    – IInspectable
    Nov 21 at 21:02






  • 1




    In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
    – Barmak Shemirani
    Nov 22 at 0:32








  • 1




    I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
    – Barmak Shemirani
    Nov 22 at 13:48






  • 1




    The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
    – Constantine Georgiou
    Nov 23 at 12:36


















  • @user4581301: Would you suggest a workaround?
    – Maestro
    Nov 21 at 20:25






  • 1




    Icons are complex. You'll find all the information you will ever need in the references section of this answer.
    – IInspectable
    Nov 21 at 21:02






  • 1




    In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
    – Barmak Shemirani
    Nov 22 at 0:32








  • 1




    I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
    – Barmak Shemirani
    Nov 22 at 13:48






  • 1




    The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
    – Constantine Georgiou
    Nov 23 at 12:36
















@user4581301: Would you suggest a workaround?
– Maestro
Nov 21 at 20:25




@user4581301: Would you suggest a workaround?
– Maestro
Nov 21 at 20:25




1




1




Icons are complex. You'll find all the information you will ever need in the references section of this answer.
– IInspectable
Nov 21 at 21:02




Icons are complex. You'll find all the information you will ever need in the references section of this answer.
– IInspectable
Nov 21 at 21:02




1




1




In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
– Barmak Shemirani
Nov 22 at 0:32






In "Resource View", double click on the icon. Or, in "Solution Explorer" find "myapp.rc", double click it, and double click the icon. When you see the icon editor, go to main menu, click "Image -> Show color window" It shouldn't be gray unless the icon is read-only, or another program is editing the icon.
– Barmak Shemirani
Nov 22 at 0:32






1




1




I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
– Barmak Shemirani
Nov 22 at 13:48




I don't know what the problem is. Just create a new icon and draw on it. Post a screen shot of this gray toolbar.
– Barmak Shemirani
Nov 22 at 13:48




1




1




The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
– Constantine Georgiou
Nov 23 at 12:36




The icon/image editor in Visual Studio doesn't really support alpha transparency (32bpp), instead it does support 24bpp images, and you can set some portions of the image to be (fully) transparent, or inverse transparent. If this is OK to you fine, otherwise use an external editor. 32bpp images and icons can be included in your resources and compiled without problem; it's just the VS image editor that can't edit them.
– Constantine Georgiou
Nov 23 at 12:36

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419854%2fhow-to-make-the-custom-icon-tranparent-in-mfc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419854%2fhow-to-make-the-custom-icon-tranparent-in-mfc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)