vb6 Picturebox used in activex-control with access report

vb6 Picturebox used in activex-control with access report

Post by Bernhard Brunne » Sun, 29 Dec 2002 04:17:58



I created an ActiveX-Control with vb6 and did some API-Graphics within.

It works good but when i use it within an MS-Access-Report it will be
printed with
the resolution of my screen and not with possible printer-resolution.

So the pixels looked quite big!

Is there a way to print the picture-box in higher resolution ??

 Bernhard

 
 
 

1. Is it impossible for ActiveX Code component to draw to a VB control (PictureBox/UserControl say)

I want to write an ActiveX (inprocess) code component that draws its output
on a VB control (eg pass it one of several Picturebox controls or Printer
object to select different screen views or printer output, or even pass a
custom control perhaps).

BUT, as I understand it, you musn't "use any object in the VB object library
as a parameter or return value for exposed properties or methods in public
classes" ("Doing Objects in VB 6", Deborah Kurata, pg 493). I believe this
means you couldn't pass a PictureBox, Form or Printer object to an ActiveX
code (or a Custom control that contains a reference to one)? How cast in
iron is this statement? Could two vb-based objects (Control and code
component say) pass the VB objects between themselves perhaps?

I could get round this by doing all the drawing using Windows API calls
(using .hdc), this would also make the control usable with other languages.
I would pass the control.hDC to the component not the control object itself,
BUT then I read, for the hDC property in VB6/MSDN, "Note   The value of the
hDC property can change while a program is running, so don't store the value
in a variable; instead, use the hDC property each time you need it." - this
note seems to apply to ALL controls with this property (I had thought
perhaps some were "better behaved" than others)?

So this seems to be a catch-22 scenario - I could make the code component
hdc-based and it would be more flexible, but I still couldn't use it with
VB!

One work around might be to pass the hWnd and retreive the hDC from that?
But I don't want to spend all the time writing the code to find yet another
catch-22. Or maybe the hDC can only change during a DoEvents call? I could
then bodge it perhaps?

Anyone done this before?

More generally, is there a good book that describes "work arounds" for
ActiveX writing - ie providing alternatives (API code fragments?) for things
you can't do when code is moved to be part of ActiveX objects? This level of
practicality seems to be ignored in the books I've found so far.

For instance, how can a VB control decide whether the (mdi child) form it's
on (in a container presumably) and be it a VB, VFP etc based app, is the
active one (within the app, and ignoring modeless ones that is). Since (I
assume) you can't write "frmMDI.ActiveForm" in the control, what do you do
instead? Ditto, what is the equivalent to "frmMDI.WindowState" (so I can
prevent resizing when minimised)?

Dave Turnbull

2. OT: SYSTEM: too much disk activity

3. Creating a graphic ActiveX control for access 97

4. HELP : Getting a bitmap from the clipboard

5. activex control using D3D immediate mode .

6. PgMkr 5.1 Image Control problem

7. HTML->JPEG using WebBrowser ActiveX Control

8. want to buy ps 4.0

9. HELP WITH ACTIVEX CONTROLS AND ACTIVEX DOC

10. vb6 Adding Control to owner-drawn menu

11. FREE IMAGING ActiveX control

12. Brand new ActiveX controls with FREE demo