Home Forums WinForms controls Xceed Chart for WinForms Margins in pixels rather than in %

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18856 |

    is it possible to define margins in pixels rather than in% ?

    here is a little example :
    you set the margin to (10,10, 90, 90)
    you have a 100×100 form your margin is 10 pixels and render as you want but the user resizer de form to 500×500 and now your margin is now 50 pix and it’s ….ugly

    Imported from legacy forums. Posted by jo (had 2175 views)

    User (Old forums)
    Member
    Post count: 23064

    ok i found a solution by myself :

    private void SetMarginSize(float left, float top, float right, float bottom)
    {
    float largeur = this.Width;
    float hauteur = this.Height;

    float percGauche = left / (largeur / 100);
    float percHaut = top / (hauteur / 100);

    float percDroite = 100 – (right / (largeur / 100));
    float percBas = 100 – (bottom / (hauteur / 100));

    this.m_chart.Margins = new RectangleF(percGauche, percHaut, percDroite, percBas);
    }

    Imported from legacy forums. Posted by jo (had 3095 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.