1
votes

I have a VB6 MDI application and the users can select which database they want to connect to (eg "archive" or "live"). When the users are accessing the "archive" database, I would like to have this prominantly displayed. Ideally as a watermark across the forms. All the controls would still be visible and work correctly. I need this watermark to persist when they use print screen. In fact, a solution where just the print screen is watermarked would be ok.

Also, I would prefer a solution which I could implement in the MDI parent form, so I don't have to change all the individual child forms.

So far, I've tried.

  1. Add watermark to MDI parent background, and make MDI children semi-transparent. Unfortunately, it seeems that you can't make MDI child forms transparent - the whole MDI application (parent and children) becomes transparent.

  2. Make the MDI application tranparent, then add a non-child form with the watermark behind the MDI parent form (this form moves and resizes in line with the MDI parent). This look ok, if a bit faint, but Alt-PrintScreen only captures the MDI window, so the watermark effect is not captured. PrintScreen is ok. So, I could consider adding a keyboard hook to disable Alt-Printscreen.

  3. Add a keyboard hook to trap the PrintScreen keypress and then display a transparent form with the watermark over the MDI application. As with 2, the Alt-PrintScreen only captures the MDI form, and does not show the watermark effect. Also, this solution only watermarks the print screen output.

  4. Adding a background image to the MDI form. This doesn't show through the other controls, and with forms with a lot of frames, the watermark is not that obvious.

Is there some neat way to render the watermark graphics over the form window? Can you place a transparent picture box over the other controls and still have these controls work correctly?

All advice appreciated.

Thanks

2
This will be very very hard to implement as you have already discovered. Can you just change form's background color if operating on archive (to poisonous green)?wqw
I tried something like this using a background image on the form, rather than a background colour. For a lot of forms it looks fine. Unfortunately some forms are covered in other controls (grids, frames, etc.) and the distinctive colour/image only shows round the edges. Also, we frequently print screenshots to black and white - so colour differences are not ideal.djk

2 Answers

1
votes

I would create a new form that is transparent except for the watermark verbiage you are looking for. That form would use code to ensure it is always on top and no other form is in front of it. The MDI form would launch this form and control whether the form showed the archive or live watermark as well as the position of the form.

Personally, I've always used the application title or a status bar to always display this information.

0
votes

The main reason for this fix was to prevent any reports or screen shots from the "archive" system getting confused with the "live" system. I would have liked to watermark the screens, but it seems too awkward. The helpful suggestions to change the colour/image of the form background, or add something to the title, etc. are good, simple solutions.

Howevever, I did need to make sure any printed materials or screen shots were clearly marked.

Watermarking the reports was pretty straight forward since they use Word/Excel automation etc. - so I could just add transparent text boxes etc. when printing from the "archive" database.

Distinguishing the screen shots between "archive"/"live" was a bit more awkward. Eventually I went with the approach of setting a keyboard hook to trap any print screen key presses. This is only activated on the "archive" system. On the key-up event of the print screen, I copy the bitmap from the clipboard into a picturebox (on a hidden form); tile a transparent watermark image over it; then copy the picturebox image back to the clipboard. So, if it is pasted into another application it has the watermark. Seems to work well. Of course, this will watermark all screen shots, whether they are of the application forms or not - but that's ok with the users.