The window goes to a second monitor, but there should not be visible. How to hide the area?
Asked
Active
Viewed 708 times
3
-
Your only option would be to resize the window to fit to the screen, you can't make part of the window invisible. Why would you even want to do it? – Glen Thomas Apr 01 '16 at 21:14
-
That's not possible I am afraid. – Nick Sologoub Apr 01 '16 at 21:30
-
I created an application in form similar to the Action Center in Windows 10. But they have done it? – user3328301 Apr 01 '16 at 23:46
1 Answers
1
It's not clear why you need this, but it can be achieved with some effort. The trick is OpacityMask property, which allows to make elements partially transparent. Some code to give you rough idea:
public MainWindow() {
InitializeComponent();
this.WindowStyle = WindowStyle.None; // required for AllowsTransparency
this.AllowsTransparency = true; // allow window to be transparent
var group = new DrawingGroup();
// make first 100x1000 part of window transparent
group.Children.Add(new GeometryDrawing() {Brush = Brushes.Transparent, Geometry = new RectangleGeometry(new Rect(0, 0, 100, 1000))});
// make the rest part white or whatever color you use
group.Children.Add(new GeometryDrawing() {Brush = Brushes.White, Geometry = new RectangleGeometry(new Rect(100, 0, 1000, 1000))});
this.OpacityMask = new DrawingBrush(group) {
Stretch = Stretch.None,
AlignmentX = AlignmentX.Left,
AlignmentY = AlignmentY.Top
};
}

Evk
- 98,527
- 8
- 141
- 191
-
Thank you. I am creating a menu information that pops up when click on the icon in the system tray as Action Center in Windows 10. Your method is right for me, but the problem arose in the blur on the background of window – user3328301 Apr 01 '16 at 23:38