ActiveX drawing control sizing bug also in Final?

M

Matt

Hello NG and Mai-lan

Sorry for insisting on this so much but this issue is very important for our
project and I'm very nervous:

I just talked to a friend who has apparantely downloaded the final Visio
2003 from MSDN (version 3216.5606). I asked him to embed the drawing control
into a form in Access 2003 (also final) and he confirmed, that again the
control doesn't keep the size at run-time :-(((

@ Mai-lan: Am I to paranoid or is the above version the RTM you were talking
about to be OK with sizing?
If so, will there be a patch?
If this version is not RTM what will be the RTM build No?

Thank you so much for your clarification on this and sorry for bugging.

greetings
Matt
 
M

Matt

OK just delete this topic - the Visio with my collegue wasn't the Final.

So I'll shut up now, try to keep cool and wait till I have the Final in my
hands - and then let's hope sizing will work!

Sorry again for the confusion.

Regards
Matt
 
M

Mai-lan [MS]

Hi, Matt: I've gone through the issues that we ran into during the tech beta
with the drawing control and Access and wanted to pass along the following
tips and tricks:
1.) Like any ActiveX control in an Access form, ambient properties are
available, but none of the control specific properties, methods or events
are available - this is not just an intellisense issue. Access 11 has some
unique behavior among the control containers. While the control's properties
are available, you can't get to the control's API without explicitly using
the Object property. Access puts a non-type-specific (as Object/IDispatch)
layer around its embedded controls. So to get to the control in Access 11,
do something like:
Dim visControl as VisOCX.DrawingControl

Set visControl =DrawingControl.Object

Then use visControl as your instance of the control object. This is Access
behavior with the control, rather than anything Visio control-specific.

2) The control is not supported in Access 10 until Office XP SP 1. It is
supported in Access 11, which is Access 2003 (the version that it sounds
like you're working with).

3) The Visio drawing control's resizing sometimes does not persist when the
Access document is reloaded. There are two ways to work around this: Write
VBA to set the width/height or set PageSizingBehavior = visResizePages. For
the scenarios that the ActiveX control were designed for, either approach is
recommended, depending on the method the drawing is created. If the drawing
is created in Visio, it should be authored such that the drawing fits the
intended size of the control. Thus, if the intended size of the control is
5X5, then the drawing should be constructed in Visio as 5x5. Then, the
control should be constructed as 5x5 (explicitly setting the width/height,
then loading via the SRC, OR, setting PageSizingBehavior = visResizePages,
and loading via the SRC).

If the drawing is being created "on the fly", then the control width/height
should be set programatically, the visResizePages should be set
PageSizingBehavior = visResizePages, and the drawing constructed.

4) Access uses IE security settings, which is important to know when you're
using any ActiveX control in an Access form. The control does not
initialize properly when previewing in access due to IE security settings.
To prevent this from occuring:

1. go to Internet Explorer, Tools->Options->Security.
2. Select Internet Zone
3. Click Custom Level... button
4. Scroll to Initialize ActiveX Controls not marked as safe.
5. Select 'Enable'.
6. Click OK
7. Click OK


5) There also may be some erratic resizing when using print preview in
Access with the contorl, but there's no workaround for this.


That's all we know about for page sizing or iniatialization issues in
Access. If you run into anything else more complicated (like menu merging),
I can help you out with that.

Hope the extra info helps,
Mai-lan
 
M

Matt

Hi Mai-lan

Thank you one more time for your very professional and helpful answers!
I guess it yould make a lot of sense to add the issues you mentioned to your
article on MSDN, so all drawing control starters know what they are dealing
with.
Especially the unknown connection to the IE security settings gave us a lot
of headake at the beginning.

Of course I also do have more questions ;-) :
I create a drawing in the control which is embeded into an Access subform
(the subform is synchronized with single records). For every record I create
a drawing by loading a template via src: mypath\mytemplate etc. and
afterwards saving the drawing to the disk under the records name.
Is it also possible instead of saving the drawing to the disk, to store it
as BLOB with the record and restore it to the drawing control when the
record is selected?
How would I do that? Would be great if there is a solution to this.

Thank you so much and best regards from Switzerland to whereever you are
Matt
 
M

Mai-lan [MS]

Hi, Matt: Always glad to help, I think the control is a great part of the
new release.

To work with BLOBS instead of persisted files (note that the control ONLY
officially supports working with persisted Visio files on disk), you'll have
to a little bit of hardcore programming around saving/loading from a stream
or byte array. You would use ISerializable if you wanted to save your
drawing as a blob in a database as opposed to on the file system.
Windows Forms creates a wrapper around ActiveX controls called AxHost.State
that implements ISerializable and wraps calls to IPersistStreamInit. If you
are using the control on a Windows Form you can use that, or you could look
into writing a similar wrapper.

The Visio drawing control supports IPersistStreamInit, IPersistStorage and
IPersistPropertyBag. It does NOT support IPersistStream. Only the
IPersistStreamInit and IPersistStorage mechanisms save the guts of the
existing drawing. And if the SRC property is not "" upon loading, the
control will attempt to replace the guts of the drawing with the specified
SRC file.

If you are using IPersistPropertyBag, you'll either get a blank control to
start with (even after a Load), or you have to specify a valid SRC file.

If you use IPersistStreamInit or IPersistStorage, you can save control
instances out with their drawings embedded in them with or without a SRC
property. However, if there is a SRC file and it can be loaded at control
load time, then the contents of that SRC file will replace the persisted
contents of the contained drawing that were loaded from the stream or
storage. If you want your persisted stream-based thing to come back
reliably, make sure the SRC property is set to the empty string prior to
persisting it out.

It's non-trivial, it's not officially supported with the control, but it is
doable. It's best to read up on stream storage before attacking this, and/or
sign up with other newsgroups that focus on these types of programming
issues. :)

We'll take your comments on adding the Access info to the article under
consideration -- we try to updates every several months or so, depending on
our schedules.

Thanks,
Mai-lan
 
M

Matt

Wow Mai-Lan

Thank you again - but I think you overlooked the fact that I'm absolute
beginner. You're killing me with all these terms and methods ;-)
I guess for the moment your solution is out of range for my level of
programming knowledge ...:-(
But I'm very willing to learn so pls. give me the name of that NG you
mentioned and I'll sign up and listen to the "big boys" .

Meanwhile Peter Suter from the German Visio Group pointed me to this
KB-article and when he was trying it worked.
http://support.microsoft.com/default.aspx?scid=kb;en-us;258038
(Access and Modify SQL Server BLOB Data by Using the ADO Stream Object)

Even I haven't worked with ADO so far, this looks much more like a solution
on my newbie-level.

What do think, will this work for me?

Thank you and best regards
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top