I built simple c++ Windows Form project with Visual Studio 2015.
My application has toast (Windows 10), and that shows icon like this.
Application icon has transparent background.
How can I remove blue background of icon?
Source Code: https://github.com/chaeyk/SoundDeviceToggle
Apologies, A bit late BUT ... in my effort to try and help๐
... Did you try both a transparent pixel PNG?png here
... and/or a transparent pixel GIF?gif here
( see 2 attached 1x1px images )
NOTE: I'm not sure what filetype you may need, but the same instance applies. If anyone wants me to supply a transparent image of a certain type eg. png, ico etc let me know.๐
Else, you can easily generate transparent PNG's ...
https://png-pixel.com/
and
https://onlinegiftools.com/create-1x1-pixel-gif
Related
I made an MFC app for my friend using VS2015 in Win10. It looks like this, which is exactly the same as in resource editor.
.
But when he ran the app on his computer in Win7, the Bitmap image in Picture Control enlarges and covers up some text boxes below, which looks like this.
.
After I searched and realized it may be related with DPI awareness. I disabled DPI-Awareness in property page of Manifest Tool and rebuilt. The same thing happened even when it runs in Win10.
Could someone help me explain the cause of this and find a solution to fix the size of the image control? Thanks.
The main problem is that a dialog from a resource is always measured in DLUs.
And DLUs are calculated from the size of the font, that is used for the dialog.
See this article how dialog base units are calculated.
Now you have a static picture control that is sized in DLUs. The bitmap is just scaled in pixels and is never resized, when you assign it to a static dialog control. And because the real size of the static control depends on the used font, you get different layouts for your dialog and your bitmap.
And because just the font changes when you choose no DPI awareness and because the font changes from windows version to windows version your dialog always look different.
Advice: Paint you picture your own and stretch it accordingly.
Also this stackoverflow question is nice documents and shows the effect of DLUs.
And here some code for auto sizeing picture controls.
An auto-sizing bitmap picture control
A simple image preview class using GDI+
CxImage
Normally, I prefer to keep control in my hand by using SetWindowPos() to set the size of image I want in different situations. You can use below two lines to control/set position and size of your image.
Assume ID of the Picture Control is IDC_STATIC2 then you can use like:
CStatic * pStatic = (CStatic *) GetDlgItem(IDC_STATIC2);
pStatic->SetWindowPos(NULL,20,20,50,50,0);
I am showing thumbnails (in a WTL/ATL/C++ application) using IShellItemImageFactory. Everything works fine all the way up to windows 8. There, some icons come with some black lines where transparency should be. It is slight but visible: http://i59.tinypic.com/ru2vmf.png
It happens to a minority of icons only.
After extracting the bitmap I show it (exactly as returned by GetImage(SIIGBF_RESIZETOFIT)) in a standard static control with STM_SETIMAGE. The glitch is still there if I add the bitmap in an imagelist
what can be the problem?
I am working on visual studios 2010 and c++. I am trying to change the background color of my basic windows app i want to put gradient colors to it like how skype and other programs do is it possible? As far as my guess is that i have to add gradient brush on the WNDCLASSEX.hbrBackground so far i could only find this
http://msdn.microsoft.com/en-us/library/windows/desktop/dd371488%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd799414%28v=vs.85%29.aspx
But i could not make it work as a whole background, i am just making guesses as i am completely lost and an example code or description on how to achieve this will be really helpful.
If you want to support versions prior to Vista, you needed to handle WM_ERASEBKGND message in your window proc and do the whole painting of the background yourself. Read about GDI or GDI+ at msdn on how to do it.
I am developing a GUI application using Embarcadero VCL c++ IDE for windows OS. As part of this project, I have to change color of button with respect to an external state.
I understood that windows32 API will not allow to change the color of button.
Could you please suggest me, how to change button color?
Do you wish to change the background-colour of the button, or the text-colour of it?
Since windows has used visual themes for some time now, if you have commctrl loaded and include a manifest file, the button will be drawn using the default (current) theme.
Options I can see include (a) custom-drawing the background (b) changing the text-colour in the normal draw process (c) drawing the button without a theme (i.e drawing a 'flat' button).
You could simply draw a bitmap-button, changing the bitmap depending on the state of the button. You could also use a single bitmap, tinting it using the HSL or HSV colour-space, depending on the state.
As for the flat type of button, I think you can probably change it's background-colour in much the same way as you can change the colour of the text - by intervening during the standard draw process and changing the colour from 3D_FACE (or whatever it is, I forget) to whatever you'd like.
If you look at the calculator included with windows XP, you can see an example of changing the text colour.
CodeProject.com likely has a stack of articles that would help in this endeavour. :)
I have an windows app which contains some dialogs. the dialogs have been built using mfc. I am drawing some images (.png) on every dialog using CImage::Draw() method. I want to mention that I am not using any picture contol on the dialog to render these images instead I am loading them at runtime using some handle.till this everything is ok. now when the image is loaded the background of those images are coming as white. the images in the resource file does not have the white background. my question is how to change the background of these images while drawing them on the dialog? I want the background of the image similar to the color of default dialog which i am using.
One more question the .png images are not rendering well(the images are scattered) in the dialogs of windows server 2008 R2 machine. what could be the possible remedy for this?
any help will be appreciated.
Your PNG images are obviously not 32-bit. You need an alpha channel and a transparent background. Open your images in e.g. Paint.NET. I bet your background is white there too! Regarding the image quality, are you stretching your images on draw?
Edit: For 8-bit imagers, I believe a call to SetTransparentColor is required. For 32-bit images, perhaps this function will do: TransparentBlt