CSDeskBand icon indicating copy to clipboard operation
CSDeskBand copied to clipboard

Some problems with calling context menu

Open xmoer opened this issue 7 years ago • 10 comments

Thank the author for making this project, but I found some small problems in use.

  1. Right-click on taskbar tool image is invalid. Context menu can only be displayed by right-clicking in the blank or penetrated area.
  2. In the white taskbar of Windows10 (19H1), CSDeskBand.Wpf tools will have black jagged edges.

xmoer avatar Jan 09 '19 17:01 xmoer

For 1. is it with winforms or wpf? do you have an example screenshot or video. For 2. I'll take a look when the update comes out. wpf doesn't combine too well with the taskbar so there will probably be issues. Thanks.

dsafa avatar Jan 17 '19 07:01 dsafa

Both problems arise on wpf. Question 1 is somewhat indescribable, so I drew a demo graphics.

view

This is a taskbar demo. Wpf was used to draw the blue graphics. Right-click on blue graphics is invalid, context menu can only be displayed by right-clicking in the black area. If the blue graphics is replaced by an image control, the result is the same.

xmoer avatar Jan 17 '19 08:01 xmoer

Thanks for the visual. I believe its because wpf is not bubbling the event up to winforms. I'll see what I can do with that.

dsafa avatar Jan 22 '19 05:01 dsafa

I found that its because the form doesn't pass the click even through to the taskbar. I have a fix for non transparent wpf controls but for transparency i'm not currently sure on how to fix it.

dsafa avatar Mar 07 '19 01:03 dsafa

Yes, it's not easy to solve these two problems. I'm also studying how to fix the second problem (edge jagged for non-black background).

xmoer avatar Mar 07 '19 06:03 xmoer

I found a few strange problems. Control edges have color residues because TranparencyKey & BackColor is imperfect. But transparent methods do not show the same effect in various versions of Windows10.

The background of the system taskbar before 19H1 is black by default, so you won't see black serrated teeth. Now Microsoft has added the light mode, and the taskbar and start menu background can turn white. The problem of edge color residue became serious and I tried many methods.

First, I changed the transparent color to magenta or white, and the result was still terrible. Then I quoted the project: https://github.com/patbec/TaskbarSampleExtension. I modified the file to try to load the WPF control directly.

[File: TaskbarSampleExt/DeskBand.cs]
public class DeskBand : UserControl, IObjectWithSite, IDeskBand2 { …… }
[After editing: ]
public class DeskBand : ElementHost, IObjectWithSite, IDeskBand2 { …… }

Without specifying the transparent color, only "BackColorTransparent = true" is needed to achieve the perfect display effect. Of course, this method only works under 19H1, and will turn into a black background in the old system. The result surprised me.

This may be related to Microsoft's continuous improvement of the system kernel? Multiple strategies may be needed to solve the problem of perfect background transparency.

xmoer avatar May 02 '19 05:05 xmoer

Thanks for the news. This is really interesting. I guess we'll just have to rely on microsoft's changes.

dsafa avatar May 03 '19 19:05 dsafa

In version 3.1 I updated so transparency works properly. Context menu is still a bit of an issue though

dsafa avatar May 09 '19 20:05 dsafa

ContextMenu may not be a problem? Although it's not perfect, we can customize a menu. For example:

<Grid>
    <Grid.ContextMenu>
        <ContextMenu>
            <MenuItem Name="MenuItem1" Header="AAAAA"/>
            <MenuItem Name="MenuItem2" Header="BBBBB"/>
        </ContextMenu>
    </Grid.ContextMenu>
    ……
</Grid>

xmoer avatar May 11 '19 02:05 xmoer

Yeah, creating your own context menu is what I would recommend.

dsafa avatar May 11 '19 02:05 dsafa