Is there any ways to change color of label in RTC? - dynamics-nav

In the form, I would like to set the color of text in Label. Actually I can set it in Classic by using Label property called "FORECOLOR". but unfortunately in RTC doesn't change the color.
Are there any ways to do so in RTC ?
Thanks in Advance,
Makara

In the RTC the color options have been reduced. Essentially this is due to the change of "paradigm" in Forms vs Pages.
In Pages, controls have lost the ForeColor property, but gained the Style property. Essentially this changes the way NAV looks at data (knowing what the intention of the data is, rather than hard coding a color -- this allows new clients, such as the Web Client, to display it in it's own way if appropriate).
The style property can be set in the following ways (MSDN);
None (No colour)
Strong (Bold)
Attention (Red)
Favourable (Bold + Green)
Un-favourable (Bold + Italic + Red)
These 'styles' can be turned on and off using the Boolean StyleExpr property. This can be a variable to dynamically switch plain black, and the selected Style.
If you're using the transformation tool, the form property Forecolor is ignored and not translated to the Page's Style property. Properties in Forms and Pages are set independent of each other.
As for other colors, it's not possible out of the box. You could develop a Client Control add-in to create a custom control with colors however it seems a little bit of overkill. It'd have to be installed on all PC's that use NAV. I'd recommend just using the Style option :)

Related

How to change the default font of the form controls in Visual Studio IDE

I would like to set the default font of the form components from Microsoft Sans Serif to MS Outlook
I can change the font every time I put a new control on the form but its time consuming. I didn't find any help or options for it in the Visual Studio 2012.
How can I change the default font for any added control?
Many Controls you add to a Form, default to some of the Form's properties. That includes the Font of the Form as well as its BackColor. This comes handy if you want to use, say Consolas,10 for all Controls..
Here is MSDN on these 'ambient properties'..:
An ambient property is a property on a control that, if not set, is
retrieved from the parent control. If the control does not have a
parent and the property is not set, the control tries to find the
value of the ambient property through the Site property. If the
control is not sited, the site does not support ambient properties, or
the property is not set on the AmbientProperties object, the Control
uses its own default values. Some objects derived from the Control
class might set the property even if you do not. For example, the Form
class always sets the ForeColor and BackColor properties.
TextBoxes and some other Controls don't get the Backcolor, though.
Note: Changing the Form's font will change those 'inherited' Fonts of all Controls on the Form, including TextBoxes, Lists etc. Those properties you have set directly will not change, though.
So: If you want to use varying Fonts, get the Form's Font right first and try to avoid an uncontrolled mix of default and set values! (You can check which you have set in the From.Designer.cs file..)
I have the same question which bothers me very much, and I can not find the solution for months. Today I finally find a possible solution using my limited concepts on c#.
Back to the topic, just add the 2 lines below in the file "form1.designer.cs", which is in the installation directory of visual studio. My visual studio 2010 have the directory like this :
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\1033\WindowsApplication.zip
using System.Drawing; ///this line on top of all
this.Font = new Font("Arial", 16); ///this line in the InitializeComponent()
There are some side effects because some properties rely on the font size, such as the form size will grow because of the Form's AutoScaleMode, default size of button/textbox would be not suitable as you know... But it is not a big issue. A nice programmer could solve this kind of issue by himself.
In this manner you could change anything, such as button/lable font, color... All depend on your imagination.
This is my first post. I hope it helps some guys like me.
The easiest way i found is find and replace feature.
Just double click an item lets say a command button then inside the code hit Ctrl +F to find "font". after you find which default or current font is in use, now broaden the Find to Find and Replace and now replace with your desired font.

Winforms PropertyGrid per-GridItem row height

I'm using the Winforms PropertyGrid; the target of the SelectedObject includes a property of type Image. Everything is fine, except that with all items the same height, the image is too small to see properly. I'd like to have some control over the height of grid items such that the image can be displayed a bit larger. One other detail is that the SelectedObject of one PropertyGrid control may be assigned an object of any of a variety of different classes (which may or may not have image properties), so I'm hoping the height can be driven by data in the instance of the SelectedObject itself, rather than making it a static behavior of the control, although I'd settle for a custom attribute of the image property to make the item height at least class-specific if it can't be instance-specific.
How can I do this? Custom attribute? PropertyGrid event? Something else?
As Simon commented on your question, this is not possible to have a custom height for a GridItem.
You have 2 solutions to be able to show an image with a reasonable size:
You can code your own UITypeEditor. That way, the user would just click the down arrow and see a nicely sized image in the dropdown box.
Sorry for the plug but I think it directly answers your question: only 3rd party PropertyGrids may allow you to get variable size rows in the grid. Smart PropertyGrid.Net is one of them. You set a HeightMultiplier to the row so that it expands on let's say 4 rows. Then you code your own Look class that handles the drawing of the image the way you want in this space.

