Author Topic: v1.8.2 Change Background UI colour?  (Read 2106 times)

CMDR_EVOLUTION

  • Newbie
  • *
  • Posts: 7
v1.8.2 Change Background UI colour?
« on: December 04, 2019, 03:52:06 AM »
Good morning,

I've been making changes to VA recently with inline functions from these forums, thank you. I'd set up borderless mode, font colour as blue and position and size to fill a tablet screen. I was previously using version 1.7.8 and loved the black background colour.

I have tablets connected to my PC and use voice attack on a 10" tablet connected to the left of my chair, which makes enabling / disabling the voice controls very easy, by just pressing the screen. The trouble was, the text was too small so I set the screen to 125% zoom. It was better but still a bit small and having that screen zoomed in made the touch position out of line with the tablet.

So I've just upgraded VA to 1.8.2 so I can adjust the font size. However the new grey colour scheme makes reading blue a lot more difficult and the screen looks dull and washed out.

Is there a file I can edit to force the background to be black again please / or an inline function I can use please?

Many thanks,
Evo

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: v1.8.2 Change Background UI colour?
« Reply #1 on: December 04, 2019, 04:44:50 AM »
This inline function should change most main window backgrounds to black:
Code: [Select]
using System;
using System.Windows.Forms;
using System.Drawing;
using Telerik.WinControls;
using Telerik.WinControls.UI;

public class VAInline
{
    public void main()
    {
//Set the background color
Color backgroundColor = Color.FromArgb(0, 0, 0);
//Change the background color for the main window
Application.OpenForms["frmMain"].BackColor = backgroundColor;
//Change the background color for the "Profile" box
((RadDropDownList)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProfile"]).BackColor = backgroundColor;
//Change the background color for the log
((RadListView)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"]).ListViewElement.BackColor = backgroundColor;
    }
}


Set up the "Referenced Assemblies" as shown in the borderless post.

Note that the individual log entries will only change their background color after the log is updated (E.G. a new entry is added).


You can of course merge both inline functions to make all the changes in one action.

CMDR_EVOLUTION

  • Newbie
  • *
  • Posts: 7
Re: v1.8.2 Change Background UI colour?
« Reply #2 on: December 04, 2019, 06:33:52 AM »
This inline function should change most main window backgrounds to black:
Code: [Select]
using System;
using System.Windows.Forms;
using System.Drawing;
using Telerik.WinControls;
using Telerik.WinControls.UI;

public class VAInline
{
    public void main()
    {
//Set the background color
Color backgroundColor = Color.FromArgb(0, 0, 0);
//Change the background color for the main window
Application.OpenForms["frmMain"].BackColor = backgroundColor;
//Change the background color for the "Profile" box
((RadDropDownList)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProfile"]).BackColor = backgroundColor;
//Change the background color for the log
((RadListView)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"]).ListViewElement.BackColor = backgroundColor;
    }
}
Thank you for all the information and your super fast reply Pfeil! You're a legend, yet again!

Set up the "Referenced Assemblies" as shown in the borderless post.
I'd already done that, thank you ;). A small thing to mention, was that mine couldn't read the Telerik dll's although they're in the installation directory. I've made it work by including their path, so it's all good :)
Code: [Select]
System.dll;System.Drawing.dll;System.Windows.Forms.dll;E:\Software\Sound\Speech\Voiceattack\Telerik.WinControls.dll;E:\Software\Sound\Speech\Voiceattack\Telerik.WinControls.UI.dll
Note that the individual log entries will only change their background color after the log is updated (E.G. a new entry is added).
Okay cool, I've set it to disable voice commands and it works perfectly ;D
(I've done that as my PC starts VA from Windows task scheduler at startup)

You can of course merge both inline functions to make all the changes in one action.
Thanks for the tip. Yeah, I'd done that with the other inline functions too, so it's all held together.

Have a great day and thanks again

CMDR_EVOLUTION

  • Newbie
  • *
  • Posts: 7
Re: v1.8.2 Change Background UI colour?
« Reply #3 on: December 04, 2019, 07:19:46 AM »
P.S. Now it's all done, here's the function I'm using:

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 size of the window
Application.OpenForms["frmMain"].Size = new System.Drawing.Size(1207, 800);

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

//Set the font color
Color fontColor = Color.FromArgb(0, 160, 255);
//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 log = ((RadListView)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"]);
log.ListViewElement.ForeColor = fontColor;

//Set the font size
Font logFont = new Font(log.ListViewElement.Font.FontFamily, 12);
//Change the font size for the log
log.ListViewElement.Font = logFont;

//Set the background color
Color backgroundColor = Color.FromArgb(0, 0, 0);
//Change the background color for the main window
Application.OpenForms["frmMain"].BackColor = backgroundColor;
//Change the background color for the "Profile" box
((RadDropDownList)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["cboProfile"]).BackColor = backgroundColor;
//Change the background color for the log
((RadListView)Application.OpenForms["frmMain"].Controls["tableBody"].Controls["lvMain"]).ListViewElement.BackColor = backgroundColor;
    }
}

And the output is attached  ;D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: v1.8.2 Change Background UI colour?
« Reply #4 on: December 04, 2019, 07:52:06 PM »
A small thing to mention, was that mine couldn't read the Telerik dll's although they're in the installation directory. I've made it work by including their path, so it's all good :)
Code: [Select]
System.dll;System.Drawing.dll;System.Windows.Forms.dll;E:\Software\Sound\Speech\Voiceattack\Telerik.WinControls.dll;E:\Software\Sound\Speech\Voiceattack\Telerik.WinControls.UI.dll

That's likely due to a plugin changing the working directory, meaning rather than the root of the VoiceAttack installation directory, it's looking elsewhere for those .dlls when using a relative path.

Using an absolute path will indeed work around that, however that will of course break if you ever use the action with a VoiceAttack installation in another location, so you could use "{VA_DIR}\" as the prefix, which will automatically be replaced with the path to the current installation directory, by VoiceAttack itself.
I've implemented that change in the other post, so it shouldn't be a problem in future (I did encounter it myself, but didn't think most people would have the issue).

Mc Cloud 2K9

  • Newbie
  • *
  • Posts: 2
Re: v1.8.2 Change Background UI colour?
« Reply #5 on: January 21, 2020, 04:01:28 AM »
Hi There ;D,

This here is a very nice Infomation.
My Question is, is it possible to Change the Color of the Pop Up Window from "Get Choice Input"

That would be very nice :-*.

Greetings, Mc Cloud

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: v1.8.2 Change Background UI colour?
« Reply #6 on: January 21, 2020, 08:25:52 AM »
It is possible, however as the window only exists when the "Get User Input - Choice" action is executed, this inline function must precede that action:
Code: [Select]
using System;
using System.Windows.Forms;
using System.Drawing;
using Telerik.WinControls;
using Telerik.WinControls.UI;

public class VAInline
{
    public void main()
    {
//Check whether the Get User Input dialog exists every ~10ms
Form f = new Form();
while (!VA.Stopped)
{
f = Application.OpenForms["frmGetInput"];
if (f != null)
{
break;
}
System.Threading.Thread.Sleep(10);
}


//Set the background color
Color backgroundColor = Color.FromArgb(45, 48, 45);

//Change the background color for the main window
f.BackColor = backgroundColor;
//Change the background color for the "OK" button, as it will be highlighted by default
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnOk"].BackColor = backgroundColor;

//Set the foreground color (including font color and control outlines)
Color fontColor = Color.FromArgb(255, 255, 255);

//Change the font color for the prompt text
f.Controls["tableLayoutPanel1"].Controls["lblPrompt"].ForeColor = fontColor;

//Change the font and outline colors for the "OK" button
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnOk"].ForeColor = fontColor;
//Change the font and outline colors for the "Cancel" button
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnCancel"].ForeColor = fontColor;


//Set the color for the highlight when the mouse is over a button
Color highlightColor = Color.FromArgb(80, 80, 80);

//Change the highlight color for the "OK" button using an event when the mouse cursor is over the control
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnOk"].MouseEnter += delegate(object sender, EventArgs e) {((RadButton)sender).BackColor = highlightColor;};
//Reset the background color for the "OK" button using an event when the mouse cursor leaves the control
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnOk"].MouseLeave += delegate(object sender, EventArgs e) {((RadButton)sender).BackColor = ((Control)sender).Parent.BackColor;};

//Change the highlight color for the "Cancel" button using an event when the mouse cursor is over the control
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnCancel"].MouseEnter += delegate(object sender, EventArgs e) {((RadButton)sender).BackColor = highlightColor;};
//Reset the background color for the "Cancel" button using an event when the mouse cursor leaves the control
f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["btnCancel"].MouseLeave += delegate(object sender, EventArgs e) {((RadButton)sender).BackColor = ((Control)sender).Parent.BackColor;};


//Set the background color for the dropdown control
Color dropDownColor = Color.FromArgb(63, 63, 70);
//Set the background color for the dropdown list
Color dropDownListColor = Color.FromArgb(27, 27, 28);
//Set the highlight color for the selected item in the list
Color dropDownhighlightColor = Color.FromArgb(51, 51, 52);

//Change the background color of the dropdown control
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).BackColor = dropDownColor;
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).DropDownListElement.EditableElement.BackColor = dropDownColor;
//Change the font color of the dropdown control
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).ForeColor = fontColor;
//Change the background color of the dropdown's arrow section
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).DropDownListElement.ArrowButton.Fill.BackColor = dropDownColor;
//Change the color of the dropdown's arrow icon
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).DropDownListElement.ArrowButton.Arrow.ForeColor = fontColor;

