Control Screen Brightness in WIndows Phone 7 - c#

Is it possible to to use c# to change the screen brightness? I know some apps can control it so if there is not a direct way then does anyone know of a workaround?
Thanks

Unfortunately you don't have that level of hardware control, but if you only need to make the screen dimmer, you just need to scale down the RGB values of each pixel.
Depending on what you're working with, there are a number of approaches, but if you have a black background, you can just adjust the opacity of your front layer, which will effectively dim the content.

Related

C# proper image alpha layer when form is invisible

I'm looking for a way to have images on invisible form that allow alpha transparency and allow to place and use buttons/labels etc.
I've tried this Transparent background on winforms?, layered window and many more, nothing fully successful. I've ended up with such failures http://imgur.com/a/t6nmF
Transparency key only makes one color transparent, which doesn't work on images that have smooth color gradients on the edges.
First of all, are you certain that your image has a transparent background?
Layered window is exactly what you should use to achieve the desired effect. Since you don't give much details, I don't know what's wrong with your implementation. Try to use the PerPixelAlphaForm from the following article: Per Pixel Alpha Blend in C#. When used correctly, it will work (even though the article is really old).

Text boxes overlap in windows 8.1 app

I have a problems with text boxes overlapping when I use an emulator with different screen size. What is the best way to optimize my output so it is independent of phone screen size and resolution?
Here is an example of the issue I am running into
This is written in C# with XAML.
http://1drv.ms/1znAqJ9
thank you in advance for any help.
The reason they Overlap is because I believe you have explicitly defined the Margin Pixels in your Code which does not allow relative scaling on different sized phones.
As per your Images, I see you want text boxes in a Horizontal aligned Format.
So I suggest you Use a Stack Panel with the Orientation Property set to Horizontal and Add all your TextBoxes to the Stackpanel.
Then they will scale automatically in different Resolutions in Emulator.

Button didn't change its size based on the screen resolution

How can I make my Windows Store App look great on large resolutions? For example a Button - how can I change its font size based on the resolution? If I view my app on 13" the button looks OK, but if I view it on 27" display it looks very, very small. Isn't something to be used in the Windows store apps framework to adapt a button, textBlock, etc to the screen resolution?
Set StretchDirection="Both" & StretchProperty="Fill" in ViewBox
This is a consequence of screen scaling based on DPI... which makes your button the same physical size on both monitors, but totally ignores the fact that the user sits/stands much closer to one than the other. Maybe someday we'll have a not-stupid scaling scheme that works based on subtended angles.
Large format monitors already have larger pixels, I suggest you simply opt out of display scaling in your application. (But do respect the global system font size settings)
I'm not sure what the opt-out setting is in XAML (WPF), but in WinForms, I'd be changing the AutoScaleMode property.

Screen resolution detection in Windows 8 Apps

Is there a way I can detect the resolution of the screen in a Windows 8 app so that I can scale and resize the elements of the UI accordingly?
If not then what is the best way to go about developing an app that is resolution independent? Is there a standard way that I am not aware of or is there some other way this can be achieved?
Anything that inherits from FrameworkElement has a SizeChanged event. This event returns the current size of the framework element.
To get the overall size of the screen you can use:
Windows.UI.Xaml.Window.Current.Bounds.Height
Windows.UI.Xaml.Window.Current.Bounds.Width
Be careful as this will return the size of the screen and you will need to take into account whether your app is full-screen or Snapped/Filled.
Microsoft guidance says that you should be avoiding absolute values for height/width and simply setting HorizontalAlignment and VerticalAlignment to Stretch to allow the UI to take as much space as it needs to render.
Anything these two articles don't explain?
Guidelines for scaling to screens (Windows Store apps)
Building Windows 8 : Scaling to different screens
Windows.Graphics.Display.DisplayProperties.LogicalDpi

C# win form transparency

I am using C# to make my desktop applications.
But I want to make more graphical applications that have full transparency backgrounds and different levels of transparency for picture box controls.
Basically, not cookie cutter opacity of removing a solid color.
How can I accomplish this with C#?
It is simple, just go ahead with WPF. This gived me a good start point.
This should help:
http://www.c-sharpcorner.com/UploadFile/scottlysle/XparentFormsCS10282007212944PM/XparentFormsCS.aspx
also
form2.Opacity = .x; where x is percentage of transparency
or
transparency can be directly edited in appearance property of form in case you are using VSTO

Categories