Solved

how to generate points

Posted on 2000-03-15
2
149 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

861 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