Sorry if this is a fundamental question and I'm just stupid :)
I am building a sidebar application, it uses System.Windows.Forms.Screen.PrimaryScreen.WorkingArea to set the appropriate widths and heights and locations.
I want to now reduce the working area of the desktop so that when forms maximise, the sidebar is still shown (in the same way that the Vista or Google sidebars do)... but trying to set the Width on the WorkingArea.Width property gives me an error about the WorkingArea (a System.Drawing.Rectangle) not being a property.
What can I do to change the width of the WorkingArea to prevent forms overlapping my sidebar?
Thanks in advance!
Actually looking at this in more detail, it looks like it is much more involved and requires Win32 API calls to get the job done and get the exact same behavior.
This link contains some sample code on how to get it done. (Sorry, its ExpertsExchange, so scroll down, but it is a full sample.)
Related
How do I make it so that a desktop UWP app will resize based on resolution? Mainly I need it to work between a surface pro and a Surface Studio. I've researched around google and I haven't seen anything that goes into detail. I know of things like RelativePanel and VisualStateManagers, but I have not clue how to use them. Any guidance would be much appreciated.
Use Grids to Place your elements. Specify the row height and column width as fractions (0.2*,0.2*,0.6*) so that it adds upto 1 (not necessarily, but for convenience). Then your UI will scale automatically based on resolution. You don't even have to use relative layouts. Just place them within these Grids. If you want complex actions, go with VisualStateManagers.
After doing more searching I came across this. I think I understand it now.
https://channel9.msdn.com/Series/Windows-10-development-for-absolute-beginners/UWP-037-Utilizing-the-VisualStateManager-to-Create-Adaptive-Triggers
I am creating a Windows Store app, using XAML and C#.
If for example I run my application on the Windows Simulator (tablet), the layout is perfect. When I run my application on my local machine, the layout does not at all look like what it looks on the simulator.
How do I design my application to fit both perfectly?
Should I have multiple designs, and with start up check screen resolution and choose the layout best suited for that resolution?
Basically, how do I make sure my app will always look its best, no matter on what screen size it my run out there in the real world?
I am currently making use of a Grid for the layout of the controls, 3 columns, and 3 rows, with the Width and Height set to "*". I understand that with larger screen sizes, the column width and row heights will increase, and the opposite for smaller screen sizes.
I am basically just looking for good design practices, as to always try best and avoid massive layout changes.
I attended a Microsoft seminar lastly for 2 days. I asked if ViewBox exist for Windows Store Apps. They said "I don't think so" :)
But it exist :D
I'm sure it will be easy with a ViewBox http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.viewbox
Put your design in a view box. That's all. We use it for silverlight.
I've tried to find a way to change the layout of the background image on the ListView control.
I've searched around but haven't got any straight answer.
I can see that there is a ListView property BackgroundImageLayout which is supposed to do the job. But when i change it nothing really happens beside that the BackgroundImageLayoutChanged event is triggered.
How it is possible to change the BackgroundImageLayout on the ListView control? Is there any possible workaround to achive my goal?
PS.: I know about 3rd party controls that 'fix' this problem, but I'm looking for a solution that would do the task without any additional components.
ListView is a native Windows control. Yes, it does support a background image, the LVM_SETBKIMAGE message takes care of it. It however doesn't support the boilerplate Winforms BackgroundImage support, notable lacking is BackgroundImageLayout, the property that Winforms implements for the Control class and implements when the ControlStyles.UserPaint is turned on. It is not for native Windows controls, they paint themselves.
The guy that wrote the Winforms wrapper class for ListView did the next best thing, he added a new property to the ListView class called BackgroundImageTile. A layout option that the native Windows control does implement. Which leaves you with just the two layout options that the native control supports. Tile or don't tile.
That same guy did some pretty heroic things to make the Winforms wrapper class behave reasonably. The code is filled with hacks to work around the native control's quirks. Awesome work. His life would have been a lot easier if the Windows team guy would have the luxury to make the Winforms guy's life easier. But it doesn't work that way, ListView has been around a lot longer than Winforms. And wasn't designed that well from the getgo, Microsoft had pretty significant growing pains around that time.
Fast forward and change the rules so you don't depend on legacy code: WPF, Silverlight, WinRT.
According to the MSDN, 'ListView.BackgroundImageLayout Property':
"The API supports the .NET Framework infrastructure and is not
intended to be used directly from your code."
and
This property has no effect on the layout of the background image of the ListView control, therefore it is not shown in the designer or by IntelliSense.
Use the BackgroundImage property to set the background image. See msdn for more info:
That is unless you have something fancy you are trying to do with it?
EDIT: As per a previous thread HERE: the short answer is that you can't. =(
If you desparately want it, try creating a blank image that is the dimensions of your ListView. Add to this image YOUR image and add at it a position that is in the middle. There may be something similar in nature to this in under Bitmaps or Images.
I want to try and get the same look as Windows 7, with the aero glass dropping down just a little bit so that there can be a back button/address bar/ search box. Are there any tutorials on how to do this? I really need something simple, as I tried looking at a few other tutorials that try to explain how to use DWM with c# and I get totally lost.
Done as an answer :)
Absolutely use WPF, WinForms is a nightmare for this sort of thing. Combine it with http://code.msdn.microsoft.com/WindowsAPICodePack and you're on to a winner.
Ive been using the glass_full class from the site below on WinForms and and it works great.
http://www.dreamincode.net/forums/topic/146813-glass-form-dwmapidll-api/
I found a workaround for the black text issue with WinForms is to simply set backcolor and transparencyKey to a unused color.
(To prevent clickthrough, make sure the red and blue values are different, I use 221,222,223 as my color values so it gracefully fallsback to grey without Aero)
how to give size of a control in window mobile app dynamically,because i have developed one application,when i used to run that application on different emulator's ,the size of that control's in that application differ's for different emulator.so could u plz help me that how we can handle such issue in windows mobile application in which iam using visual studio 2008 and windows mobile6 classical emulator
Your question is a bit ambiguous, but I'll take a stab at it.
Apparent control size (how big it looks to your eye) if affected byt a few things. The obvious are things like Dock and Achor properties, which are well documented online and are the same as for the desktop. What is less obvious is scaling. Some PDAs have a 240x320 display, while others may have 480x640 yet with the same physical dimension screen.
The platform can attempt to have your single Form code work for both by doing "pixel doubling" which essentially just doubles all of your size values. This tends to end up with graininess and I think it was turned off by default starting with WinMo 6.
To adjust this behavior, you can adjust your Form's AutoScaleMode property.