Option buttons become black - no text shown

C

chris

I created an activeX DLL in VB6 with a form having checkboxes & option
buttons. When opeing this form (of DLL) in MSAccess 2007, option buttons on
frames became black. If I change their style to be Graphical it is ok.

When I open this form (of DLL) from:
1. MSAccess 2007 MDE db that was created from MSAccess 2007 in 2003 MDB
format (development is done in MSAccess 2000 for being able to upgrade in
all version; so MDB is converted from 2000), option buttons on frames become
black. Frames fonts change.

2. MSAccess 2007 MDE db that was created from MSAccess 2007 in 2003 MDB
format (created in MS Access 2007), option buttons are ok. Frames fonts do
not change.

What settings of MSAccess db could affect this ? How can I avoid this ?

Thanks a lot in advance!
 
D

Dave O.

Get rid of the frames. If you need a container use a picture box, if you
want the box around them use a shape.
I'm assuming MSAccess 2007 has the XP style pretties enabled because the
frame control does not expose a hDc which is needed to paint the themed
controls so they don't get painted, hence the black rectangles. The
checkbox's graphical mode is not supported by the theme so they are not
altered.

Dave O.
 
C

chris

Thanks Dave, what is weird is that when form is shown (called from referenced
DLL) in a 2003 MDB created from Office 2007, everything is ok. The problem
appears ONLY when form is shown (called from DLL) in 2003 MDB created from
older versions.

I could import all objects in a new MDB, but I would loose the permissions
assigned to user groups as I use MDW...
 
P

Peter T

I am very interested to recreate your problem, but I really don't follow
your description of what you have, how things are implemented etc. Apart
from the compiling against different Access versions is there any other
difference in the VB6 dll. What does this mean -
"that was created from MSAccess 2007 in 2003 MDB
format (development is done in MSAccess 2000 for "

It sounds like you are accidentally picking up XP or Vista control styles in
your VB aX dll when called in an Office app. That's exactly what I want to
do but don't know how to.

Actually I can, possibly by implementing what to you is a problem. That is,
in the same folder as the Office exe saving a particular manifest, named
<OfficeAppName>.exe.manifest (look for say access.exe.manifest in your app
folders). Your v12 app will definitely have a manifest, though by default it
should not have any impact on your control styles (but can edit the manifest
to give the styles). Pre Office12 apps do not have a manifest by default
(though someone like me may have put one there).

My problem is it's far from practical to save such a file in the relevant
Programs folder, shouldn't do that anyway anyway.

To solve your problem put your Optionbuttons in a Picturebox as Dave
suggests, and be pleased if you accidentally get XP/Vista styles for all the
other controls!

Could you clarify what you have

Regards,
Peter T
 
C

chris

Yes, it is a weird case... Let me describe it in more detail..

1. DLL is created in VB6 (ActiveX DLL)
2. My clients have all office version, so I develop program in Office 2000
and upgrade it to the rest of office versions.
3. For Office 2007 program, I convert 2000 MDB to 2003 MDB and I use it in
MSAccess 2007 for creating an MDE file for Office 2007. When running this MDE
file, problem appears.
4. I created in MS Access 2007 a new db in 2003 format. Referenced DLL and
created another MDE. No problem appears.

I hope is more clear now.

So the problem comes from the fact that for first MDE file, MDB from older
MS Access versions where used...

Picturebox is not a good solution for me as there are a lot of controls on
frames, have a lot of frames and try to simulate a tabbed control :-(
 
P

Peter T

This part -
I convert 2000 MDB to 2003 MDB

How does this relate to the dll, if at all
When running this MDE
file, problem appears.

I don't know what an MDE file is (I probably ought). Does this file have a
manifest associated with it, if so where is it and where is the dll

I assume you do not have a resource file in the dll that's used to create a
manifest, but could you confirm.
Picturebox is not a good solution for me as there are a lot of controls on
frames, have a lot of frames and try to simulate a tabbed control :-(

Open the *.frm file in a text editor (after saving a backup). Replace-all -
"VB.Frame" with "VB.PictureBox"

Comment out any properties that apply to a Frame but not a Picturebox, eg
Caption
Add in any properties for the Picturebox you'll need, eg colour. The
following change from "original" to "new" worked fine for me

original...

Begin VB.Frame Frame1
Caption = "Frame1"
Height = 900
Left = 420
TabIndex = 0
Top = 255
Width = 2625
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 240
Left = 240
TabIndex = 2
Top = 330
Width = 1995
End
End

new....

Begin VB.PictureBox Frame1 ' keep same name if referred to in code
' Caption = "Frame1"
Appearance = 0 'Flat ' new
BorderStyle = 0 'None ' new
ForeColor = &H80000008& ' new
Height = 900
Left = 420
TabIndex = 0
Top = 255
Width = 2625
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 240
Left = 240
TabIndex = 2
Top = 330
Width = 1995
End
End

Put a generic "styles" type manifest in the same folder as your VB6.exe
named "vb6.exe.manifest". This should show you how styles are implemented in
your VBE, including any black optionbuttons.

Regards,
Peter T
 
C

chris

Don't know how it relates, but it seems it does. MDE is a kind of 'EXE' that
MS Access creates from MDB files. No manifest is associated with it or the
DLL file.

In DLL I do not have any resource file. I created a test DLL with only 1
form (it's just a new project EXE in VB6 with checkboxes and option buttons).
FM20.DLL is referenced, so I could try checkboxes and option buttons from it
also.

Thanks for the steps for Picture box. I will have them in mind. If I do not
find a solution tilll release time, I think I will set option's buttons style
to graphical, they will look like tagged buttons, but at least text will not
be black.
 
C

chris

What if I use a frame instead of shape for box around and I include a picture
box (with option buttons) in frame ?
 
D

Dave O.

Why not try it and find out?
But why bother? the frame is redundant as the picture box is the container,
if you want a border use a shape control inside the picture box or just draw
on the picture box any lines you need, it's not all that difficult. Adding a
frame is just increasing the resource load for zero benefit.

Dave O.
 
C

chris

You are right, why to bother, 2 shapes (1 white + 1 grey) + a label create a
frame. I got used to use frames for separating sections on forms...

It works with inserting picture box in frame..

Thanks a lot Dave!
 

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