What's the best way to get around the lack of transparency in WixUI background images? - wix

I'm using the Feature Tree UI, with a couple of custom dialogs. One of these has checkboxes on it. These checkboxes cannot be made to have transparent backgrounds, meaning I've had to colour in my background image the default background colour so that there aren't visible boxes around the checkboxes.
However, different versions of Windows have different default colouring! If I match the colour on Windows 7, it looks bad on XP, etc. Since the background images are Bitmaps, I can't make them transparent. What can I do to get around this problem?

From the WiX tutorial UI revisited chapter:
And a common complaint: no, the checkbox can't have a transparent
background. If you have a bitmap in the background, it will be ugly,
just like in our example above. The only workaround is to reduce the
width of the checkbox to the actual box itself and to place an
additional static text (these can be made transparent) adjacent to it.
This workaround has a side effect, although: in order to turn the checkbox on and off, you should click exactly in the box area, not the text. Comparing to the rest of Windows Installer UI limitations, it's slightly annoying :-)

Windows installer supports 32-bit bitmaps (ARGB), which means that the bitmap can be made transparent to show the default windows background color. This means, once your (not transparent) check-box is placed on top, you won't see the ugly box around the text, because it's the same color.
Note that windows photo viewer and the thumbnail preview in explorer DONT support transparencies, so you'll have to build and run your installer to see it working =D.
I used gimp to export to BMP with a transparency and it worked just fine with WIX.

Related

Windows Forms/Controls Resized on Wide Screen Monitor

Here at work I have been relegated to working on an old 4:3 monitor. The application I am working on in VB.NET (VS 2008) has several forms and controls that are sized to a specific height and width. They look fine on my monitor, but when I recently released a Beta for Users to try, the users that had widescreen monitors had stretched dialog forms and stretched controls on those forms. Is there a form property to set, or a programming technique to use, in order for the form and all of it's controls to display EXACTLY to the width and height specified?
I ended up fixing the problem myself by setting the .AutoScaleMode of the form to "None", and setting all my fonts to use pixels instead of points.
Unfortunately, this was not an issue of code, but rather of design. Sure, it's easy enough to post code snippets, but if I need to post a whole windows form application that's another story altogether.

how to set form border thickness

I am writing an app using VB.net in VB2013. The Sizeable border is too thick in when displayed on PC's with later versions of Windows7, Windows 8(.1).
Does anyone know how to change the thickness of the window?
You don't get to control that. That's part of the user theme, and users can set any theme they want. You'll find it's also a problem on older versions of Windows if users have a theme with a wider border. You'll need to adjust your program's layout to allow for a little less space.
The border is drawn by the operating system, but you can create your own custom form, there is a library on CodePlex may help you to do what you need easily.
Drawing Custom Borders in Windows Forms

AutoScaling WinForm Display (Small, Medium)

First and foremost, please forgive me but my screenshots are in French due to my Windows installation at work. It is still very easy to understand though. I'll include screenshots to make it more visually appealing.
Here's some background information:
Windows 7 64bit
Visual Studio 2010
Default display is 100%
AutoScaleMode: DPI
AutoSize: True
My application is a windows form that was developped in a default (small - 100%) display. Like so:
As you can see, the "Petite" or Small display is the default selection.
Small Display - 100% (default)
Here is how my application looks with this setting. This is the correct display
Medium Display - 125%
The red rectangles point out the unwanted empty space.
I have tried:
Anchoring / Docking my controls such as my split containers, table layout panels, list views on Form_Load and via the UI. This didn't work.
Adding a split container to the form, and all controls respectively separated into it
Adding Table layout panels, where all textboxes and buttons are located in their respective cells
I really thought it was having a scaling problem because of the anchoring and docking. Although that didn't seem to be the problem ... What seems to be having trouble is the Tab Control and Listviews ...
Some users (most) have their settings as the default (100%) but there are a few who have it at a Medium setting, causing this scaling issue. Is there a way to fix this?
I cant see your screenshots or links for some reason so I cannot visualize the problem. If scaling is the problem, try setting AutoScaleMode to None.
I recently had to do this because my winform app was image intensive and it would not render correctly on Medium Settings because I built it using the default Small Settnigs display. Changing scale mode to None worked for me.
I fixed my issue by putting the tab controls and list views in a tablelayoutpanel. Everything that wasn't scaled properly had to be put inside a TableLayoutPanel. I kept my AutoScaleMode to DPI and AutoSize to True
Be sure to dock everything in their parent containers.
Here's the document outline for the more visual (like me):
Just click on the form and go to property pane. Find the Anchor element and click the dropdown. You click on all the lines in the square structure to become grey. Then click enter. Problem resolved.

.NET Graphics on Windows 7: White corners around images?

I've been working on some custom graphics controls, and I found this weird problem with windows 7 rendering my button controls. I've used Photoshop to delete the pixels in the background all around the button image I'm using, then saved it as a GIF, and imported it into VS to use as the background image of my button. When windows XP renders it, it is fine, but when windows 7 renders it, all 4 corners have an odd white border around them.
You can barely see them in this pic, but they are much more apparent when looking at them on the client PC's.
Is there something wrong with the way I am transfering the image? should I not use a gif? is there something wrong with the way I am displaying it on the button? What can I do about it?
GIF was a bad choice, it can only render images with 256 colors. You need all the colors you can get to make the anti-aliasing work properly. Use PNG.
You will also need to make sure that the background color of the container is the same as the one you used in Photoshop, the anti-aliasing pixels will otherwise have the wrong colors. And you cannot stretch the image, that will also stretch the anti-aliasing pixels, ruining the effect.

PyQt - Transparent background

I try to make the background of my window transparent. But under widgets which are on it i see parts of my desktop-image.
Now i have this in constructor:
self.setFocusPolicy(Qt.StrongFocus)
self.setAttribute(Qt.WA_QuitOnClose,True)
self.setBackgroundRole(QtGui.QPalette.Base)
self.setAttribute(Qt.WA_NoSystemBackground)
I've just found this:
Creating Translucent Windows
Since Qt 4.5, it has been possible to
create windows with translucent
regions on window systems that support
compositing.
To enable this feature in a top-level
widget, set its
Qt::WA_TranslucentBackground attribute
with setAttribute() and ensure that
its background is painted with
non-opaque colors in the regions you
want to be partially transparent.
PyQt is still Qt 4.4, maybe that is the problem.
Further to gs's answer, this faq explains why (before Qt 4.5) you cannot achieve this:
FAQ Link:
There is no direct support for partial
transparency, where the window is
transparent and the widgets on it are
not in Qt.
Remember, PyQt's most recent version was created against Qt 4.4, and so does not support the semi-transparent window you desire. gs's other answer, about setAutoFillBackground(True) would work if you were setting the background colour of your main window to anything other than transparent.
Also, see the documentation for Qt.WA_NoSystemBackground, it says you can't depend on the transparent effect that you have so far had:
Qt::WA_NoSystemBackground
Indicates that the widget has no
background, i.e. when the widget
receives paint events, the background
is not automatically repainted. Note:
Unlike WA_OpaquePaintEvent, newly
exposed areas are never filled with
the background (e.g after showing a
window for the first time the user can
see "through" it until the application
processes the paint events). This is
set/cleared by the widget's author.
Try this for your widgets:
widget.setAutoFillBackground(True)
I think you could also set it in the Qt Designer.