473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Splitting a Form

Ali Rizwan
925 512MB
Hi
Any boduy know that how to split a form into two or four parts so that i can make an animation.
Thanx
Sep 2 '07 #1
15 2435
sgrec7
59
hi

i dont really know what you mean by "splitting a form" but if its just a visual thing, then you could use the line tool to divide the form (visualy) and work out were the middle of the form is with the .top and .left values

hope it helps

sgrec7
Sep 2 '07 #2
sgrec7
59
Are you still on for that game making thing in that other thread??

if so could you please PM me instead of using a thread (i only regularly check new threads) (i got in trouble for necro'ing old threads)

hope to hear from you soon

sgrec7
Sep 3 '07 #3
debasisdas
8,127 Expert 4TB
Try to use any container control like picturebox or frame.
Sep 3 '07 #4
Robbie
180 100+
You would need to use 4 more forms.
Set the border style to the 4 forms to 0 - None.
In code, we'll make each of the 4 forms half the height and width of the form you want to make look like has been split (i.e. so if you put them all together in a rectangle, it's the same size as that form), so don't worry about their size. Make a PictureBox in each of the 4 forms, with Top-Left position at 0,0. In code, we'll set their size to fill the forms fully.

For each of the 4 PictureBoxes and each of the forms which they are on, set each of their ScaleMode properties to 3 - Pixel. Also set each of their AutoRefresh properties to True.

Then you'll need to use this Bit-Block Transfer ('Blitting') Module to copy the graphics - i.e. whatever is being shown on the main form - in 4 goes onto each of the 4 forms. For example, if the main form is 400x800, you'd need to copy in 4 goes of 100x200, with the top-left position at:

0,0 (Top-left of form into the first of the 4 small forms)
100,0 (Top-right of form into the second of the 4 small forms)
0,100 (Bottom-left of form into the third of the 4 small forms)
100,100 (Bottom-right of form into the last of the 4 small forms)

Expand|Select|Wrap|Line Numbers
  1. Public Declare Function BitBlt Lib "GDI32" _
  2. (ByVal hDestDC As Long, _
  3. ByVal X As Long, ByVal Y As Long, _
  4. ByVal nWidth As Long, ByVal nHeight As Long, _
  5. ByVal hSrcDC As Long, _
  6. ByVal xSrc As Long, ByVal ySrc As Long, _
  7. ByVal dwRop As Long) As Long
  8.  
The blitting module copies rectangles of graphics from objects (we'll use the main form) to other objects (we'll use each of the pictureboxes in the 4 quarter-size forms).
hSrcDC = The hDC of the object it's copying from (original).
hDestDC = The hDC of the object it's copying to (copy).
X,Y = The x and y position which the top-left of the copied rectangle will be placed at in the destination object.
nWidth, nHeight - The width and height of the rectangle which it will copy.
xSrc,ySrc = The x and y position of the top-left of the area which it will copy in the original object.
dwRop = The way in which it copies the graphics. We'll always use vbSrcCopy.

Call each of the 4 small forms
frmSplitTL (top-left), frmSplitTR (top-right), frmSplitBL (bottom-left), frmSplitBR (bottom-right)
Call each of their PictureBoxes picSplitTL, picSplitTR, etc, to match with the forms which they are on.

I'm imagining that your main form which you're wanting to look like is being split, is called MainForm, so change the code below to match what your form's called.