//Change the color of the items in the dropdown list using an event when the list is formatted before painting
((RadDropDownList)f.Controls["tableLayoutPanel1"].Controls["tableBody"].Controls["cboValue"]).VisualListItemFormatting += delegate(object sender, VisualItemFormattingEventArgs args)
{
args.VisualItem.NumberOfColors = 1;
if (args.VisualItem.Selected)
{
args.VisualItem.BackColor = dropDownhighlightColor;
args.VisualItem.BorderColor = dropDownhighlightColor;
}
else
{
args.VisualItem.BackColor = dropDownListColor;
args.VisualItem.BorderColor = dropDownListColor;
}
args.VisualItem.ForeColor = fontColor;
};
    }
}

E.G.
Code: [Select]
Inline C# Function: Change "Get User Input" dialog color
Get Choice Input [dropdownSelection]

Note that it will only work on one window at a time. If you run the above command twice (thus spawning two dialog windows), only the first window will be recolored.

Anything that isn't dropdown-specific should also work on the other "Get User Choice" dialog windows (as they are the same window underneath, just displaying different controls)


Same disclaimer as any other inline function like this: Unofficial and unsupported.

Mc Cloud 2K9

  • Newbie
  • *
  • Posts: 2
Re: v1.8.2 Change Background UI colour?
« Reply #7 on: January 21, 2020, 05:12:54 PM »
Thx a Lot, u are awesome Pfeil :o ;D
Works perfect :-*