Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Geometry path relative to edges of Grid or Canvas

 
 
Old 01-31-2006   #1 (permalink)
Griff


 
 

Geometry path relative to edges of Grid or Canvas

I am trying to draw a rectangle with 2 radiused corners, that will fill the
grid into which it is placed. As I only want 2 radiused corners I can't
use a std rectangle.

All the samples I have seen use constant values for the coordinates in the
geometry path and I can't seem to use "Margin" or "Grid.Left" tricks in this
instance.

Any suggestions ?

Thanks


--
Griff
(trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
viliescu


 
 

RE: Geometry path relative to edges of Grid or Canvas

Some ideas:

1. Use 3 rectangles, one will be with corners, the other two will hide 2 of
the corners
<Grid>
<Rectangle RadiusX="10" RadiusY="10" Fill="Blue"/>
<Rectangle Margin="10,10,0,0" Fill="Blue"/>
<Rectangle Margin="0,0,10,10" Fill="Blue"/>
</Grid>

2. Divide the space using a grid with 3 rows and 3 columns. The
widts(heights) for columns(rows) will be 10,*,10 and put the appropriate
figures in its cells

3. Make a custom control which will contain a Path. Override Measure/Arrange
and modify the Path points in it.
--
Valentin Iliescu [MVP C#]


"Griff" wrote:

> I am trying to draw a rectangle with 2 radiused corners, that will fill the
> grid into which it is placed. As I only want 2 radiused corners I can't
> use a std rectangle.
>
> All the samples I have seen use constant values for the coordinates in the
> geometry path and I can't seem to use "Margin" or "Grid.Left" tricks in this
> instance.
>
> Any suggestions ?
>
> Thanks
>
>
> --
> Griff
> (trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
Old 01-31-2006   #3 (permalink)
Griff


 
 

RE: Geometry path relative to edges of Grid or Canvas

> 1. Use 3 rectangles, one will be with corners, the other two will hide 2 of
> the corners
> <Grid>
> <Rectangle RadiusX="10" RadiusY="10" Fill="Blue"/>
> <Rectangle Margin="10,10,0,0" Fill="Blue"/>
> <Rectangle Margin="0,0,10,10" Fill="Blue"/>
> </Grid>



This unfortunately is not an option, as the shape is to be used for a
shadow with about 50% Alpha. Overlapping shapes makes a double density
shadow.

>
> 2. Divide the space using a grid with 3 rows and 3 columns. The
> widts(heights) for columns(rows) will be 10,*,10 and put the appropriate
> figures in its cells


This is definitely the answer in this case !
Many thanks.

> 3. Make a custom control which will contain a Path. Override Measure/Arrange
> and modify the Path points in it.


For a solid shape this may not be necessary, but where I want the actual
outline this may prove necessary.

> --
> Valentin Iliescu [MVP C#]
>
>
> "Griff" wrote:
>
> > I am trying to draw a rectangle with 2 radiused corners, that will fill the
> > grid into which it is placed. As I only want 2 radiused corners I can't
> > use a std rectangle.
> >
> > All the samples I have seen use constant values for the coordinates in the
> > geometry path and I can't seem to use "Margin" or "Grid.Left" tricks in this
> > instance.
> >
> > Any suggestions ?
> >
> > Thanks
> >
> >
> > --
> > Griff
> > (trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Relative Path Completion PowerShell
How is relative path resolution done by cmdlets? PowerShell
BUG? (Test-Path $path -IsValid) and empty $path PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46