View Full Version : Drawing on Non-Client Areas
Templarian
November 24th, 2007, 01:52 AM
http://www.codeplex.com/Wiki/View.aspx?ProjectName=CustomerBorderForm&title=Painting%20NonClient%20Area
I need to draw on the title bar... is there simple ways to do this (I don't know if the newer versions made it easier)... this current way seems like a real pain.
kk... thx for any advice, going to bed now.
kirupa
November 24th, 2007, 03:40 AM
For WinForms, I don't know of an easier way. For WPF, it is quite easy. You can even do that graphically using a WPF editor like VS2008's Designer or Expression Blend :nerd:
Templarian
November 24th, 2007, 01:28 PM
Draw on the Title Bar?
I thought it would be as easy as moving the grid up above the title bar but yea nothing. Any help would be appreciated.
Another easy question probably:
I have an image in my resources for <image source=""> how do i reference that its in my resources. I mean Resources/image.png works but is that right.
If this helps.
<Window x:Class="GlassWPFApp.editor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My Little Program" Height="600" Width="800"
x:Name="MainWindow" xmlns:d="http://schemas.microsoft.com/expression/interactivedesigner/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" WindowStyle="ThreeDBorderWindow" Loaded="MainWindow_Loaded">
<Window.Resources>
</Window.Resources>
<Grid x:Name="Grid" Margin="0,-22,0,0">
<Button Height="50" Margin="43,0,0,0" Name="button1" VerticalAlignment="Top" Click="button1_Click" HorizontalAlignment="Left" Width="75">
Button
</Button>
</Grid>
</Window>
http://img405.imageshack.us/img405/9606/exampleimagesp2.png
I googled it and got taken to this thread http://www.google.com/search?q=draw+on+non-client+in+WPF&btnG=Search&hl=en&safe=off
I've started working past this problem hoping someone will have a solution in the future.
kirupa
November 24th, 2007, 04:14 PM
You have to essentially hide the title bar and re-create it yourself. Make the titlebar as part of your main Layout itself.
For the Resources question, when you deploy your application, do things still work? If they do, then there isn't anything to worry about. Though, the preferred way is to use the pack/uri syntax I explain here: http://www.kirupa.com/net/resources_pg3.htm
:)
Templarian
November 24th, 2007, 05:45 PM
and essentially recreate all the close buttons ect... or is there a control for those because it would be kind hard to recreate that glow effect ect. And if i set formborder to "none" I can't even use the Aero effects on the form.
yep that resource tutorial will do nicely just how do i link to it in xaml
This Works. But is it right?
<Image Source="Resources/officebutton.png" />
This Doesn't work (don't know why it would but worth a try).
<Image Source="pack://application:,,,/officebutton.png" />
kirupa
November 24th, 2007, 05:54 PM
Yes, it is right - there is nothing wrong with using that particular format for accessing resources.
Regarding the title/border issue, there is no control for the minimize, maximize, and close buttons. You will have to re-create them yourself, but if you use the right tools, creating those rollover effects for a button should not be difficult.
Now, resizing the window though, may be a bit tricky!
Cheers!
Kirupa :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.