1

My GUI draws a ERM for a database script. The contents of the database which are in a reference for example two entitys, are connected with lines. But all these lines are criss-cross. Each line cross over another line. So my question is, how i can draw this lines in a professional look. Here you can see the class which draws these lines.

class GuiReferenceModel
{
    int _xPos=0;
    int _yPos=0;
    GuiEntityModel _guiEM = null;
    HelperClass _helperClass;
    FieldModel _fm = null;
    Pen _pen;

    public GuiReferenceModel(FieldModel fm, GuiEntityModel guiEM)
    {
        _fm = fm;
        _guiEM = guiEM;
        _helperClass = new HelperClass();
        _pen = new Pen(Color.HotPink, 5);
    }

    public void Draw(Graphics gc, List<GuiEntityModel> GuiEntitys)
    {
        _xPos=_guiEM.getXPos()+_guiEM.getWidth();
        _yPos=_guiEM.getYPos()+(_guiEM.getHeight()/2);
        foreach (GuiEntityModel gem in GuiEntitys)
        {
            if (gem.GetName() == _fm.ReferencedField)
            {
                gc.DrawLine(_pen, _xPos, _yPos, gem.getXPos(), (gem.getYPos()+gem.getHeight()/2));
            }
        } 
    }
}

Thank you for help :D

4

0 回答 0