473,382 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Drawing graphics in Access

2
I would like to create and print a production worksheet, and store certain information from past jobs in the database for easy reference and duplication. Access seems like a simple way to accomplish this, but I also need to generate and draw an image (a preview of a file) and be able to display and alter it at the user's control.

We have Access 2000, but upgrading is not out of the question. I can't, however, find much in the way of VBA functionality to accomplish this last goal. The Line method, if it's not prohibitive to draw anywhere from 5k-30k lines, would suffice but the help file says it only applies to reports. I need to be able to draw some or all of the file as the user is entering the information (to properly assign color values to certain parts of the image).

Is this just outside of the proper scope of Access, or is it feasible? If so, can someone point me in the right direction of how to accomplish this?
Oct 10 '08 #1
6 19230
ADezii
8,834 Expert 8TB
To the best of my knowledge, in Access as far as Graphics go, you are pretty much restricted to drawing: Lines, Rectangles, Circles, Arcs, and Ellipses. These Graphics Methods can only be used in a Report within the Print() Event. Don't quote me on all this, since I seldom use this functionality. To see what I mean, place the following code in the Print() Event of a Blank Report, then Open it:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  2. Const conPI = 3.14159265359
  3. Dim sngHCtr As Single, sngVCtr As Single
  4. Dim sngRadius As Single
  5. Dim sngStart As Single, sngEnd As Single
  6.  
  7. sngHCtr = Me.ScaleWidth / 2      ' Horizontal center.
  8. sngVCtr = Me.ScaleHeight / 3
  9. sngRadius = Me.ScaleHeight / 3   ' Circle radius.
  10.  
  11. ' Draw circle.
  12. Me.Circle (sngHCtr, sngVCtr), sngRadius
  13. sngStart = -0.00000001             ' Start of pie slice.
  14. sngEnd = -2 * conPI / 3            ' End of pie slice.
  15. Me.FillColor = RGB(255, 0, 0)      ' Color pie slice red.
  16. Me.FillStyle = 0                   ' Fill pie slice.
  17.  
  18. ' Draw pie slice within circle.
  19. Me.Circle (sngHCtr, sngVCtr), sngRadius, , sngStart, sngEnd
  20.  
  21. Me.FillColor = RGB(0, 0, 255)       'Blue fill for Rectangle (Box)
  22. ' Draw line as a box.
  23. Me.Line (500, 6000)-(Me.ScaleWidth - 1000, 7000), vbBlue, B
  24. End Sub
Oct 11 '08 #2
youmike
69
I think what you seek to do is really outside Access territory - it just is not good for complicated graphics of any sort. Where my user have needed such reporting I tend to export relevant data to Excel and let the users present in the format they need.

CorelDraw has VBA capability and I wonder whether that might be a more appropriate tool. I've never tried the Corel implementation of VBA, so I can't give any more guidance on precisely what to do.
Oct 11 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
I agree with YouMike here. Rather than a vector drawing package however, to me your requirement is very much in AutoCad territory - 30k lines would be just a small meal for AutoCad. It's not in the scope of Access at all, I reckon.

-Stewart
Oct 12 '08 #4
myndzi
2
Ah, I was afraid of that. I should mention that there's no real need to do anything but pile the lines on top of each other, I'm not manipulating them in any fashion (so AutoCAD for example is overkill). 30k is on the extreme end, but I think it wouldn't take unreasonably long.

The other important part is retention of the info, so I guess I'll have to learn how to do some database stuff in a programming language and go from there. I still have yet to do any real Windows programming, so this looks like it will be a learning experience on multiple fronts.

Thanks for the feedback.
Oct 13 '08 #5
ADezii
8,834 Expert 8TB
Ah, I was afraid of that. I should mention that there's no real need to do anything but pile the lines on top of each other, I'm not manipulating them in any fashion (so AutoCAD for example is overkill). 30k is on the extreme end, but I think it wouldn't take unreasonably long.

The other important part is retention of the info, so I guess I'll have to learn how to do some database stuff in a programming language and go from there. I still have yet to do any real Windows programming, so this looks like it will be a learning experience on multiple fronts.

Thanks for the feedback.
In order to retain the information, in this case X and Y coordinates, you can save these Values as Fields in a Table, something like:
Expand|Select|Wrap|Line Numbers
  1. Dim X_1 As Integer
  2. Dim X_2 As Integer
  3. Dim Y_1 As Integer
  4. Dim Y_2 As Integer
  5.  
  6. X_1 = 3600
  7. X_2 = 3600
  8. Y_1 = 0
  9. Y_2 = 8000
  10.  
  11. Me.Line (X_1, Y_1)-(X_2, Y_2), rgBlue
  12.  
Oct 13 '08 #6
youmike
69
I suggested CorelDraw without registering the need for 30k lines properly. Don't use AutoCad myself, but I have a son who does - his expertise is sea-bed mapping, which poses similar problems. I haven't asked him this specific question, but I know he would support that route. As Adrian says, if the need is just record simple line parameters, a table within Access might be a solution. It depends on what subsequent manipulation is needed.
Oct 14 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Steve Long | last post by:
Hello, (total GDI newbie) I'm having trouble drawing just a simple line to display in a picturebox. I just want a straight, dotdash line. I have two methods, one works and one doesn't (it cause...
1
by: Paul Hoad | last post by:
I'm trying to use MeasureString() to determine the length in pixels of a string However to do I need a System.Drawing.Graphics object to do this I need to create a System.Drawing.Graphics...
4
by: Stuart Norris | last post by:
Dear Readers, I am attempting to draw box around some text using unicode on multiline label. The label is forty characters wide and 12 lines deep. I have been trying to draw a box around text...
1
by: Hadar | last post by:
Hi, I'm getting "object is currently in use elsewhere" when I use System.Drawing.Graphics.MesureString. This is what I do: My controls use a utility class the helps it to mesure strings. To...
13
by: Metallicraft | last post by:
I have a vb6 application. On the main form is a picture box with one or two images and several pieces of text displayed in it. These are created on the fly using gdi32 routines that are all in a...
2
by: Peter Proost | last post by:
Hi group, I got the following piece of code which draws a square with stars round it, now I want the stars to rotate round the square, I can do this with the mx.rotate and a timer and an...
3
by: Eduard Witteveen | last post by:
Hello list, I have code the draw MyDrawingObject information on a System.Drawing.Graphics object. The code is more/less the following: I now want to rotate / mirror the object i draw. I've...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
0
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main...
2
by: Carl | last post by:
I'm new to C#, and I have only limited programming experience. I've been doing the video tutorials at MS's website, and they're very helpful, but I decided to experiment with GDI+ and have gotten...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.