473,811 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving a drawing

Ok so im going intomaking a tetris type program and was wondering how i would
move the drawing after i have crated the shape for the shape i have this code
....

Public Class Form1

Public Sub PictureBox1_Pai nt1(ByVal sender As System.Object, ByVal
Block1 As System.Windows. Forms.PaintEven tArgs) Handles PictureBox1.Pai nt
Block1.Graphics .FillRectangle( Brushes.Blue, 0, 0, 25, 30)
Block1.Graphics .FillRectangle( Brushes.Blue, 25, 0, 25, 30)
Block1.Graphics .FillRectangle( Brushes.Blue, 25, 25, 25, 30)
Block1.Graphics .FillRectangle( Brushes.Blue, 50, 25, 25, 30)

End Sub

End Class

This makes a block that looks like two retangles overlapped.. now how would
i go about putting movement to this whole shape. Im assuming that i went
ahead and mde each of the blocks within the shape its own block so when you
have to dealeate a line of blocks it will be easier. But for now all i have
to know is how to put a downward movement to the blocks.

Jan 15 '06 #1
4 2065

"easily confused" <ea************ @discussions.mi crosoft.com> wrote in
message news:AC******** *************** ***********@mic rosoft.com...
Ok so im going intomaking a tetris type program and was wondering how i
would
move the drawing after i have crated the shape for the shape i have this
code


Usually draw the figure, erase it, draw it somewhere else!
Jan 15 '06 #2
well im clueless on how you would erase it but could i make some kind of loop
some how ... then how would i refrence the x and y coordinates to change
within the sub class

block1.fillrect angle (10,10,10,10)
^ ^
I I
(those two number)
Jan 15 '06 #3

"easily confused" <ea************ @discussions.mi crosoft.com> wrote in
message news:80******** *************** ***********@mic rosoft.com...
well im clueless on how you would erase it but could i make some kind of
loop
some how ... then how would i refrence the x and y coordinates to change
within the sub class

block1.fillrect angle (10,10,10,10)
^ ^
I I
(those two number)


I'm not sure VB.Net uses this now - but the older Windows OS USED to use
functions like BitBlit to move objects.

Search for (PPT2000: Sample Visual Basic Code for Moving Objects On Screen
During a Slide Show)

and (PSS ID Number: Q222764) for possible hints.

Did you download the Blackjack demo solution?

Jan 15 '06 #4
If you have a shape that you want to move around, suggest you might use a
bitmap to draw it to. Use BitBlt to copy to the screen's or a control's
graphic's object. Before you copy it to one place, you can save the
background area to a bitmap then when moving the image, replace the screen
area from the saved bitmap then copy your bitmap to the new position.

Also, it might work if you just had a timer and called the .invalidate or
refresh method. This will restore your screen to what it was before you
added the shape and you can then change the shape's postion in the paint
event each time it's called. Might work but never tried it.
--
Dennis in Houston
"easily confused" wrote:
well im clueless on how you would erase it but could i make some kind of loop
some how ... then how would i refrence the x and y coordinates to change
within the sub class

block1.fillrect angle (10,10,10,10)
^ ^
I I
(those two number)

Jan 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1565
by: Ron Mexico | last post by:
Hi, Currently have an app that maintain that is written in VB6 and uses an access db (backend db only used as a data store not writing to the db). This app is a client app not server multi-teir app. It multi-form app that takes in a lot of user input and gives out high end calculations (engineering app). This app is starting to grow beyond the design and becoming very hard to maintian. I was considering moving it to C#. All of our new...
0
1255
by: Gino | last post by:
Hi, I wish to code a control that writes a text over a picturebox and that can be dragged with mouse. Here is what i've actually coded to obtain a similar effect, but as you can see i've serious problems with trasparence Create new project and add a button in the form and then insert a background image to the form itself.
1
2721
by: siliconpi | last post by:
I'm looking for the simplest and cleanest way of having 10 buttons on a form, on which if I move my mouse over, a label's text changes as specified. I'm using Visual Basic .NET and I'm not too familiar with its intricacies, so I'm getting a bunch of errors on certain scenarios. The code below works fine but breaks if I click on Button1 a few times without moving the program window ----------
3
3037
by: Just Me | last post by:
If I move the mouse cursor over a control and stop moving I get a MouseHover event. If I then move the cursor while staying within the control and then stop moving I do not get another MouseHover event. To get a Mousehover I must leave and reenter the control. I'd like to get an event each time the cursor stops moving.
2
3116
by: Carl Gilbert | last post by:
Hi I have a math kinda problem where I'm trying to split some lines when two or more lines connect two shapes. The reason I am doing this is to make it clear that there are multiple lines connecting the two shapes. http://www.blackwaterbadgers.co.uk/image1.bmp Image 1 shows how if you have a line between two shapes, the line is straight. if you have more than one line, the lines will start overlapping
9
2992
by: Peter Webb | last post by:
I want to animate one object moving in front of another. I cannot re-render the background as the object moves, as it would be extremely time consuming. This is what I would like to do. I draw the background to a Graphics object, copy it, draw the front object on the original, render it to the screen, then reload the copy (Clone?) of the background for the next loop. I couldn't find any way of doing this directly, and if there is I...
1
3985
by: taishin | last post by:
so far i got this... but the shapes that i created i need to be able to click and dragg and move around with the mouse..help!!!! and also some where here i need to draw and equal sided triangle IN PANEL import java.awt.*; import java.awt.Color;
12
1930
by: =?Utf-8?B?TWFyaw==?= | last post by:
I modified a C# application from Bob Powell that moves graphics primitives around on the screen into a Vb.NET 2005 application. I want to modify this application so along with moving regular geometric shapes, I can also move the alphanumeric characters as well. For example I place the character "A" on the screen and when I point to it with the mouse the character will be outlined and while holding down the left mouse button move the "A"...
15
2454
by: mcjason | last post by:
I saw something interesting about a grid pair puzzle problem that it looks like a machine when you find each that work out the way it does and say with all the others that work out the way they do together overlapping common pieces but say connected each working out as connected, but together as connected it's connected with the others connected. a whole machine where connected together is a condition of the machine together as...
6
7526
by: bradyounie | last post by:
I'm writing a program that displays a user-supplied Bitmap and then writes text fields to it. These "text fields" are things that the user can move around on the image, but to render them efficiently, I draw the text directly to the image. It's faster that way. The problem is that right now I have to redraw the original (unwritten-to) bitmap and redraw the text whenever the user moves the text because I haven't figured out how to properly...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.