15,890,741 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by a4ashiq (Top 3 by date)
a4ashiq
29-Jan-14 4:24am
View
Deleted
I Just formed the matrix with t
private void MakeMatrix()
{
label1.Text = ""; int MaxFreeH, MaxFreeV;
int s = 1;
int[] ad1 = new int[] { 4, 4 };
int[] ad2 = new int[] { 3, 2 };
int[] ad3 = new int[] { 2, 5 };
System.Collections.ArrayList a = new System.Collections.ArrayList();
a.Add(ad1);
a.Add(ad2);
a.Add(ad3);
int MaxV = 8, MaxH = 6;
//int HSize = 0, VSize = 0;
int[,] pageMatrix = new int[MaxV, MaxH];
for (int i = 0; i < MaxV; i++)
{
for (int j = 0; j < MaxH; j++)
{
pageMatrix[i, j] = 0;
label1.Text += pageMatrix[i, j].ToString() + " ";
}
label1.Text += Environment.NewLine;
}
foreach (int[] Ad in a)
{
bool Flag = false;
for (int V = 0; V < MaxV; V++)
{
for (int H = 0; H < MaxH; H++)
{
if (V + Ad[0] <= MaxV && H + Ad[1] <= MaxH)
{
if (pageMatrix[V, H] == 0 && pageMatrix[V + (Ad[0]-1), H + (Ad[1]-1)] == 0)
{
for (int i = V; i < V + Ad[0]; i++)
for (int j = H; j < H + Ad[1]; j++)
{
pageMatrix[i, j] = s;
}
Flag = true;
break;
}
}
}
if (Flag)
break;
}
s++;
}
label1.Text += Environment.NewLine + " ------------------------" + Environment.NewLine + Environment.NewLine;
for (int i = 0; i < MaxV; i++)
{
for (int j = 0; j < MaxH; j++)
{
label1.Text += pageMatrix[i, j].ToString() + " ";
}
label1.Text += Environment.NewLine;
}
}
this will make the matrix an print in the above format. But, like i said, i have no further idea about graphics.
a4ashiq
29-Jan-14 3:42am
View
Hi YvesDaoust,
its for asp.net web forms. i forgot to mention that in my question. I already got the answer yesterday. But i think your suggestion will work. I'll try that also for sure. Thanks for the reply.
a4ashiq
8-Aug-12 0:25am
View
You're welcome dude. Rate the answer if it helped you..
Thank you