Home All Groups Group Topic Archive Search About
Author
20 Oct 2005 5:09 AM
StudentDeveloper12
Hello all,

I was trying to build a program for a class that im taking (which is basic
VB.NET) and the program is supposed to take a image that I create with
points and rotate it.

The problem im having is i used an if statement to move the image; but its
not moving like I want it to. i'm trying to when I click the shape button,
to get the shape to keep rotating, which the compiled program does not do;
its more like a stretch.

So I was wondering if I could get some help on rotating shapes, so I can
understand it better for my quiz next week.

Thank you,

Matthew Gonzalez


Attached Code:
Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents btnShape As System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.btnShape = New System.Windows.Forms.Button

Me.SuspendLayout()

'

'btnShape

'

Me.btnShape.Location = New System.Drawing.Point(8, 336)

Me.btnShape.Name = "btnShape"

Me.btnShape.TabIndex = 0

Me.btnShape.Text = "Shape"

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(448, 366)

Me.Controls.Add(Me.btnShape)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Const waittime = 5000

Public Sub wait()

Dim i As Integer

For i = 0 To waittime



Next

MsgBox("Rotate")

End Sub

Private Sub btnShape_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnShape.Click

Dim i As Integer

For i = 0 To 100

Dim shiftx As Integer = 20 + i

Dim shifty As Integer = 20 + i


createShape(shiftx, shifty)

wait()

Next




End Sub

Public Sub createShape(ByVal shiftx As Integer, ByVal shifty As Integer)

Try

'get size of form

Dim formX As Integer

Dim formY As Integer

formX = Me.Size.Width

formY = Me.Size.Height

'institute graphics

Dim grpGraphics As System.Drawing.Graphics

'setup graphics on form

grpGraphics = Me.CreateGraphics

'create dots for shape

Dim pntPoints(3) As Point

'define points of shape

'first point

pntPoints(0).X = 50 + shiftx * 2

pntPoints(0).Y = 50 - shifty * 2

'second point

pntPoints(1).X = 50 - shiftx / 2

pntPoints(1).Y = 100 + shifty / 2

'third point

pntPoints(2).X = 100 - shiftx * 2

pntPoints(2).Y = 100 + shifty * 2

'fourth point

pntPoints(3).X = 100 + shiftx / 2

pntPoints(3).Y = 50 - shifty / 2



'define pen to draw with

Dim pen As New Pen(Color.Black, 3)

'draw triangle

grpGraphics.DrawPolygon(pen, pntPoints)

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

End Class

Author
20 Oct 2005 6:42 AM
Mike Williams
"StudentDeveloper12" <ge***@askme.com> wrote in message
news:%23pmL1QT1FHA.2072@TK2MSFTNGP14.phx.gbl...

> I was trying to build a program for a class that im taking
> (which is basic VB.NET)

VB.what?
Are all your drivers up to date? click for free checkup

Author
20 Oct 2005 7:36 AM
StudentDeveloper12
The Microsoft Visual Studio.NET package that you can do c++ in and VB....
version 2003.


Show quoteHide quote
"Mike Williams" <M***@WhiskyandCoke.com> wrote in message
news:dj7ea0$sjn$1@newsg2.svr.pol.co.uk...
> "StudentDeveloper12" <ge***@askme.com> wrote in message
> news:%23pmL1QT1FHA.2072@TK2MSFTNGP14.phx.gbl...
>
>> I was trying to build a program for a class that im taking
>> (which is basic VB.NET)
>
> VB.what?
>
>
>
>
Author
20 Oct 2005 11:08 AM
Mike Williams
"StudentDeveloper12" <ge***@askme.com> wrote in message
news:O18PDjU1FHA.2792@tk2msftngp13.phx.gbl...

> The Microsoft Visual Studio.NET package that you can do
> c++ in and VB.... version 2003.

Oh. VB. I see. And what do the initials "VB" stand for? Surely they cannot
be trying to pretend that it has got something to do with "Visual BASIC"!

Mike
Author
20 Oct 2005 7:49 AM
Rick Rothstein [MVP - Visual Basic]
Almost everybody in this newsgroup is using VB6 or lower. While
you may get a stray answer to VB.NET (including VB2003 and VB2005
which has dropped .NET from its name) questions here, you should
ask them in newsgroups devoted exclusively to .NET programming.
Look for newsgroups with either the word "dotnet" or "vsnet" in
their name.

For the microsoft news server, try these newsgroups for Visual
Basic .NET related questions...

   microsoft.public.dotnet.languages.vb
   microsoft.public.dotnet.languages.vb.upgrade
   microsoft.public.dotnet.languages.vb.controls
   microsoft.public.dotnet.languages.vb.data

And these for more general .NET questions

   microsoft.public.dotnet.general
   microsoft.public.vsnet.general

Note: There are many other .NET newgroups (use the first three
"fields" from the last two as templates when searching for them),
but the above ones should get you started.

Rick



