-3

I'd like to create an application with exactly the same titlebar / controls as in Visual Studio. Or do you know dnSpy? It is using them as well.

https://prnt.sc/j731zj

I also like to have this 1px border, the blue one in this case.

I already googled alot, also tried to find something here, but I'm not finding anything helpful for me.

Here for example (it's from Wallpaper Engine) the window not only has that blue border, which I like to have, it has some kind of a blue shadow as well? Which looks pretty cool to me. I'd like to try that as well.

https://prnt.sc/j7321n

What I already tried in WinForms is working with panels and create it on my own.

https://prnt.sc/j73bj5

I managed to get the border that I want, I also could use pictureboxes for the min/max/close buttons?

But that's not exactly what I was looking for, I also have to code the move/drag behaviour of the app too then, since there is no controls anymore. Which is not that hard but... I want it another way.

Anyone can help me with that? I'm using C# in VS 2017 and I'd like to create the app either with Forms or WPF. Probably going for WPF.

Almost forgot to mention I don't really want to use 3rd party tools like MahApps, Metro Framework, etc.. Isn't there a build-in metro style option in VS or something? Rather in .NET framework.

I mean it's actually only these 3 buttons, min/max/close. And the border. That's all I need

Neuron
  • 5,141
  • 5
  • 38
  • 59
Eddd
  • 1
  • 2
  • Please don't post links to images on external sites and instead use the SO internal image uploader. If those sites ever take the pictures offline, your question will not make any sense to people coming here in the future. – Neuron Apr 18 '18 at 21:52

1 Answers1

0

It's quiet simple , if you wanna drag the window , make use of the DragMove method :

 private void WhatEverControlYouWanttoUseToClickAndDrag_MouseDown()
  { 
    DragMove();
  )

The rest

You can simply use Image control.You can add any image you want to display.Put it above a Rectangle and use it.

Explanation

Image control comes from the System.Windows.Controls namespace.Rectangle control is no different.Now, you might ask ,why am i not suggesting Button ? Well, you can use a button but you cannot achieve your required looks with it unless you go with ControlTemplate,which,for a beginner, i would not suggest at all.

You can use a Rectangle,set a Fill color.Now, what if you want to change the color when the mouse is over the rect ? Well, here's a sample XAML that'll also add an animation to the color-changing :)

 <Rectangle >
   <Rectangle.Triggers>
     <EventTrigger RoutedEvent="MouseEnter">
       <BeginStoryboard>
         <Storyboard>
           <ColorAnimation Storyboard.TargetProperty="Fill" Value = "Blue" Duration="0:0:0.3"/>
          ///Add required closing tags please

Now, about the Image control.When you place it over the rectangle , you need to set the IsHitTestVisible property to False which will prevent any sort of mouse interaction on/with it which will also prevent the interference between the Image and the Rectangle. :)

One last tip , if you want to have the Image control apply the clearest look/best quality on the image,make sure to set BitmapScalingMode to Fant :

 <Image Source="\ac.png" RenderingOptions.BitmapScalingMode="Fant"/>
Software Dev
  • 5,368
  • 5
  • 22
  • 45