Call this code while MainForm is being shown.
Expand|Select|Wrap|Line Numbers
  1. 'Get the forms to load but just make them invisible:
  2. frmSplitTL.Show : frmSplitTL.Visible=False
  3. frmSplitTR.Show : frmSplitTR.Visible=False
  4. frmSplitBL.Show : frmSplitBL.Visible=False
  5. frmSplitBR.Show : frmSplitBR.Visible=False
  6.  
  7. 'Set their positions (Left and Top) to be over the top of MainForm, in TL/TR/BL/BR positions:
  8. frmSplitTL.Left = MainForm.Left
  9. frmSplitTL.Left = MainForm.Top
  10. frmSplitTR.Left = MainForm.Left + (MainForm.Width / 2)
  11. frmSplitTR.Top = MainForm.Top
  12. frmSplitBL.Left = MainForm.Left
  13. frmSplitBL.Left = MainForm.Top + (MainForm.Height / 2)
  14. frmSplitBR.Left = MainForm.Left + (MainForm.Width / 2)
  15. frmSplitBR.Left = MainForm.Top + (MainForm.Height / 2)
  16.  
  17. 'Set the size of the 4 forms and their pictureboxes to be quarter of the size of MainForm:
  18. Width:
  19. frmSplitTL.Width = MainForm.Width/2 : frmSplitTL.picSplitTL.Width = MainForm.Width/2
  20. frmSplitTR.Width = MainForm.Width/2 : frmSplitTR.picSplitTR.Width = MainForm.Width/2
  21. frmSplitBL.Width = MainForm.Width/2 : frmSplitBL.picSplitBL.Width = MainForm.Width/2
  22. frmSplitBR.Width = MainForm.Width/2 : frmSplitBR.picSplitBR.Width = MainForm.Width/2
  23. Height:
  24. frmSplitTL.Height = MainForm.Height/2 : frmSplitTL.picSplitTL.Height = MainForm.Height/2
  25. frmSplitTR.Height = MainForm.Height/2 : frmSplitTR.picSplitTR.Height = MainForm.Height/2
  26. frmSplitBL.Height = MainForm.Height/2 : frmSplitBL.picSplitBL.Height = MainForm.Height/2
  27. frmSplitBR.Height = MainForm.Height/2 : frmSplitBR.picSplitBR.Height = MainForm.Height/2
  28.  
  29.  
  30. 'Copy top-left part of form to top-left PictureBox:
  31. BitBlt frmSplitTL.picSpiltTL.hDC, _
  32.             frmSplitTL.picSplitTL.ScaleWidth, frmSplitTL.picSplitTL.ScaleHeight, _
  33.             frmSplitTL.ScaleWidth, frmSplitTL.ScaleHeight, _
  34.             MainForm.hDC, 0, 0, _
  35.             vbSrcCopy
  36. frmSplitTL.picSplitTL.Refresh
  37.  
  38. 'Copying top-right:
  39. BitBlt frmSplitTR.picSpiltTR.hDC, _
  40.             frmSplitTR.picSplitTR.ScaleWidth, frmSplitTR.picSplitTR.ScaleHeight, _
  41.             frmSplitTR.ScaleWidth, frmSplitTR.ScaleHeight, _
  42.             MainForm.hDC, (frmSplitTR.ScaleWidth / 2), 0, _
  43.             vbSrcCopy
  44. frmSplitBL.picSplitTR.Refresh
  45.  
  46. 'Bottom-left:
  47. BitBlt frmSplitBL.picSpiltBL.hDC, _
  48.             frmSplitBL.picSplitBL.ScaleWidth, frmSplitBL.picSplitBL.ScaleHeight, _
  49.             frmSplitBL.ScaleWidth, frmSplitBL.ScaleHeight, _
  50.             MainForm.hDC, 0, (frmSplitBL.ScaleHeight / 2), _
  51.             vbSrcCopy
  52. frmSplitBL.picSplitBL.Refresh
  53.  
  54. 'Bottom-right:
  55. BitBlt frmSplitTR.picSpiltTR.hDC, _
  56.             frmSplitBR.picSplitBR.ScaleWidth, frmSplitBR.picSplitBR.ScaleHeight, _
  57.             frmSplitTR.ScaleWidth, frmSplitTR.ScaleHeight, _
  58.             MainForm.hDC, (frmSplitBR.ScaleWidth / 2), (frmSplitBR.ScaleHeight / 2), _
  59.             vbSrcCopy
  60. frmSplitBR.picSplitBR.Refresh
  61.  
  62.  
  63. 'Now each of the picboxes should each have a quarter of MainForm's graphics in them, and the 4 forms have no borders, so if we make them visible and hide MainForm, it should look the same.
  64. 'So, we're gonna do that.
  65. 'Hide MainForm:
  66. MainForm.Visible = False
  67. 'Show 4 quarter forms:
  68. frmSplitTL.Visible = True
  69. frmSplitTR.Visible = True
  70. frmSplitBL.Visible = True
  71. frmSplitBR.Visible = True
  72.  
Now you can move each of those 4 quarters by themselves by changing their Top and Left values.
It may not be obvious at first that it is split; also, you can't move them because they have no border. If it looks the same, and to be able to move them, you can prove that it has been split by setting all 4 of the forms' BorderStyle properties to 1 - Fixed Single, before you run it again. Now it will be annoyingly obvious that they are separate. ;)

I hope it works. I haven't tested that, I just made it up. Please let me know what happens.
Sep 3 '07 #5
Ali Rizwan
925 512MB
Thanks a lot for your time i ll try this again thanx
Sep 3 '07 #6
Ali Rizwan
925 512MB
Are you still on for that game making thing in that other thread??

