Welcome to Dream.In.Code
Become a VB Expert!

Join 137,232 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,808 people online right now. Registration is fast and FREE... Join Now!




Question - Draw a square with "line commands" then add image

 
Reply to this topicStart new topic

Question - Draw a square with "line commands" then add image, Question -

bymp
6 Feb, 2007 - 05:31 PM
Post #1

New D.I.C Head
*

Joined: 6 Feb, 2007
Posts: 15


My Contributions
Im trying to take basic line commands and have them form a square. On the face of the square i need to add an image, and im having some problems doing so.

Im starting from scratch on this and i have been away from visual basic for a while. This is a home project and just needing a little help. Any help would be great.

Im sorry, but putting the code for drawing cube with basic line commands didn't seem like it was needed. Im trying to find a way to add an image in between the lines. Any help would be thankful.

This post has been edited by bymp: 6 Feb, 2007 - 06:11 PM
User is offlineProfile CardPM
+Quote Post

m2s87
RE: Question - Draw A Square With "line Commands" Then Add Image
6 Feb, 2007 - 10:53 PM
Post #2

D.I.C Regular
Group Icon

Joined: 28 Nov, 2006
Posts: 390



Thanked: 1 times
Dream Kudos: 1225
My Contributions
QUOTE(bymp @ 7 Feb, 2007 - 03:31 AM) *

Im trying to take basic line commands and have them form a square. On the face of the square i need to add an image, and im having some problems doing so.

Im starting from scratch on this and i have been away from visual basic for a while. This is a home project and just needing a little help. Any help would be great.

Im sorry, but putting the code for drawing cube with basic line commands didn't seem like it was needed. Im trying to find a way to add an image in between the lines. Any help would be thankful.

What basic are you using?

Can you draw 2 px line?
Can you draw the line to specific location?
Do you know what radius is?
Can you calculate a vector?
Can you draw 1/4 of circle?

It is not very hard thing to do, but you need to start it for yourself. We can help you on the way, if you have a problem that you can not solve.

Hope it helped biggrin.gif
User is offlineProfile CardPM
+Quote Post

m2s87
RE: Question - Draw A Square With "line Commands" Then Add Image
7 Feb, 2007 - 08:08 AM
Post #3

D.I.C Regular
Group Icon

Joined: 28 Nov, 2006
Posts: 390



Thanked: 1 times
Dream Kudos: 1225
My Contributions
I made a demo in vb.net:
CODE
        Dim paljuon As Integer = CInt(Val(Me.tekst.Text))
        Dim raadius As Integer = CInt(Val(Me.tekst2.Text))
        Dim a As Single, b As Single, c As Single
        Dim q As Single = 20 + raadius * 2

        Using MyPen As New Pen(Color.LightBlue, CInt(Val(Me.tekst3.Text))), _
            taust As Graphics = Me.CreateGraphics()

            Dim x1 As Single = 10 + raadius
            Dim y1 As Single = 10 + raadius
            Dim x2 As Single
            Dim y2 As Single

            For i As Integer = 1 To paljuon
                a = CType(raadius / paljuon, Single) * i
                c = raadius
                b = CType(Math.Sqrt(c ^ 2 - a ^ 2), Single)

                x2 = 10 + raadius + a
                y2 = 10 + b

                taust.DrawLine(MyPen, x1, q - y1 - raadius, x2, q - y2 - raadius)
                taust.DrawLine(MyPen, q - x1, q - y1 - raadius, q - x2, q - y2 - raadius)
                taust.DrawLine(MyPen, x1, y1 + raadius, x2, y2 + raadius)
                taust.DrawLine(MyPen, q - x1, y1 + raadius, q - x2, y2 + raadius)

                x1 = x2
                y1 = y2
                Application.DoEvents()
            Next
        End Using

Probably one could correct math a bit, but basically, it works tongue.gif

Hope it helped

User is offlineProfile CardPM
+Quote Post

bymp
RE: Question - Draw A Square With "line Commands" Then Add Image
7 Feb, 2007 - 03:38 PM
Post #4

New D.I.C Head
*

Joined: 6 Feb, 2007
Posts: 15


My Contributions
Im using VB6. Basicaly i want to take a command such as draw line. Im not sure how to go about using this command to do as i need but if its possible to do it using these commands or anything else, it would help a ton. And the code listed above would work on my .net, but im using vb6 and it doesnt work =s Vb6 is less of a hasle to me.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 03:32PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month