Author Topic: borderless mode  (Read 4624 times)

Brigetiol

  • Guest
borderless mode
« on: April 01, 2018, 11:37:19 PM »
Hi,

Thanks for the new update  :) !

Is there a trick to enable borderless mode in V1.7, like it was in previous versions? Window resizing works fine, dark theme works fine, I only can't find the way to remove window borders...

Thanks in advance!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: borderless mode
« Reply #1 on: April 02, 2018, 10:46:40 AM »
Because VoiceAttack can now be resized, the window borders are enabled to easily allow that. Also, the window can only be moved by dragging the title bar.


If you don't need to resize, move, or minimize the main window, and are willing to close VoiceAttack by other means than the title bar (E.G. the task bar, the tray icon, or just Alt-F4), there is a "trick" that works.

Note that this really is a "trick", not official, and not guaranteed to keep working(though it should as long as VoiceAttack uses WinForms and the main window name doesn't change).


Add this as an inline C# function and run the command:
Code: [Select]
using System.Windows.Forms;

public class VAInline
{
    public void main()
    {
        Application.OpenForms["frmMain"].FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    }
}

You can put it in a command that will run when your profile loads, so it'll happen automatically(as this change will only last while the window is open).


Again, this is an unofficial "trick", so before reporting any strange behavior in VoiceAttack, disable the command, restart VoiceAttack, and see if it persists.

Brigetiol

  • Guest
Re: borderless mode
« Reply #2 on: April 02, 2018, 11:46:21 PM »
Hi Pfeil,

Thank you, works fine :) !

Is there maybe a code-line to adjust window size to 656x302?

Maybe-maybe to adjust font colors?

I have a virtual dashboard on a secondary monitor, it has mainly green and orange colors on a black background, would be great to have the same colors in the VA window...

https://i.imgur.com/Cefn2zB.jpg

Best regards!


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: borderless mode
« Reply #3 on: April 03, 2018, 02:53:51 AM »
Code: [Select]
using System;
using System.Windows.Forms;
using System.IO;
using System.Drawing;

public class VAInline
{
    public void main()
    {
//Remove window border
Application.OpenForms["frmMain"].FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
//Change minimum size to allow the window to become smaller than designed(this will "squish" the controls together)
Application.OpenForms["frmMain"].MinimumSize = new System.Drawing.Size(656, 302);
//Change the size of the window
Application.OpenForms["frmMain"].Size = new System.Drawing.Size(656, 302);

//Change the location of the window
Application.OpenForms["frmMain"].Location = new System.Drawing.Point(0, 1920);

//Choose the font color
Color fontColor = Color.FromArgb(233, 124, 39);
//Change the font color for "Profile" and "Target"
Application.OpenForms["frmMain"].ForeColor = fontColor;
//Change the font color for the "Profile" box
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProfile"].ForeColor = fontColor;
//Change the font color for the log
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"].ForeColor = fontColor;

//Change the font color for the "Target" box
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProcesses"].ForeColor = fontColor;
//Alternatively, as the above doesn't affect all entries in the comboBox, hide it
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProcesses"].Hide();
//Because hiding the label makes the "Profile" box shrink, just make it blend into the background instead
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lblSendCommands"].ForeColor = Color.Black;
    }
}

The comments should explain what it's doing, but you'll want to modify two values:

The window location, which doesn't need to be changed per-se, but can for pixel-perfect alignment(if you don't need this just add "//" to comment it out); I believe that if your primary monitor is 1920 pixels high, and the secondary is aligned with the top left corner of it, the location could be correct as it's set now, but this may require tweaking on your end.

The font color; I picked a color out of your photograph, so it won't be the same as already in use on your screen. The parameters for "Color.FromArgb" are individual red, green, and blue values.


I chose to hide the "Target" dropdown, as the top items are unaffected by changing the ForeColor(I didn't spend too long looking for a solution to this, to be honest), and you seem to have it set to "Active Window" anyways, so it's not needed.


EDIT: For anyone coming across this topic after the new UI is released (or already using a beta version of v1.7.9):
Setting the window border no longer works with this new version, however changing font colors (and the position of the window) is still possible:
Code: [Select]
using System;
using System.Windows.Forms;
using System.Drawing;
using Telerik.WinControls;
using Telerik.WinControls.UI;

public class VAInline
{
    public void main()
    {
//Change the location of the window
Application.OpenForms["frmMain"].Location = new System.Drawing.Point(-656, 30);

//Set the font color
Color fontColor = Color.FromArgb(233, 124, 39);
//Change the font color for "Profile"
Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lblProfile"].ForeColor = fontColor;
//Change the font color for the "Profile" box
((RadDropDownList)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProfile"]).DropDownListElement.EditableElement.ForeColor = fontColor;
//Change the font color for the log
((RadListView)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"]).ListViewElement.ForeColor = fontColor;
    }
}

Important as well is to add the references to the new control libraries in the "Referenced Assemblies" field (overwrite all the existing contents of that field with this):
Code: [Select]
System.dll;System.Drawing.dll;System.Windows.Forms.dll;{VA_DIR}\Telerik.WinControls.dll;{VA_DIR}\Telerik.WinControls.UI.dll
Also note that this is not intended to work with compact mode, and that the profile dropdown list items (only visible when the list is open) will still be the default color (I.E. black or white).
« Last Edit: December 04, 2019, 07:50:31 PM by Pfeil »

Brigetiol

  • Guest
Re: borderless mode
« Reply #4 on: April 03, 2018, 06:14:33 AM »
Thank you very-very much!

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: borderless mode
« Reply #5 on: June 20, 2018, 10:15:29 AM »
Going to add this to the list of existing inline functions! Great work as usual Pfeil :)

CMDR_EVOLUTION

  • Newbie
  • *
  • Posts: 7
Re: borderless mode
« Reply #6 on: November 30, 2019, 05:47:53 AM »
Hi guys.

Thanks a lot for this info from last year. Sorry to resurrect the thread after so long. I've used VA for around 4 years but this thread just made me open a forum account :)

I'm using VA 1.7.8 and I'm not sure how to execute these commands in C# ?

I copied some info into notepad++ and saved it as a CS file, then put it into my VA installation folder. When I click it in Windows explorer, W10 just asks which application to open it with.

I tried to open with VA but it loads as normal with the border showing.

Secondly and once it can run, where you mentioned about needing to be ran each time VA is used, I can't seem to find a trigger to run at startup. I've looked through the big VA manual as well.

As an alternative to borderless mode, I'd be happy to set it to black when not in use if that's a viable workaround?

I'd greatly appreciate your help. You guys know what you're talking about! ;).

Here's a screenshot of the file, Voice attack in darl mode but showing a light border when not the active window, a new VA command underneath (showing the only triggers I have but not one for startup), plus the file location in the installation directory.

Many thanks,
Evo

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: borderless mode
« Reply #7 on: November 30, 2019, 07:45:07 AM »
You need to use an "Inline Function - C# Code" action, as found under "Other >", "Advanced", "Execute an Inline Function" -> "C# Code".


For information on running a command when a profile loads, search VoiceAttackHelp.pdf for "execute a command each time this profile is loaded".
However, note that this will likely not work with HCS Voice Packs profiles, as they restrict certain modifications (and startup commands are not executed for included profiles).

You could set up a profile that's loaded by default each time you start VoiceAttack, which then uses a "Switch to Another Profile" action to load the HCS Voice Packs profile.

CMDR_EVOLUTION

  • Newbie
  • *
  • Posts: 7
Re: borderless mode
« Reply #8 on: December 01, 2019, 07:54:43 AM »
Thanks a lot Pfeil!

I followed your instructions and also followed your other instructions to use the script to change the UI colour as well, it looks great now!

I'm using an HD screen, 4k screen for Elite Dangerous and 2x tablets as 3rd and 4th screens with an app called spacedesk. By using some of your amazing coding skills, I now have a Voice Attack Tablet joined to the left of my chair so I can use the touch screen to enable voice etc with VA :D

Thank you so much