473,238 Members | 1,823 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,238 software developers and data experts.

I want help How I can align rectangles

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.CommandButton cmdNest
Caption = "align "
Height = 375
Left = 6000
TabIndex = 2
Top = 6840
Width = 1815
End
Begin VB.CommandButton 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_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = 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).Container = PicTable
imgDarfa(0).Left = 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).Container = Me
imgDarfa(i).Width = Wd
imgDarfa(i).Height = 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).Visible = True
imgDarfa(i).Caption = 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).Left = imgDarfa(i - 1).Left + imgDarfa(i - 1).Width
imgDarfa(i).Top = 5
Else
imgDarfa(i).Left = 5
imgDarfa(i).Top = 5
End If
Next i

End Sub
Mar 31 '08 #1
0 1226

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

Similar topics

0
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
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,...
7
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...
9
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:...
3
by: cai_rongxi | last post by:
Hi, Can some body share the code to find the intersection of two rectangles? Thanks in advance
0
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....
7
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...
9
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...
1
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.