Solved

how to generate points

Posted on 2000-03-15
2
151 Views
Last Modified: 2010-05-02
I  used visual basic before in excel to do calculations. I have now to use it to make pictures! I have to generate points (a regular pattern)  and I would like to know how to make a grid thing and then to put points inside (measures in pixels).
I also don't know if this will be the best way or if it would be better to use C or C++ or Fortran or S-Plus ...
hope this not to be asking too much.
Thanks
0
Comment
Question by:sofiaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
pjknibbs earned 100 total points
ID: 2619269
If all you want is simple graphics you can call the Circle, Line, Box, PSet and Print methods of a Visual BASIC form--however, you'll need to set the AutoRedraw property of the form to True if you don't want to have to redraw the graph every time your form is wiped by another window. If you want anything more complex you'll have to get a Windows device context for the form and use GDI functions to draw into it.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2619273
This example shows how to set pixels of a picture box control to random colours. Just put a picture box and a command button on a form.

Private Sub Command1_Click()
    With Picture1
        For intRow = 0 To .Height Step 10
            For intCol = 0 To .Width Step 10
                Picture1.PSet (intCol, intRow), RGB(Int(Rnd() * 256), Int(Rnd() * 256), Int(Rnd() * 256))
            Next
        Next
    End With
End Sub
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question