Extend and Overload MS and Point Types
Posted
by
dr d b karron
on Stack Overflow
See other posts from Stack Overflow
or by dr d b karron
Published on 2010-12-30T06:34:21Z
Indexed on
2010/12/30
15:54 UTC
Read the original article
Hit count: 264
Do I have make my own Point and Vector types to overload them ? Why does this not work ?
namespace System . windows
{
public partial struct Point : IFormattable
{
public static Point operator * ( Point P , double D )
{
Point Po = new Point ( );
return Po;
}
}
}
namespace SilverlightApplication36
{
public partial class MainPage : UserControl
{
public static void ShrinkingRectangle ( WriteableBitmap wBM , int x1 , int y1 , int x2 , int y2 , Color C )
{
wBM . DrawRectangle ( x1 , y1 , x2 , y2 , Colors . Red );
Point Center = Mean ( x1 , y1 , x2 , y2 );
wBM . SetPixel ( Center , Colors.Blue , 3 );
Point P1 = new Point ( x1 , y1 );
Point P2 = new Point ( x1 , y2 );
Point P3 = new Point ( x1 , y2 );
Point P4 = new Point ( x2 , y1 );
const int Steps = 10;
for ( int i = 0 ; i < Steps ; i++ )
{
double iF = (double)(i+1) / (double)Steps;
double jF = ( 1.0 - iF );
Point P11 = **P1 * jF;**
}
}
© Stack Overflow or respective owner