PDA

View Full Version : Solved: Graphics manipulation



Movian
10-13-2008, 12:01 PM
hey,
im sure your sick of my suddent onslaught of tricky problems but i have one more and then once these are all sorted out i should be good for a while.

But just before we get into it im not sure if this is even possible. Essentially our reporting system currently on a button click opens a gif file in the default program on the computer system. We are currently trying to ensure that this is setup correctly so that the image is opened in the graphics editor the client wishes to use. However we sometimes run into problems and issues so i was wonering if it was at all possible to build a small graphics editor (ala Paint / Gimp) in VBA in access for editing the image files directly instead of having to rely on an outside program to get the job done and then hope that everything went ok.

So if anyone has information on how this might be acomplished it would be apriciated. Note it dosn't need to be photoshop level lol it needs to be able to wrtie text, draw coloured lines and mabye have a fill feature. That should be all it needs.

Any help is apriciated :):beerchug:

Demosthine
10-13-2008, 09:53 PM
Good Evening.

Absolutely anything is possible with enough creativity and manipulation of the system. It all depends on how much effort you want to put into it and how much time you have.

As usual, there are several ways to do it. But I would highly advise against writing your own graphics editor for it. There are plenty of free sources or source code out there to do this. Besides, Access is not meant to be a graphics editor.


For a better solution, I would recommend one of two things. The first is to have Access store the information regarding the program the User prefers and open it via code. For example, you can run a Shell("MsPaint.exe ""C:\Windows\Scott's Shirt""") command to open the file specified in the argument using MsPaint.

The second solution would be to use a UserForm and insert an OLE Object for the selected application. This may be the more appropriate method, but either way, it will enable you a little more control with the right set of code.

Good luck.
Scott

Movian
10-14-2008, 05:46 AM
i looked dor source code but was only able to find VB code.... for like vb6 which i guess i could try opening in vb 2008.

At the moment we use GIMP and simply associate the .gif format with GIMP.

And this is probably going to make me sound like a complete begginer but what is an OLE object ? im un familiar with the term.

CreganTur
10-14-2008, 07:06 AM
OLE used to stand for Object Link and Embedding... but now MS has changed their terminology and states that OLE stands for... OLE :cuckoo:

Anyway... you can use OLE to embed an object into Access- in a table you can embed a word document in a field and it will be an individual doc for that record.

You can also use OLE automation to automate external programs via VBA.

Movian
10-14-2008, 07:08 AM
!!! :D

ok now does this work for all programs ?
EG could i embed an instance of GIMP into a form ? is that what you are referring to? cos that would be awesome if i could

CreganTur
10-14-2008, 07:54 AM
It really depends on whether or not the program supports OLE Automation. I know nothing of GIMP, so I can't answer for it specifically.

You can try a few different things:

1) in a table, see if you can load GIMP as an OLE Object

2) see if GIMP is an option under the More Controls button of the Form Toolbox

3) try Demosthine's idea of using a shell command to force GIMP to open the specified file

Demosthine
10-14-2008, 05:36 PM
Good Afternoon.

From Access, to find out if GIMP can be used as an OLE Object, go through the following steps:

Create a new table in Design View.
Add a Field Name Graphics. Set the DataType to OLE Object.
Close and Save the Table.

Open the table in View Mode.
Click on the Cell under the Graphics Field.
Go to the Insert Menu and down to Object...
Look through the list to find out if you have an OLE Object for GIMP.


Another option may be to use Gimp-Remote. Check out the GIMP Homepage (http://www.gimp.org/) or the GIMP User Groups (http://gug.sunsite.dk/). It appears there is a lot of information and tutorials for using their system.

Happy Hunting!
Scott

Movian
10-15-2008, 05:41 AM
well, no OLE Object and no ActivX object under more tools,

guess i will have to use the specific shell command. I would LIKE to create a graphics program in VBA (if its possible) even if its just for S&G's

unfortunately i have no idea where to begin. i will stick with the shell command but im going to leave this thread open for now because as i said i would LIKE to get some resources on how i would go about creating a graphics app within access. So any further help is appreciated too :)

Interestingly enough you can create a paint ole object in a table though :D

Movian
10-16-2008, 11:36 AM
ok i am marking this solved as i have found an interesting solution to the situation at hand.

instead of directly editing an image via a custom created graphics package. I am instead using and ingenious ( if i do say so myself) usage of word automation.

I am using the shapes line system to produce arrows and other drawing shapes at determined locations automatically to produce an automatically created diagram based on user value selections within the system. I then discovered that by saving the word doc as an HTML file, word will export two image files, one of the original template image and one with all of the modifications. All i need do is then use the shell command ("with your additional code to force it into gimp (thanks!! :D)) then i have a diagram with automatically created content and to the user it apears the system has done all of this automaticly and directly :D

what you guys think