tags:

views:

1515

answers:

4

How can I draw a concave corner rectangle in WPF?

A: 

Care to extrapolate?

Marcus Cicero
+2  A: 
do you mean a rectangle with concave corners?, ie: 
     ____________________
    |                    |
  __|                    |__
 |                          |
 |                          |
 |                          |
 |__                      __|
    |                    |
    |____________________|

Given a rectangle of dimension w x h with corner radius r There are 4 corners:

A :  0,0
B :  w,0
C :  w,h
D :  0,h

There is an implicit minimum size of

w = 2r
h = 2r

There are 4 Circle Centers, A,B,C,D

And there's thus a grid of edge points:

(0,0)--(0+r,0)---(w-r,0)---(w,0)
|                              |
(0,0+r)                  (w,0+r)
|                              |
|                              |
(0,h-r)                  (w,h-r)
|                              |
(0,h)--(0+r,h)---(w-r,h)---(w,h)

Then its merely a case of computing the arc from one point to another.

Kent Fredric
+3  A: 
Jobi Joy
Thank you, I asked this question on a different forum and got the same solution by using the Path function in WPF.
Bob Kerlinger
A: 

I should point out that if it's concave, the four sides aren't both identical and straight; thus it's not a rectangle. But I digress.

tsilb