Connecting Tech Pros Worldwide Forums | Help | Site Map

Need VBA Code to place color on a bitmap image

JEO JEO is offline
Newbie
 
Join Date: Feb 2007
Posts: 5
#1: Feb 28 '07
I have a Visual basic 3 App that I am converting to VBA in Microsoft Access 2003. The VB3 app successfully recolors a bitmap image with code using pixel locations when clicking on option buttons used for color selection.
An example is:
Grphecho!Picture3.PSet (xpos, ypos), RGB(RRGB, GRGB, BRGB)

where the pixel positions are xpos and ypos in a Picture box(Picture3) using the Pset method.

I know about the need for twips instead of pixels in Access 2003, and can successfully convert my coded pixel values to twips by applying 15 twips to 1 pixel.

My problem is coding to the control on the Access form. How can I get an Image Control or Unbound Object Frame control to accept my x and y values from my code?

Thanks much to anybody for reviewing this.

Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#2: Feb 28 '07

re: Need VBA Code to place color on a bitmap image


Hi. Is there a really pressing reason to convert to VBA? Why not vb6?
JEO JEO is offline
Newbie
 
Join Date: Feb 2007
Posts: 5
#3: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


I like Access. I have also used VB a lot. I have been developing software for many years and prefer the convenience of working with everything in one place - forms, reports, database, code, etc. I've never been stopped (i.e. needed to abandon Access VBA and get outside to solve my programming problem).
I have some intricate applications, mostly financial and medical customized.

This is a case of whether it is possible to write to a bitmap image and then save the changes in Access - so I'm persuing that solution first.

Any ideas about the specific problem?
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#4: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


Quote:

Originally Posted by JEO

I like Access. I have also used VB a lot. I have been developing software for many years and prefer the convenience of working with everything in one place ...

Yes, that's what I've always like about Access too.

I'll be very interested to see whether you find an answer to this one; it's something I have wondered about from time to time, but not really pursued. Some of the limitations that Access VBA imposes on your VB code can be extremely frustrating.
Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#5: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


Quote:

Originally Posted by JEO

I like Access. I have also used VB a lot. I have been developing software for many years and prefer the convenience of working with everything in one place - forms, reports, database, code, etc. I've never been stopped (i.e. needed to abandon Access VBA and get outside to solve my programming problem).
I have some intricate applications, mostly financial and medical customized.

This is a case of whether it is possible to write to a bitmap image and then save the changes in Access - so I'm persuing that solution first.

Any ideas about the specific problem?

I hate working with access. It feels far too amateur for me. Too limiting. I never use data bound controls and I do part of my programming in c++ because it runs so much faster. Access... yugh!
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#6: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


Quote:

Originally Posted by willakawill

I hate working with access. It feels far too amateur for me. Too limiting. I never use data bound controls and I do part of my programming in c++ because it runs so much faster. Access... yugh!

Perhaps, but at the time it was released, it was being compared to (for example) old versions of dBase. Access, with everything in one file, was a huge improvement over having various tables, indexs, forms, blah blah blah all in separate files.

And of course, the fact that I was already using VB (um... probably v1 or 3 at the time) meant that it was very nice the way Access just slotted right in.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,729
#7: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


Just posting to keep an eye.
Have you considered asking Killer to move this thread to the Access forum? That way it may be more visible to those with the skill sets you need. I'm afraid I haven't used the graphics side at all in Access so I can't help personally.
Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#8: Mar 1 '07

re: Need VBA Code to place color on a bitmap image


Quote:

Originally Posted by NeoPa

Just posting to keep an eye.
Have you considered asking Killer to move this thread to the Access forum? That way it may be more visible to those with the skill sets you need. I'm afraid I haven't used the graphics side at all in Access so I can't help personally.

Copied thread to Access forum
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,216
#9: Mar 2 '07

re: Need VBA Code to place color on a bitmap image


Quote:

Originally Posted by JEO

I have a Visual basic 3 App that I am converting to VBA in Microsoft Access 2003. The VB3 app successfully recolors a bitmap image with code using pixel locations when clicking on option buttons used for color selection.
An example is:
Grphecho!Picture3.PSet (xpos, ypos), RGB(RRGB, GRGB, BRGB)

where the pixel positions are xpos and ypos in a Picture box(Picture3) using the Pset method.

I know about the need for twips instead of pixels in Access 2003, and can successfully convert my coded pixel values to twips by applying 15 twips to 1 pixel.

My problem is coding to the control on the Access form. How can I get an Image Control or Unbound Object Frame control to accept my x and y values from my code?

Thanks much to anybody for reviewing this.

__1 I was under the impression that the Twips to Pixel ratio is related to the Screen Resolution with typical 640X480 using 15 Twips per Pixel and most of the other Resolutions using 12 Twips per Pixel but this is hardly your main problem.
__2 In my opinion, the only possible chance you have to allow an Access Control to accept individual xPos and yPos Pixel location values, is via the Windows API which is very rich in this specifc type of functionality.
__3 The other problem is that you can be fairly assured that whatever API Call you attempt to make in this unique situation will most certainly require a Windows Handle (hWnd Property). To the best of my knowledge, the limited number of Controls that can accept Graphic data, do not have this hWnd Property since they are not true Windows. Forms and Reports have Handles (hWnd) but, again, I'm fairly sure that Controls contained within them do not.
__4 I apoplogize for being so negative but I do not think that what you are requesting is feasible. My only suggestion is to consult a professional Windows Programmer with some Access familiarity.
Reply


Similar Microsoft Access / VBA bytes