Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Csharpie #1
Member since Apr 2017 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Matrix login procedure messing with Windows Forms scaling
Hello,

I am currently developing a small project based on the MatriX dll, using a regular C# WinForms application in VS2015.

My sample code looks like this:
  1. using System;
  2. using System.Windows.Forms;
  3. using Matrix.Xmpp.Client;
  4.  
  5. namespace WindowsFormsApplication1
  6. {
  7.     public partial class Form1 : Form
  8.     {
  9.         String lic = @"MyVerySecretLicenseKey";
  10.         XmppClient xmppClient = new XmppClient();
  11.  
  12.         public Form1()
  13.         {
  14.             Matrix.License.LicenseManager.SetLicense(lic);
  15.             InitializeComponent();
  16.         }
  17.  
  18.         private void button1_Click(object sender, System.EventArgs e)
  19.         {
  20.             openXmppSession();
  21.         }
  22.  
  23.         private void openXmppSession()
  24.         {
  25.             xmppClient.SetUsername("testuser");
  26.             xmppClient.SetXmppDomain(Properties.Settings.Default.serverAddress);
  27.             xmppClient.Password = "testPassWord";
  28.             xmppClient.Open();
  29.         }
  30.  
  31.     }
  32. }

It works fine, but on Windows 10 HiDPI-Devices (where scaling is set to 200% by default), it breaks the rendering of the window. You can see the result in the attached screenshot, taken from a Surface Book.

I suspect this has something to do with the license window, which would normally appear at this point, but gets suppressed since a valid license is provided...

Regards!
The author has attached one file to this post:
matrix.png 16.7 kBytes
You have no permission to open this file.
This post was edited on 2017-04-28, 09:44 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Can you use the MatriX light package?
This comes without any dialogs and references to winforms.

Alex
Avatar
Csharpie #3
Member since Apr 2017 · 2 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

thank you for the quick response, a first test looks positive :) Are there any mentionable drawbacks on this version?

Regards!
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The non light version has references to WinForms and WPF. The main reason for having those references is to make it a little easier for programmers which write GUI applications with MatriX. Because then MatriX internal invokes all the threads back to your main UI thread. So you don"t have to invoke any event yourself.

And there is a  property in the vcard which gives you the user avatar as a System.Drawing/Image.

So, not really any drawbacks. You can easily invoke events yourself when required, and getting an image from the Base64 vcard data is also pretty trivial. We can share the code when you need it.

My assumption is that you hit the problem described here:
http://stackoverflow.com/questions/34900791/mixed-wpf-and-…
Because MatriX references SWF and WPF in the full version. Maybe the manifest described from there solves your problem as well.

MatriX only tries to find your GUI dispatcher during the login. It does not execute and other code on your related to scaling.
It could also help when you set the dispatcher yourself, then MatriX will not try search for it during the login.

I hope this helps.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS