How to force landscape on a Flash builder mobile app - mobile

I am building a mobile application using Flash Builder. I am testing on a Motorola Xoom. When the app opens on the attached Xoom it opens with the correct orientation (landscape), but when it opens on the computer in the emulator it is backwards (Portrait).
I have specified the ratio and orientation in the *-app.xml:
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
I'm assuming it is a bug but it is possible that I am missing something or that there may be a fix.

In my case, neither was working. So, for the desktop version, I've made an ugly thing: duplicated the aspectRatio property above the others, after title property. I don't know if the position of the property matters, but that way it worked.
There is just one problem with this approach: when building the debug version of your application all works fine (including in mobile), but when you build the release version, an error occurs saying that the aspectRation property is unexpected. Just remove one of them and the build will work.
Just for the register, to make it work in mobile, I had to set the property aspectRatio in the code too, like this:
stage.setAspectRatio(StageAspectRatio.LANDSCAPE);

Related

Why is Visual Studio 2017's new AutoScale support resizing my Forms app at runtime?

We have a Windows Forms application used for testing our products that has had pretty much the same forms and dialogs for nearly 10 years now. AutoScaleMode in the designer is set to Font for both forms, and that hasn't changed since the original design. AutoSize is set to false and just for good measure (I guess) AutoSizeMode is set to GrowOnly. The following source lines are in Program.cs:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Remember, this has been working flawlessly for years...
One of the recent updates to VS2017 included AutoScale support for monitors with different DPI. I have a relatively high DPI monitor, so when I made some changes to a Settings dialog (adding controls, etc) I started getting bright yellow banners cross the top of the designer surface telling me that AutoScaling was set to 125%, and would I like to change that? I tried going back and forth, and when in 100% mode (Autoscaling off) I was warned that XAML forms might not display correctly. Fine, I am working with Forms so I went back to "normal" scaling and the form looked fine.
Until I tried running the program. Now when I start the program the main form looks like this (details deleted to protect the guilty):
...but when I open the settings dialog it looks like this:
Yikes! It looks worse in practice, the relative images here don't do justice to the difference in size and scale.
I have no idea what got changed or how / why this is happening, but there's no way I can put this into production. I've tried changing the AutoScale settings, to no avail. Can somebody point me in the right direction here?
Thanks in advance!
EDIT: It seems the rescaling only happens on my machine when I run the app in Debug. Whatever is messing up the display of the forms on my machine doesn't do that on my associates' machines and isn't replicated to the executable produced by the build server.
On another note, I tried every DPI-related setting I could find, added those that weren't there due to the program's age, all to no avail. Nothing I have tried has had any effect on the program's display weirdness on my machine. Ugh.
I tried all the tricks I could find, short of disabling AutoScale completely, and nothing worked. I finally merged our develop branch in to my feature branch and inspected all 270 edits, choosing the oldest settings I could find for all size parameters, all controls. Ugh.
Along the way I stumbled across the following line in the Designer.cs file for the form:
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
This setting is NOT accessible from Visual Studio's designer, as far as I can tell, nor can I find anything about how or why it gets set. What I did find was that in the earlier version that did work as expected, the values were (8F, 17F) -- so I manually edited the line to match the older, working version. Success!
I also checked my Windows display settings, and the Custom Scaling value was at 100%, so I used the registry hack mentioned in one of the articles I found following the first link from the comment above (thanks, #Jimi) to disable auto-scaling in Visual Studio, then turned off the notification. Now I'm (finally) back in business.
Registry hack is here:
https://learn.microsoft.com/en-us/dotnet/framework/winforms/disable-dpi-awareness-visual-studio
If one uses the registry hack mentioned in the answer from DaveN59, and there is already entry for your ...\devenv.exe (mine was previously set to run as admin) then add the DPIUNAWARE string to the end of the "Data". Make sure to use a space as a separator.
Example: ^ RUNASADMIN DPIUNAWARE
I'm not sure what the ^ is for, but it was there and I just added DPIUNAWARE string. Also, if you just add this string, it will come up unscaled, but you will still see the yellow banner. To turn that off you'll need to select that option from with in Visual Studio. The instructions are in the link for the registry hack, also provided above. For conveinece here's the menu navigation path.
To disable notifications, choose Tools > Options to open the Options
dialog. Then, choose Windows Forms Designer > General, and set DPI
Scaling Notifications to False.

GUI elements are only shown when mouse is moved over them

in my company we developed a C#/WPF application and everything works fine. By request of our customer we are limited to the .NET 3.5 framework. In the application there is a settings dialog which is displayed correctly on our companies windows 7 systems. Now our customer has sent us a screenshot that shows the dialog (a window) which is totaly blank. He also wrote that the ui controls only appear if he moves the mouse over them.
We are not able to reproduce this. It looks like a missing repaint of the window or something like this. It is working perfectly on several of our systems. Does anyone know what could cause this effect? We do not have any informations about the computer systems that are used, except that they use windows 7.
Thanks in advance
This can be a hardware render bug.
Try a software render mode(this needs a change in your source code):
Software rendering mode - WPF
Or just ask client to enable software mode on his machine:
https://msdn.microsoft.com/en-us/library/aa970912(v=vs.90).aspx

Windowless Silverlight (and Flash?) app on Firefox: wrong mouse positions reported

When I create a windowless Silverlight app and run it on Firefox, wrong mouse positions are reported. There is a vertical offset between the actual mouse position and what the application responds to.
I also tagged this question with Flash because my research shows that this problem also occurs with Flash (see links below).
To reproduce:
Step 1: Create a new Silverlight application.
Step 2: Inside the grid of MainApp.xaml add the following:
<HyperlinkButton NavigateUri="http://google.com" VerticalAlignment="Center" HorizontalAlignment="Center">GOOGLE</HyperlinkButton>
Step 3: In SilverApplicationXTestPage.aspx (in the web project) add the following parameter to the Silverlight object:
<param name="windowless" value="true" />
Now run the silverlight application. When you hover the link it doesn't get underlined. Now slowly move the mouse up until at a certain offset above the link it will get highlighted.
This problem doesn't happen if you do one of the following:
Switch Firefox into full screen mode (it seems that the top bar is the cause for the offset, so when it's not visible there is no offset).
Do not use Silverlight in a windowless mode.
Use any other browser.
I'm using Silverlight 4 on Firefox 8.0 on Windows 7.
This seems like an old problem that affects not just Silverlight, but also Flash.
In my research I came across the following suggested workarounds, non of which worked for me:
Do not use overflow in css.
Use css to set html margin of 1px.
Do not use iframe (but the reproduction steps above do not use an iframe anyway).
As I mentioned none of the above workarounds seem to work.
Here are some references to mentions of this problem or similar:
http://forums.silverlight.net/t/161640.aspx/1/10
https://bugzilla.mozilla.org/show_bug.cgi?id=362193
http://forums.silverlight.net/t/94583.aspx/2/10#
https://bugzilla.mozilla.org/show_bug.cgi?id=536429
Does anyone know how to overcome this? Any workaround? I'm desperate!
I found this: http://support.mozilla.org/en-US/questions/795168.
"Enabling the plugin-container.exe in about:config (dom.ipc.plugins.enabled) fixes the mouse issue but then Silverlight plugin pop-ups (webcam/microphone permission for example) freeze the browser."
I didn't see the problem with the popup (a copy permissions) after changing the config.
Making it full-screen also helped before I made this config change.
This requires the user to change their browser setting, which is not ideal.
This is similar to this question: Silverlight- bad mouse position when embedded in html page when Firefox has zoom

Disable Cleartype (text anti-aliasing) in IE9

It's well documented (e.g. here) that IE9 ignores the OS-wide settings for font smoothing (aka anti-aliasing). Even if font-smoothing and ClearType are disabled in Windows, IE still shows anti-aliased fonts, which some users struggle to read, especially at small font sizes.
How can I disable all font anti-aliasing (ClearType or otherwise) in IE9?
More details:
Our company builds a web application which uses a lot of small fonts. With the release of IE9, some of our users have complained that IE9's default anti-aliasing makes our small fonts fuzzy or blurry. So we need to help our users who've installed IE9 and who want to turn off anti-aliasing.
Also, personally, I have trouble reading small, anti-aliased fonts, so I'd like a solution for my own use, even for sites I don't control.
In IE8 I could uncheck the "Always use ClearType for HTML" and then disable ClearType in the OS and IE8 would show all fonts aliased. But in IE9, this option is missing.
After some research about the problem, here's what I've learned: the core issue is that IE relies on DirectWrite for text rendering and does not support any of the newer rendering options which would draw text without anti-aliasing and respect the user's OS-wide default choices.
Making things worse, if you disable ClearType in the OS, in some cases IE will fall back to DirectWrite's default non-cleartype anti-aliasing which is even fuzzier than ClearType.
After a few days of searching, I found an MSDN Forums thread which pointed me to a solution here: http://www.softwareninjas.ca/dwrite-dll-wrapper
Follow the instructions on that page and you'll remove anti-aliasing from IE9 (at least the 32-bit version of IE which is the default IE, even on 64-bit Windows 7). I've tested it so far on a Win7 x64 laptop and it worked flawlessly.
Big thanks to Olivier Dagenais who built this. Here's a technical summary of how his solution works.
It's a two-step process. First, you need to disable ClearType in IE via a registry key. This is the same setting which was available in previous versions of IE, but it was removed from the IE UI because it stopped working in IE9.
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"UseClearType"="no"
Second, now that ClearType is disabled, Windows will fall back to a non-cleartype anti-aliasing solution. Now that fallback anti-alising also needs to be disabled. Quoting from the thread above:
What is left is the font smoothing
(aka sub-pixel rendering), and that is
the "blurring effect" you still see
after turning cleartype off.
In case you were wondering, there is a
way to turn that off too.
The method i used to turn off the
sub-pixel wonder is to build a simple
wrapper for dwrite.dll which
intercepts and forwards calls to the
real dwrite.dll, disabling font
smoothing in the process.
You can download it from: http://www.softwareninjas.ca/dwrite-dll-wrapper
You can find the code at
https://softwareninjas.kilnhg.com/Repo/Open-Source/Group/DWrite-dll-Wrapper
This was a pretty cool hack. Probably somewhat brittle across windows and DirectX releases, but will do the trick for now until Microsoft gets their act together to fix the underlying "can't disable anti-aliasing" problem in IE itself.
It also works for apps which use the IE WebBrowser control (aka MSHTML), so you can control anti-aliasing on an app-by-app basis. It also works for the HTML Help viewer.
Note that the text quality in IE9 standards mode isn't ideal. Specifically, small fonts sometimes have letters sometimes run together without the usual one-pixel space between them. If you render the same page in compatibility mode (or your site uses a non-strict DTD or other non-standards-enforcing DTD), then it looks fine. So there's an additional step for some sites if they want the best aliased text rendering: just view a site in compatibility mode by pressing the compatibility button in IE's toolbar.
To answer your question directly:
ClearType font rendering is used in all IE9 document modes; sub-pixel
positioning is used only in IE9’s
default standards mode. IE9’s
compatibility modes—Quirks, 7, and
8—use whole-pixel text metrics.
So try switching your doctype to use Quirks mode:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
The other thing to consider is to try avoid point based font sizes.
Important information regarding fonts, blurriness and rendering in IE9
IE 9 does not use sub-pixel antialiasing under certain conditions
MSDN sources:
Sub-pixel Fonts in IE9 - blogs.msdn.com/b/ie/archive/2010/11/03/sub-pixel-fonts-in-ie9.aspx
IE9's blurry font text - www.hanselman.com/blog/TheUltimateGuideOfFiveThingsForNewIE9UsersWhoFearChange.aspx
Defining Document Compatibility
Documents Mode
The info here solves two problems:
1. Getting rid of cleartype and font smoothing in IE9
2. Getting rid of cleartype and font smoothing when IE10 is installed or installs itself automatically
I had done a registery hack to turn off cleartype in IE9:
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"UseClearType"="no"
and used a little piece of freeware to get rid of font smoothing in IE9:
https://softwareninjas.kilnhg.com/Repo/Open-Source/Group/DWrite-dll-Wrapper
Then IE10 automatically installed itself and the blurry type was back. I tried uninstalling IE 10, which wasn't through the add/remove programs interface but rather through the installed updates interface--removing the IE10 update. That ostensibly took me back to IE9, but the blurry type remained in spite of the fact that "no" was still the answer for cleartype in the registry and the two .dll files were still in my IE program folder.
So, I decided to uninstall IE9 and reinstall it. That also involved going through the installed updates interface and removing the IE9 update.
I rebooted and expected to have to reinstall the program, but my IE icon was still there. When I clicked it, IE9 opened with nice, sharp type.

WPF not rendering on remote desktop

I'm having problems with the rendering of a WPF app over a remote desktop connection.
The applications chrome is rendering, but none of the content is coming through, as if the window is not drawing. Instead the previous content of the screen is showing in it's place.
This has been a problem with the application running on both Vista & Win 7, with remote control being taken from XP and Win7.
The problem is not application specific, if I create a new WPF app, with just a textblock on the window, it will also not run. (Neather will the windows preview in VS2008 display.)
Is there some trick to getting WPF running under RDP?
I read on Kevin Dente's blog (from a twitter post) that he was having trouble with WPF apps in virtual machines. While not the same as Remote Desktop, it's possible the problem could be the same. Kevin was able to fix his problem by disabling hardware accelleration by creating a DWORD registry value at
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics\DisableHWAcceleration
and then setting it to 1.
His original blog post is here: http://weblogs.asp.net/kdente/archive/2009/10/19/visual-studio-2010-beta-2-editor-performance-fix-running-on-a-virtual-machine.aspx
That may not be your exact solution, but maybe it points you in the right direction.
WPF should render over RDP; it's smart enough to know when it can render in hardware, and when it can't it reverts to its own GDI+ based software rendering. I would make sure you're running .NET Framework 3.5 SP1 on the remote machine, since there were changes to remoting that might pose issues. (See link below.)
I've been developing a WPF app for the past 6 months and it works just fine over RDP. (From Vista and Win7 to XP, Vista and Server 2003.) One important caveat, however, is that it renders using the Classic theme. So if you're using controls that don't have a classic theme, they won't render. If you're just dropping a TextBox on a Window, then obviously that's not your problem.
Check out this question for some links that may be helpful: Are there problems with rendering WPF over Remote Desktop under Windows XP?
I just had this problem with the ribbonwindow not displaying correctly when testing for the first time via RDP - the transparent background was white, the close minimize/maximize buttons were missing, the rounded corners on the bottom of the window were square, and the top row of ribbon buttons were almost impossible to select.
Turns out there was a simple fix for me. Right-click the RDP connection icon (I have it saved on my desktop), select "Edit", then the "experience" tab, and change "detect connection quality automatically" to "LAN (10 Mbps or higher)".
This fixed it for me.
Ade
Did you also try Win7 latest RDP - Win7 connection? The thing is WPF doesn't use GDI to draw elements.
VNC clients (like UltraVNC) probably will do the trick for you as they using much simplier algorithms more like of sending bitmaps.
I have the same problem than the asker. The standard, out-of-the-box Checkbox is not rendering correctly. I can only see if it is checked when hoovering the checkbox. Otherwhise, no difference between checked and unchecked. Important note : It occurs when setting the foreground to white (see here : https://social.msdn.microsoft.com/Forums/vstudio/en-US/1c03db49-7e53-4cbb-9dd1-b328017c4453/wpf-checkbox-and-radiobutton-check-mark-not-showing-under-xp-windows-classic-theme-and-remote?forum=wpf)
Our application used to have this problem with a custom progress bar.
We fixed this by setting the background color of the Border control to White. This leads me to think there is an issue with transparent backgrounds
There is no special trick needed to get WPF content to show across remote desktop. Our WPF-based app renders just fine over RDP (tried from numerous machines) with no problems. We're even using animations, gradients, WriteableBitmap, etc. w/ no problems.

Resources