Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

262
Visualizações
How can I get the size of a Chart before it's drawn?

Edit: I'm using VB.NET in Visual Studio 2019

I have a chart on a modal form with a single ChartArea that displays a line graph. I need the axes of the chart to be scaled 1:1 relative to each other. In other words, no distortion/stretch. I need the the same number of pixels-per-unit on each axis.

I'm able to get the charts axes min and max values (and use an algorithm to force them to be "pretty") numbers. So all I need to do is set the size of the plotted area in pixels based on the ratio of the axes value ranges.

I know the size of the plotted area is dependent on the ChartArea.Position and ChartArea.InnerPlotPosition size properties (which are 0 - 100 values that describe their percentage size relative to their containers). The problem is this: When I poll these properties during the form load, they both come up as zero. The chart displays the data and everything works, I'm just not able to resize it as I want to during load because these size values are apparently not set yet.

If I close the modal form and launch it again, then the properties populate with non-zero values. But I really need it to work the first time.

I've tried using .Refresh(), .Invalidate, and .PerformLayout() on both the Chart and the Form during the load event. I've also tried programmatically launching the form twice in rapid succession. I've tried moving the check of those properties to a subroutine that runs at the end of the form load. Nothing works.

Is there any way to know those size percentages during the load event? Thank you for your help.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda