Buttons


Author
Message
Damien Drummond
Damien Drummond
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 10, Visits: 24
Okay, so I am new to the software and have tried to use a button in my c# WinForm application.

I can create and use the button just fine, but I want a custom look, so if I set the Background Fill to "Stock Gradient Fill" or anything else other than Automatic, I lose the hover over and click color changes.

I have looked everywhere to try and change this, but I can't locate it - what (basic) instruction am I missing?

I tried following some of the examples, and created a class file called MyFirstTheme - but how and where do I apply this to my project and is that what I actually have to do?

I want to set a theme/skin once and it then sets it for all the components added to my WinForm.

I am currently using Visual Studio 2017 Community, and after I installed NOV UI, I do not see what is shown in some of the instructions relating to creating projects (like creating a NOV Windows Form app) - did I install something incorrectly?

Lastly, I thought I would test the WinForm app on a Windows 2012 R2 Terminal Server and it crashes on loading, I am yet to dig into a little further, but is this compatible with Windows Server 2012 R2?

thanks.


Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi,

If you are using the NOV controls from the toolbox, then yes, you will have to use the Widget property of each control to access the NOV widget hosted in it. Please note that if you use controls from the toolbox you are sacrificing the portability of your code, which is one of the greatest powers of NOV. If you code your application directly by using NOV widgets instead of WinForm controls via the Visual Studio designer you will be able to compile and run your application on all platforms supported by NOV (currently Windows (WinForms and WPF), Mac and Silverlight) from a single codebase.

The following is a simple example that shows how to create some NOV widgets directly in code without using the Visual Studio designer - the NOV UI is created in the CreateNovContent method:
public partial class Form1 : Form
  {
   public Form1()
   {
      InitializeComponent();

      // Create the NOV content and place it in a NOV widget host on the form
      NWidget novContent = CreateNovContent();
      NNovWidgetHost<NWidget> host = new NNovWidgetHost<NWidget>(novContent);
      host.Dock = DockStyle.Fill;
      Controls.Add(host);
   }

   private NWidget CreateNovContent()
   {
      NStackPanel stack = new NStackPanel();
      stack.Padding = new NMargins(NDesignConstants.HorizontalSpacing, NDesignConstants.VerticalSpacing);
      stack.VerticalSpacing = NDesignConstants.VerticalSpacing;

      // Create a button
      NButton button = new NButton("Button");
      stack.Add(button);

      // Create a button with image and text
      NButton imageButton = NButton.CreateImageAndText(Nevron.Nov.Presentation.NResources.Image_File_Open_png, "Open");
      stack.Add(imageButton);

      // Create a check box
      stack.Add(new NCheckBox("Check Box"));

      return stack;
   }
  }


For more information on hosting NOV in a Windows Forms application, you can check out the Hosting NOV in Windows Forms documentation topic.


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search