Solved

how to generate points

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now