Drawing Boxes in Visual Basic 6

Hi Experts!

I've written dozens of Visual Basic programs in my life but never touched graphics programming and I want to be able to draw on a form just boxes, rows and columns of boxes depending on the parameters I set. It could be a 10 x 10 set of boxes, a 50 x 100 set of boxes, etc. I have no idea how to do this. Can you help?

Have a great day :)
Ed MatsuokaPartner/Senior IT SpecialistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Here Picture1 is a PictureBox.
Option Explicit
Private Declare Function TextOutW Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long

Private Sub Command1_Click()
Picture1.Line (500, 500)-(4000, 500), vbRed
Picture1.Line (4000, 3000)-(4000, 500), vbGreen
Picture1.Line (500, 3000)-(4000, 3000), vbBlue
Picture1.Line (500, 3000)-(500, 500)

Picture1.CurrentX = 750
Picture1.CurrentY = 750
Picture1.FontSize = 16
Picture1.Print "Some text inside a box"

End Sub

Open in new window

0
Martin LissOlder than dirtCommented:
Here's a project.
29084837.zip
0
Ed MatsuokaPartner/Senior IT SpecialistAuthor Commented:
Hi Martin!

Here is what I want to do. I have data, anywhere from 50 by 50 to 500 by 5000 that I want to be able to display graphically as either a GREEN box (GOOD) , a YELLOW box (NEUTRAL) or a RED box (BAD). I wrote one in Excel using cells and it was ridiculously slow so I think VB6 should be much faster.

Any ideas!
PictureBoxExample1.png
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

NorieAnalyst Assistant Commented:
Ed

How did you do it in Excel?
0
Martin LissOlder than dirtCommented:
Try this workbook which colors cells in A1:F13 if the value is 1, 2 or 3. It uses Conditional Formatting.
29084837.xlsx
0
Ed MatsuokaPartner/Senior IT SpecialistAuthor Commented:
Thanks, I will! Here is my solution in Excel. It works well but when I get to 10,000 it gets slow. If I use it I will zoom the view depending on
how many rows/columns I am showing but I still suspect a graphic plot would be faster. What do you think?
ShowDATdata.xlsm
DummyData_352_Rows.txt
0
Martin LissOlder than dirtCommented:
Did you see my workbook?
1
Ed MatsuokaPartner/Senior IT SpecialistAuthor Commented:
Yes, just getting ready to go home but I will check it out in the next couple of days.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ed MatsuokaPartner/Senior IT SpecialistAuthor Commented:
I was looking for a "Visual Basic" graphics solution. Martin's solution works great but wasn't the ideal I'd hoped for since (and I certainly could be wrong about this) I think a graphics solution would be faster and more easier scalable.
0
Martin LissOlder than dirtCommented:
I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
0
Ed MatsuokaPartner/Senior IT SpecialistAuthor Commented:
Great, I'll check them out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.