1

I want to make a binary clock for Windows. But I want it to replace the default clock (having 2 clocks is unoptimal).

So one of the approaches is just to draw my binary clock on top of the old one. How do I do that? Using external libraries is allowed.

I've tried sth like this:

    public Form1()
    {
        InitializeComponent();
        this.Paint += new PaintEventHandler(Form1_Paint);
    }

    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        e.Graphics.FillEllipse(new SolidBrush(Color.Blue), new Rectangle(1500, 790, 20, 20));
    }

But it doesn't reach the taskbar (bottom right corner): ellipse not reaching taskbar

If it turns out to be impossible I'll make another question about deskbands. But for now I'm asking about drawing on Windows taskbar.

user1
  • 945
  • 2
  • 13
  • 37
  • I'm really no expert in this, but I think you should somehow try to get the window handle of the built-in clock, and maybe try and overwrite it like that. The clock could have many shapes and sizes, depending on the individual user settings, and just painting it over might be hard to do in a general case. – Mads Nielsen Mar 28 '16 at 17:47
  • The answer from Chris Hannon is good, but maybe this question from me can help you better: https://stackoverflow.com/questions/43941753/c-sharp-display-text-on-the-taskbar-windows-10 please checkout the approved answer from Shahrooz Ansari. – Spidev Oct 21 '17 at 21:29

1 Answers1

3

There are numerous things wrong with this approach.

  1. The taskbar exists as its own thing, separate from your application. You can't draw on it very easily, you need to go through the Windows SDK to interact with it (e.g. customize your application's flyout preview). Additionally, that would be a terrible idea if Windows allowed every application that wanted to draw on top of the taskbar to do so. Who wins if everyone's drawing?

  2. Even if you could draw on it, you would have to account for every single thing that it and its flyout window does. How wide is it? What happens if you click on the calendar? What if it's styled differently? What if there's more than one clock? Does the user even have rights to do things with the clock?

  3. There is no built-in way to replace the clock. Replacements do exist, but primarily by hooking the flyout window and doing what I listed in the 2nd option. See T-Clock as an example.

You're much better off going a different route.

Chris Hannon
  • 4,134
  • 1
  • 21
  • 26