Jump to content

Recommended Posts

Posted

Boas, tenho o seguinte codigo:

Private Sub Calcular()
        Dim ComprimentoBase As Integer = NumericUpDown1.Value
        Dim ComprimentoPecas As Integer = NumericUpDown2.Value
        Dim ComprimentoPecasss As Integer = NumericUpDown3.Value

        Dim conta1 As Integer = ComprimentoPecasss * ComprimentoPecas
        TextBox1.Text = conta1


        Dim nr1 As Integer = NumericUpDown1.Value - conta1
        TextBox3.Text = nr1

        Dim nr2 As Integer = NumericUpDown1.Value - nr1
        TextBox4.Text = nr2


        Dim Divisoes As Double = ComprimentoBase / ComprimentoPecas


        Dim ComprimentoPorporcional As Integer = CInt((NumericUpDown2.Value * PB.Width) / nr2)

        Dim g As Graphics = PB.CreateGraphics
        g.Clear(Color.White)

        Dim ActPeca As Integer = 1

        For i As Integer = 0 To PB.Width Step ComprimentoPorporcional
            g.DrawLine(Pens.Red, i, 0, i, PB.Height)
            If ActPeca <= Divisoes Then g.DrawString(ActPeca, New Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.RoyalBlue, i, 0)

            ActPeca += 1
        Next

    End Sub

E o que eu quero que o codigo faça e o seguinte, que divida a picturebox que é com a medida de 6500 por o numero de peças de uma medida, como por exemplo dividir uma regua de 10 metros em 2 bocados de 3 metros, nao sei se me fiz entender;)

o codigo nao esta a dar erros, e até desenha, mas não é no tamanho de 6500

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.