if so could you please PM me instead of using a thread (i only regularly check new threads) (i got in trouble for necro'ing old threads)

hope to hear from you soon

sgrec7
Hi
I do but there is a problem i dont know how to attach a file to PM.
I have a new thing for your game visuals i think it will help you to improve animation. These are 3-D tubes. Check them and tell me using PM. Ok waiting
Attached Files
File Type: zip 3DTubes.zip (4.8 KB, 102 views)
Sep 3 '07 #7
hariharanmca
1,977 1GB
Good try Robbi. But this code doesn’t make any sense.
Ali Rizwan, You can use frame (panel) or picture control. Whatever control you are placing in form, can able to place in Picture and frame control.

Can you explain what kind of animation you are using?
(Let us explain and point you in correct way).
Sep 3 '07 #8
Ali Rizwan
925 512MB
Good try Robbi. But this code doesn’t make any sense.
Ali Rizwan, You can use frame (panel) or picture control. Whatever control you are placing in form, can able to place in Picture and frame control.

Can you explain what kind of animation you are using?
(Let us explain and point you in correct way).
Hi
Thanx for the reply i want such animatio so that every part of the form appears fromevery corner of screen and then cllash together and madeup a form.
I think you understand.
Sep 3 '07 #9
Robbie
180 100+
Good try Robbi. But this code doesn’t make any sense.
Ali Rizwan, You can use frame (panel) or picture control. Whatever control you are placing in form, can able to place in Picture and frame control.

Can you explain what kind of animation you are using?
(Let us explain and point you in correct way).
Do you mean you don't understand it, or it's for the wrong version of VB?
Because that's for VB6... oh crapness. I think Ali uses VB 2008...
Spare me, I was half-asleep when I posted then. >_<
(That's my excuse...)

(Still, I'm confident I can get the code to work on VB6, as I use that blitting module for a lot of things... if you don't believe I can, then I'll try. :P)
Sep 3 '07 #10
kadghar
1,295 Expert 1GB
Hi
Thanx for the reply i want such animatio so that every part of the form appears fromevery corner of screen and then cllash together and madeup a form.
I think you understand.
Use 5 forms, 4 dummies that will apear from each corner, and when they're finally together in the middle, replace them with the 5th one.
Sep 3 '07 #11
Robbie
180 100+
Use 5 forms, 4 dummies that will apear from each corner, and when they're finally together in the middle, replace them with the 5th one.
That's what I tried to make code for... *sigh*
Sep 3 '07 #12
kadghar
1,295 Expert 1GB
That's what I tried to make code for... *sigh*
Sorry :( i didnt read it. But i'll check it out.
Sep 3 '07 #13
kadghar
1,295 Expert 1GB
oh I see!!

yeap, what you are doing there is setting the forms, well that can be done without code, but yes, that's the main idea. I think that now all we have to do is move the top and left 'till they are the ones you set in the first lines of your code.
Sep 3 '07 #14
Ali Rizwan
925 512MB
Use 5 forms, 4 dummies that will apear from each corner, and when they're finally together in the middle, replace them with the 5th one.
Yeah i know this one but i dont want a plenty of forms i want it naturally that a single form has to split.
But thanxxx for kin reply
Sep 4 '07 #15
Ali Rizwan
925 512MB
Use 5 forms, 4 dummies that will apear from each corner, and when they're finally together in the middle, replace them with the 5th one.
Yeah i know this one but i dont want a plenty of forms i want it naturally that a single form has to split.
But thanxxx for kind reply
Sep 4 '07 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian | last post by:
if i wanted to split the below SQL statement on two lines, what would the syntax be.... SQL = "UPDATE gallery WHERE g_id = " & Request.Form("g_id") & "SET g_name = " & Request.Form("g_name") &...
2
by: Balrog | last post by:
Hi! I wonder if anyone could give me some hints/pointers. This is what I'm trying to do: say, I have the following: - data (most likely XML) Example: <colour>red</colour> - data validation...
3
by: Rakesh | last post by:
Hi, I was 'googling' to look out for some ways of optimizing the code and came across this term - 'hot / cold splitting'. In short, the discussion is about splitting heavily accessed ( hot )...
2
by: Matt | last post by:
Hi, I'm ridiculously new to Access (about a week!) so please be patient! My database is a record of British Standards. Each has a unique identifier. Some are split into parts. I would like...
1
by: robertmeyer1 | last post by:
Hi, I have 3 tables set up. tblQuestion, tblAnswer, tblClient. I have them linked together and have a sbf and mainform set up for data entry. The sbf links the questions and answers together. ...
9
by: conspireagainst | last post by:
I'm having quite a time with this particular problem: I have users that enter tag words as form input, let's say for a photo or a topic of discussion. They are allowed to delimit tags with spaces...
2
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to...
3
by: salad | last post by:
I have an A97 application that is NOT split on a network. It is used by 15+ folks continually. It is quick and fast. I split it several years ago and had to merge it together again after the...
6
by: jacc14 | last post by:
Good morning all. I have been working on a database for the past couple of weeks and it is pretty nippy. I have an ODBC link in there from another software program. Since splitting it and...
1
by: Denis | last post by:
I have a date field in a database. I have been given forms to be printed out. The problem is that the form requires the date to be printed out in 3 seperate parts. In the form day month and year....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.