In VB6 scaling a picturebox was done like this: Me.picturebox.scale
(0,25)-(25,0) How is it done in VB.NET ?
Also, I want to draw simple lines and circle in a coordinate system on
the picturbox. Something like a bull's eye.
Also, how do i save registry values on a system?
Thanx, Yemmy.
Less capable - no
Higher learning curve - yes
Anything you can do in VB6 can be done in Visual Basic .Net. It might
be harder at first to get the same results, but after you are used to
the methodology, it is pretty simple. Like Cor I can't really remember
why we used Scale - but I seem to remember it was just to set an
offset for drawing. In .Net instead of saying a certain point will act
as point (0, 0) you just specify the point you want to start drawing
at (such as (50, 50)). I could be wrong in my memory - I've left VB
classic in the past.
For drawing here is a simple windows form that will draw a bullseye
into a picturebox. Just add the code to the code behind of a new form
and run it.
/////////////////
Imports System.Drawing
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim pictureBox As New PictureBox()
pictureBox.Size = New Size(100, 100)
pictureBox.Location = New Point(25, 25)
pictureBox.BackColor = Color.White
AddHandler pictureBox.Paint, AddressOf pictureBox_Paint
Me.Controls.Add(pictureBox)
End Sub
Private Sub pictureBox_Paint(ByVal sender As Object, ByVal e As
PaintEventArgs)
Dim graphics As Graphics = e.Graphics
Using redCirclePen As New Pen(Color.Red, 10)
graphics.DrawEllipse(redCirclePen, 4, 4, 91, 91)
graphics.DrawEllipse(redCirclePen, 24, 24, 51, 51)
graphics.FillEllipse(Brushes.Red, 40, 39, 20, 20)
End Using
End Sub
End Class
/////////////////
Thanks,
Seth Rowe