I'm currently working on an UML project. Right now, I have to figure out, how to move a class with all it's attributes by clicking and dragging. As of right now, the class is constructed with 2 rectangles and a draw string for the attributes and class name.
I probably have to put all of this into a list and then assign a mousedown event, however, I do not know how.
private void button1_Click(object sender, EventArgs e)
{
Properties fcm = new Properties();
DialogResult dr = fcm.ShowDialog();
foreach (var r in rects)
{
if (dr == DialogResult.OK)
{
Graphics graph = pictureBox1.CreateGraphics();
graph.Clear(Color.WhiteSmoke);
Graphics g = pictureBox1.CreateGraphics();
string nazev = fcm.GetNazev();
gr = pictureBox1.CreateGraphics();
Vykreslování vykres = new Vykreslování();
vykres.třída(40, 40, 200, 170, gr, nazev);
gr = pictureBox1.CreateGraphics();
Vykreslování vykres1 = new Vykreslování();
vykres1.třída(40, 40, 200, 25, gr, nazev);
using (Font myFont = new Font("Arial", 14))
{
g.DrawString(nazev, myFont, Brushes.Black, new Point(Convert.ToInt32((vykres1.Width - vykres1._TextWidth) / 2 + vykres1.Xpos), Convert.ToInt32(vykres1.Ypos + 5)));
This is what I use for creating the class itself. As you can see, I've tried putting it into a list via foreach, but it does not seem to be working.