winforms - Notification icon transparency issues when dragging -


i have winforms app, major component of icon down in notification area. i've noticed if drag icon (to reorder it, or move to/from list of icons hidden windows) transparent pixels not respected correctly, unlike other icons.

this illustrated in animation below; other icons ok when dragged, icon (the red circle) not (excuse animation's compression artefacts).

dragging icons

looking @ more closely, icon looks this:

thermostat icon

looks when dragged:

thermostat icon being dragged

a notifyicon control used, , icon generated dynamically in various colours , different numbers overlaid.

in order maintain translucency around edges of icon, png format used (using code sample codeproject) take bitmap , return icon used notifyicon:

private static readonly byte[] _pngiconheader = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 };  using (var bmp = new bitmap(image, new size(image.width, image.height))) {     byte[] png;     using (var ms = new memorystream())     {         bmp.save(ms, imageformat.png);         ms.position = 0;         png = ms.toarray();     }      using (var ms = new memorystream())     {         _pngiconheader[6] = (byte)image.width;         _pngiconheader[7] = (byte)image.height;         _pngiconheader[14] = (byte)(png.length & 255);         _pngiconheader[15] = (byte)(png.length / 256);         _pngiconheader[18] = (byte)(_pngiconheader.length);          ms.write(_pngiconheader, 0, _pngiconheader.length);         ms.write(png, 0, png.length);         ms.position = 0;          return new icon(ms);     } } 

is there more needs done ensure windows treats correctly when being dragged?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -