Solved

how to generate points

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Date Picker 64 bit 32 bit issue 12 55
Add a task in Outlook from access 11 39
how to Classify of email (pdf attachments) 7 36
Error with a code discussed on this page 5 16
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

821 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