Drawing shapes above all other windows (like a volume indicator)

  • Thread starter Thread starter Omatase
  • Start date Start date
O

Omatase

Does anyone know how to do this? I want to draw verticle lines that
will sit on top of all other windows. Preferably I would do this in
c#.

Thanks
 
Omatase,

You might want to create a transparent window and then draw on that,
making sure the window is on top of all other windows. You could set the
window to be a tool window, which should keep it on top.
 
You might want to create a transparent window and then draw on that,
making sure the window is on top of all other windows. You could set the
window to be a tool window, which should keep it on top.

I have tried doing that but the lines I draw are also Opacity 0% when
I do that. Do you know a way to keep the shape opacity at 100% with
the form opacity at 0%?
 
Hello,
Does anyone know how to do this? I want to draw verticle lines that
will sit on top of all other windows. Preferably I would do this in
c#.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace PopupIndicator
{
public static class Program
{
[STAThread]
public static int Main()
{
new Application().Run(new PopupWindow());
return 0;
}

public class PopupWindow : Window
{
public PopupWindow()
{
var stack = new StackPanel {Orientation = Orientation.Horizontal};
Content = stack;

WindowStyle = WindowStyle.None;
AllowsTransparency = true;
Background = Brushes.Transparent;
SizeToContent = SizeToContent.WidthAndHeight;

for(int a = 0; a < 10; a++)
{
var rectangle = new Rectangle {Width = 5, Height = 25, Fill = Brushes.Lime,
Stroke = Brushes.Green};
if(a > 0)
rectangle.Margin = new Thickness(5, 0, 0, 0);
stack.Children.Add(rectangle);
}
}
}
}
}

(H) Serge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top