Changing the look and feel (like 3d effect) of grids in silverlight

Is it possible to change the look of the data grid in silverlight (or any other object), by look i mean changing the depth or the effect of it so it looks 3d like and stands out?
Thanks,
Michelle
You can change the style of any object in Silverlight.
Search for Styles in Silverlight...
You can change the style for all controls of a certain type in your application or in a part of it. You can also change specific controls.
You can change the style conditionally (in function of the state, responding to a trigger etc.)
ScottGu's basic tutorial
Links to further reading

WPF - Which one is better? Style or User Control?

I wanted to know which one amongst Style and UserControl would be better to use in WPF?
For example:
I have created an image button in two different ways.
One uses Style and ContentTemplate property is set.
It uses one other class with dependency properties.
The other way is I have created a UserControl which has a button and its content property is set.
The file UserControl.xaml.cs also contains the dependency properties.
For Code details see the answers of this question:
Custom button template in WPF
Which one would be better to use? In which scenario should one go for Style or UserControl or any CustomControl?
Styles are limited to setting default properties on XAML elements. For example, when I set the BorderBrush , I can specify the brush but not the width of the border. For complete freedom of a control’s appearance, use templates. To do this, create a style and specify the Template property.
Styles and templates still only allow you to change the appearance of a control. To add behavior and other features, you’ll need to create a custom control.
For example,
To create a button like a play button use styles and templates, but to create a a play button which will change its appearance after pausing it use UserControl.
For this type of thing I would go with Style, even though I'm not really adept with graphical tools. I tend to produce a basic, boring style that I can get started with and then prettify it once the application functionality has been verified.
The nicest thing about WPF is being able to distance much of the graphical look, feel and behaviour away from the code.
This allows you to change the style of your application without revisiting the code and indeed means that you can change styles on the fly at runtime.
There is an awkward line to tread with regards to how much behaviour is placed within the XAML and how much is placed within the code. A rough guide would be to decide on what behaviour must always be present within the UI and place that in the code, everything else place within the XAML.
Think of the code as being an abstract class with defined interfaces and the XAML Styles as being classes based on that class and you'll get an idea of what I mean.
Conversely, I know that people who are far more adept at the GUI work prefer to put more functionality in the XAML and others who prefer the code side, because they find the GUI work slow or difficult.
When thought of that way you'll see that there's never really a right or wrong answer, just better solutions that suit your skills.

Creating a DIP Switch control in WPF

In an effort to teach myself more about WPF, I'm trying to build a simple application. Where I work we have some hardware that has a bank of 8 dip switches used for setting an address from 0 to 255 (as an 8-bit number). It's a simple concept that I would like to build into a WPF windows application that would allow users to see the dip switch settings for a given address. I built a similar app in WinForms that would simply show/hide pictures of dip switches. I'd like to port it to WPF and do something more elegant.
I've done some simple databinding with strings and numbers, making them show up in labels, and I've done some introductory work with user controls.
What I would like to do is create a user control that mimics a single dip switch, which would have a "State" property that would be a boolean true or false. I could then place 8 of them in my window and tie them to my code.
In the XAML, I would have a drawing of the dip switch, and the sliding part would move to the on or off position depending on the true/false value of the State property. Once I figure that out, maybe I could animate it later.
At this point I'm looking for a conceptual overview... how would I create this property in a user control, and have it's value affect the position of the graphical switch?
Thanks.
You can easily create a DIP switch control by replacing the template of a CheckBox, if you want to know how to create your own templatable controls read "Templates for Uncommon Controls" by Charles Petzold at http://msdn.microsoft.com/en-us/magazine/cc135986.aspx
One way you could do this is to use the Control Template to customize the appearance of the WPF RadioButton class. The code for the RadioButton Control Template is available on msdn.
You should be able to create your own UserControl, then paste this code into the UserControl.Resources node, and then start modifying the look and feel of the RadioButton while maintaining all of its properties, which should make it easy to use as a boolean indicator.
The style of the "Bullet" could be easily replaced by images or vector graphics of flipped or unflipped dip switches.

Resources