Visual C# Help
I'm creating a DLL that will create 4 objects and place them on a form using custom made methods. The logic I've put into this should work, but it's not. I don't understand why. In a blank DLL I need a method called Create(int x, int y) that will assign the location for all 4 objects. The objects are arranged in a 4 square style pattern so simple location math is required. My problem is creating the objects and placing them on the form in the user's project. My pseudo code is:
The idea is to make all 4 objects into a single object. Implementation into a forms application would be like:
That's pretty much all I have to go on. C# and .NET are easy to convert back and forth (except for a few minor classes and methods). Much thanks to whoever helps.
Code:
// Had to add most of these manually.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClassLibraryExample
{
public class Class1
{
private int x;
private int y;
public void Create(int x, int y)
{
object1.Location = new Point(x, y);
object2.Location = new Point(x + 10 + object.Width, y);
object3.Location = new Point(x + 10 + object.Width, y + 10 + object.Height);
object4.Location = new Point(x, y + 10 + object.Height);
}
}
}
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClassLibraryExample;
namespace FormExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Class1.Create(50, 50);
}
}
}

