1. Start with going "file" then "new project", slect WPF Appliation and click ok.
2. Then download the DWM wrapper .dll here. Then click "project" and then "add reference". Navigate to browse along the tab bar and find the place were you have put the .dll and double click it. It will then be added to the references but dont move the .dll till you have done at least 1 compile.
3. Then add "using GlassLib;" like shown by simply typeing it in.
usingglasslib.jpg (150.33K)
Number of downloads: 105
4. Next go into the .xaml, you will see "Title="Window1"" if you havent renamed it already
Window_Loaded.jpg (171.28K)
Number of downloads: 112
5. Then pop into the .xaml.cs and paste this inbetween the brackets that will have been created >>
Bracket.jpg (176.31K)
Number of downloads: 77
This is what needs pasteing
CODE
Dwm.Glass[this].Enabled = true;
Thickness foo = new Thickness(5, 30, 5, 20);
Dwm.Glass[this].Margins = foo;
Thickness foo = new Thickness(5, 30, 5, 20);
Dwm.Glass[this].Margins = foo;
In this code the margins 5, 30, 5, 20 are Left, Right, Top, Bottom.
The code will then look like this >>
DWM.jpg (180.71K)
Number of downloads: 70
This is the end of the tutorial for implementing glass. If you would like to know how to extend the area that can be dragged into the glass area... read on...
6. Go into the .xaml design and create a lable that covers the whole of the glass area, then remove the text in it that will by default say "label".
7. Then go into the .xaml area and find the "label" line. Replace what it is on the label line with
CODE
<Label MouseDown="Extend_Grabber" MouseDoubleClick="Extend_MouseDoubleClick" />
It should then look like this >>
grabber_xaml.jpg (176.08K)
Number of downloads: 69
8. Right click on "Extend_Grabber " then click "navigate to even handler". You will be then be taken to the .xaml.cs code and inside the brackets copy and paste this
CODE
try
{
DragMove();
}
catch (System.InvalidOperationException)
{
return;
}
{
DragMove();
}
catch (System.InvalidOperationException)
{
return;
}
It should then look like this >>
grabber_cs.jpg (162.67K)
Number of downloads: 54]
9. Next go back to the .xaml and right click "Extend_MouseDoubleClick" on the label line, then click "navigate to event handler". Again you will be taken to the .cs code and inside the brackets copy and paste this
CODE
if (this.WindowState == WindowState.Maximized)
{
this.WindowState = WindowState.Normal;
}
else
{
this.WindowState = WindowState.Maximized;
}
{
this.WindowState = WindowState.Normal;
}
else
{
this.WindowState = WindowState.Maximized;
}
It should then look like this >>
double_click_cs.jpg (176.1K)
Number of downloads: 101
10. Then go back to the .xaml design and drag the label back to the full size.
11. Give yourself a pat on the back you've done it
Note:Remember to change the margins of the glass to suit your application
Credits to Panda X for telling me how to do it, then i wrote the tut.
Sign In
Register
Help



MultiQuote


News Poster