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

Home Posts Topics Members FAQ

I want help How I can align rectangles

1 New Member
I want help
How I can align rectangles differ in its tow dimensions inside big rectangle with lesser waste in area ?

for mor information
align.rar - 1.8 Kb

or:
copy this code to text file and change its extension from txt to frm and insert this form to new project:

VERSION 5.00
Begin VB.Form frmMain
Caption = "Form1"
ClientHeight = 7485
ClientLeft = 60
ClientTop = 450
ClientWidth = 8100
LinkTopic = "Form1"
ScaleHeight = 499
ScaleMode = 3 'Pixel
ScaleWidth = 540
StartUpPosition = 3 'Windows Default
Begin VB.CommandButto n cmdNest
Caption = "align "
Height = 375
Left = 6000
TabIndex = 2
Top = 6840
Width = 1815
End
Begin VB.CommandButto n cmdNew
Caption = "new"
Height = 375
Left = 6000
TabIndex = 1
Top = 6240
Width = 1815
End
Begin VB.PictureBox PicTable
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 3660
Left = 6000
ScaleHeight = 242
ScaleMode = 3 'Pixel
ScaleWidth = 120
TabIndex = 0
Top = 2280
Width = 1830
End
Begin VB.Label imgDarfa
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000018&
BorderStyle = 1 'Fixed Single
Caption = "1"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 178
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 900
Index = 0
Left = 840
TabIndex = 3
Top = 1800
Width = 450
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False
Option Explicit
'
Dim numDarfa As Integer

Private Sub cmdNest_Click()
'How I can align this rectangles (imgDarfa) in the big rectangle (PicTable)
Set imgDarfa(0).Con tainer = PicTable
imgDarfa(0).Lef t = 0
imgDarfa(0).Top = 0
End Sub

Private Sub cmdNew_Click()
Dim i As Integer
Dim m As Integer
Dim Wd As Single
Dim Ht As Single
Dim D As Single
Dim n As Integer
'
For i = 0 To numDarfa
m = Rnd * 100
If m < 50 Then m = 1 Else m = -1
D = Rnd * 30
Ht = 60 + m * D

m = Rnd * 100
If m < 50 Then m = 1 Else m = -1
D = Rnd * 15
Wd = 30 + m * D

Set imgDarfa(i).Con tainer = Me
imgDarfa(i).Wid th = Wd
imgDarfa(i).Hei ght = Ht

'

Next i
ReArrange
End Sub

Private Sub Form_Load()
Dim i As Integer
'
numDarfa = 14
Randomize Timer
For i = 1 To numDarfa
Load imgDarfa(i)
imgDarfa(i).Vis ible = True
imgDarfa(i).Cap tion = i + 1
Next i
cmdNew_Click
End Sub
'





Private Sub ReArrange()
Dim i As Integer
For i = 0 To imgDarfa.UBound
If i <> 0 Then
imgDarfa(i).Lef t = imgDarfa(i - 1).Left + imgDarfa(i - 1).Width
imgDarfa(i).Top = 5
Else
imgDarfa(i).Lef t = 5
imgDarfa(i).Top = 5
End If
Next i

End Sub
Mar 31 '08 #1
0 1249

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

Similar topics

0
1241
by: Donnell Perez | last post by:
----30266114589728909 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title>
8
3314
by: lawrence | last post by:
Under the domain publicpen.com I've several dozen sites in subdiretories, such as www.publicpen.com/honenbeger. I've no trouble with any of these sites. But under one, which I put in yesterday, www.publicpen.com/staengl, when I point my browser there, the browser, instead of showing me the index.htm pages like it should, it instead tries to download it as an object. Why? Below are the contents of index.htm. Does anyone see anythging...
7
10562
by: Chris | last post by:
I'm using eight links listed horizontally as a menu on my site. I'm using font-variant:small-caps and they are padded so that they mimic buttons. My gripe is with the way IE handles the focus rectangle on these links. It insists on drawing this crazy shape that traces the text, which with small caps looks rather assinine. Firefox handles the same task very gracefully (yeah Gecko!) and I would like to force IE to do the same. The site...
9
35239
by: Veerle | last post by:
Hi, I would like to divide the whole of my html page in 4 equal rectangles using only div tags in my html. The result should look a bit like this site: http://users.pandora.be/rausbauten/menu/static/start.html only there, a table is used to achieve this result. So using 4 div blocks and by setting 2 of them to float left, I already got this result: http://home.scarlet.be/~vv991306/test.html Now I have to set the widths en heigths of...
3
22462
by: cai_rongxi | last post by:
Hi, Can some body share the code to find the intersection of two rectangles? Thanks in advance
0
1144
by: Fir5tSight | last post by:
Hi All, Again I apologize for posting this topic at the wrong forum, because I don't know where else I can get help on this matter. This is about invisible lines and rectangles in a PDF file. Other developers used "Active Reports" API in Visual Basic to create the PDF file. Since they set some sections to "visible = false", the lines/rectangles in those sections are therefore invisible in the PDF file.
7
7089
by: ddecoste | last post by:
I have a need to add a visual representation to some data in Access. I need to draw a matix of squares inside another square. I have all the data that I need in a record in Access. The data changes according to what the user inputs. I know that Access does not allow you to draw on forms so I decided to put the output in an Excel file for the user but I am having trouble drawing the rectange from Access. Here is my simple code so far: ...
9
1671
by: active | last post by:
I need a control that displays a grid of rectangles. That is, like a brick wall except the rectangles are lined up. In VB6 I used such a control (may have been called FlexGrid but I'm not sure.) I did see the DataGrid control but that seems oriented to DB usage. It's probably much more complex than what I need, but I'm not sure about that!
1
2287
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
0
10395
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...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
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
7674
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
5564
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
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
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.