Академический Документы
Профессиональный Документы
Культура Документы
CLASE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompartirObjetos
{
public class ClsPto
{
double x;
double y;
public double px
{
get { return x; }
set { x = value; }
}
public double py
{
get { return y; }
set { y = value; }
}
}
}
FORM1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CompartirObjetos
{
public partial class Form1 : Form
{
// anteponer static para conservar valores
static ClsPto [] p = new ClsPto[50];
int IP;
public Form1()
{
InitializeComponent();
}
}
public double retpx(int I)
{
if (p[I] == null)
return 0;
else
return p[I].px;
}
public double retpy(int I)
{
if (p[I] == null)
return 0;
else
return p[I].py; }
}
}
FORM1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CompartirObjetos
{
public partial class Form2 : Form
{
int IP;
public Form2()
{
InitializeComponent();
}
}
}
}