"StudentDeveloper12" <ge***@askme.com> wrote in message
news:%23pmL1QT1FHA.2072@TK2MSFTNGP14.phx.gbl...
> Hello all,
>
> I was trying to build a program for a class that im taking
(which is basic
> VB.NET) and the program is supposed to take a image that I
create with
> points and rotate it.
>
> The problem im having is i used an if statement to move the
image; but its
> not moving like I want it to. i'm trying to when I click the
shape button,
> to get the shape to keep rotating, which the compiled program
does not do;
> its more like a stretch.
>
> So I was wondering if I could get some help on rotating shapes,
so I can
Show quoteHide quote
> understand it better for my quiz next week.
>
> Thank you,
>
> Matthew Gonzalez
>
>
> Attached Code:
> Public Class Form1
>
> Inherits System.Windows.Forms.Form
>
> #Region " Windows Form Designer generated code "
>
> Public Sub New()
>
> MyBase.New()
>
> 'This call is required by the Windows Form Designer.
>
> InitializeComponent()
>
> 'Add any initialization after the InitializeComponent() call
>
> End Sub
>
> 'Form overrides dispose to clean up the component list.
>
> Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
>
> If disposing Then
>
> If Not (components Is Nothing) Then
>
> components.Dispose()
>
> End If
>
> End If
>
> MyBase.Dispose(disposing)
>
> End Sub
>
> 'Required by the Windows Form Designer
>
> Private components As System.ComponentModel.IContainer
>
> 'NOTE: The following procedure is required by the Windows Form
Designer
>
> 'It can be modified using the Windows Form Designer.
>
> 'Do not modify it using the code editor.
>
> Friend WithEvents btnShape As System.Windows.Forms.Button
>
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
>
> Me.btnShape = New System.Windows.Forms.Button
>
> Me.SuspendLayout()
>
> '
>
> 'btnShape
>
> '
>
> Me.btnShape.Location = New System.Drawing.Point(8, 336)
>
> Me.btnShape.Name = "btnShape"
>
> Me.btnShape.TabIndex = 0
>
> Me.btnShape.Text = "Shape"
>
> '
>
> 'Form1
>
> '
>
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
>
> Me.ClientSize = New System.Drawing.Size(448, 366)
>
> Me.Controls.Add(Me.btnShape)
>
> Me.Name = "Form1"
>
> Me.Text = "Form1"
>
> Me.ResumeLayout(False)
>
> End Sub
>
> #End Region
>
> Const waittime = 5000
>
> Public Sub wait()
>
> Dim i As Integer
>
> For i = 0 To waittime
>
>
>
> Next
>
> MsgBox("Rotate")
>
> End Sub
>
> Private Sub btnShape_Click(ByVal sender As System.Object, ByVal
e As
> System.EventArgs) Handles btnShape.Click
>
> Dim i As Integer
>
> For i = 0 To 100
>
> Dim shiftx As Integer = 20 + i
>
> Dim shifty As Integer = 20 + i
>
>
> createShape(shiftx, shifty)
>
> wait()
>
> Next
>
>
>
>
> End Sub
>
> Public Sub createShape(ByVal shiftx As Integer, ByVal shifty As
Integer)
>
> Try
>
> 'get size of form
>
> Dim formX As Integer
>
> Dim formY As Integer
>
> formX = Me.Size.Width
>
> formY = Me.Size.Height
>
> 'institute graphics
>
> Dim grpGraphics As System.Drawing.Graphics
>
> 'setup graphics on form
>
> grpGraphics = Me.CreateGraphics
>
> 'create dots for shape
>
> Dim pntPoints(3) As Point
>
> 'define points of shape
>
> 'first point
>
> pntPoints(0).X = 50 + shiftx * 2
>
> pntPoints(0).Y = 50 - shifty * 2
>
> 'second point
>
> pntPoints(1).X = 50 - shiftx / 2
>
> pntPoints(1).Y = 100 + shifty / 2
>
> 'third point
>
> pntPoints(2).X = 100 - shiftx * 2
>
> pntPoints(2).Y = 100 + shifty * 2
>
> 'fourth point
>
> pntPoints(3).X = 100 + shiftx / 2
>
> pntPoints(3).Y = 50 - shifty / 2
>
>
>
> 'define pen to draw with
>
> Dim pen As New Pen(Color.Black, 3)
>
> 'draw triangle
>
> grpGraphics.DrawPolygon(pen, pntPoints)
>
> Catch ex As Exception
>
> MsgBox(ex.Message)
>
> End Try
>
> End Sub
>
> End Class
>
>
>
Author
20 Oct 2005 8:54 AM
J French
On Thu, 20 Oct 2005 01:09:03 -0400, "StudentDeveloper12"
<ge***@askme.com> wrote:

>Hello all,
>
>I was trying to build a program for a class that im taking (which is basic
>VB.NET) and the program is supposed to take a image that I create with
>points and rotate it.

Almost everybody in this newsgroup is using VB6 or lower. While
you may get a stray answer to VB.NET (including VB2003 and VB2005
which has dropped .NET from its name) questions here, you should
ask them in newsgroups devoted exclusively to .NET programming.
Look for newsgroups with either the word "dotnet" or "vsnet" in
their name.

For the microsoft news server, try these newsgroups...

news://msnews.microsoft.com/microsoft.public.dotnet.general
news://msnews.microsoft.com/microsoft.public.dotnet.languages.vb
news://msnews.microsoft.com/microsoft.public.vsnet.general
news://msnews.microsoft.com/microsoft.public.vstudio.general
news://msnews.microsoft.com/microsoft.public.vstudio.setup
news://msnews.microsoft.public.dotnet.languages.vb.upgrade
news://msnews.microsoft.public.dotnet.languages.vb.controls
news://msnews.microsoft.public.dotnet.languages.vb.data

There are some others, but these should get you started.

Bookmark and Share