As we know when we use notifyicon control in c# and place it in systemtray and it is displayed, windows overrides its size and make it 16*16 so can we somehow change its size? make it little bigger like system "date and time" display or like "input method type" in windows 8. I want to display certain text there.
Thanks in adv.
The system draws the icon, and it decides what size it is. For what it is worth, notification icons are the system's small icon size. So in fact you should not assume that they will be 16px icons. For font scalings larger than 100% the small icon size will be larger than 16px.
At the Win32 level, the application supplies an HICON, and the system draws that. If it needs to resize it, it will. You cannot custom draw in the notification area.
Imagine if applications could custom draw in the notification area? All it would take would be for a couple of applications to decide that they were so awesomely important that they had to custom draw large amounts of information. And then there'd be no room left for the rest of the taskbar.
So, the bottom line here is that you will need to find some other UI approach to solve your problem.
Related
I was given UI design for project. This design is made by Photoshop. In this design every UI element's (button, textbox, listbox, etc) height and width are given in pixels. I am following that design while making user interface in WPF.
But, even I do exactly what is given UI design, image and my UI are not same. It seems WPF pixel is not same as Photoshop pixel(I know it is nonsense). Window, Button, TextBox, etc, sizes are more bigger than they are in .png picture.
Is there something am I missing?
Thank You
WPF does not operate in pixels, it operates in device-independent units, which might or might not equal to 1 physical pixel, depending on your monitor and OS settings.
Without seeing your actual UI its hard to tell what do you mean by "image and my UI are not same". There are a couple things you could try though. First, if you experience blur when rendering shapes or images - try setting either UseLayoutRounding or SnapToDevicePixels to True. Second, if you feel that the distance between different elements is larger than it should be - make sure that you account for non-zero Margin-s and Padding-s (some controls have those by default), when building your layout.
If nothing helps, try using Snoop. It will allow you to inspect your UI while your application is running, and among other things it will tell you the exact size of any element and, more importantly, why it has that size.
I am trying to make my winforms application made with C#.Net, resolution friendly. I tried to do so in programming way by just adjusting a size of all control according to ratio of screen resolution. But it doesn't give perfect resolution in every forms.
I tried to do so in programming way by just adjusting a size of all control according to ratio of screen resolution.
I think you mix two things.
To adjust your form to the Windows DPI settings (making your controls smaller or larger), you don't need to do anything, this is performed automatically. Just change the DPI settings and check the effect.
To adapt your forms to the actual resolution just make it sure that your forms are either resizable (and the controls are docked) or the non-resizable dialogs will show at least some scrollbars if the resolution is too small. Anchors can be a pain especially if you have derived forms or user controls but you can always use docking.
You could also use certain resolution breakpoints where the size of the anchors change. For example at 1024x768 1600x900 1920x1080 the controls all change to a set size, inbetween they just take the closest resolution breakpoint to them (1200x900 would take 1024x768).
Often I've had problems trying to make them completely dynamic and I've been handling it like this. Upon resize just call a function that checks the current size and if needed resizes all the anchors.
I'm developing windows 8 application and I have got problem with resizing fonts. For example on big display (with big resolution) fonts are too small to read from distance. Is there a way to resize them - I want to have also option in settings to make fonts bigger/smaller.
You can make use of the bottom app bar to increase the front size and you can also make use of the viewbox control which will help you resize the front depending on the resolution of your screen.
Is it possible to display an icon in the top left corner of a Windows Form that is a different shape than the standard 16X16 pixel icon?
It appears that Skype has an icon that is much wider than standard:
Is it possible in a Windows Forms app?
You can do this but it's probably more effort than it's worth just to have a larger icon.
Hans has posted an article that roughly points to the information needed to figure out an answer this question, but hasn't posted an answer itself and so I'll clarify.
The old (pre Vista) way to do this is to override the WndProc method on your form and handle the WM_NCPAINT message. Note that this means that you are now responsible for drawing the entire window frame (the window border, title, close / restore icons etc...), not just the icon - i.e. this is a lot of effort to do a relatively minor thing.
The newer (post Vista) way to do this is to use the DWM API - note that this API is not directly exposed through the .Net Framework and so you need to use P/Invoke for this in C#. The bit that you want to do is the section titled "Drawing in the Extended Frame Window", where you extend the area that you are responsible for drawing outside of the normal client area and into the window frame. This is less hassle than it used to be (you don't have to draw things like the close buttons), however still means that you take responsibility for a lot of things that you wouldn't normally, like hit-box testing for resizing and moving.
Basically its nowhere near as simple as providing a larger icon and for most applications its probably way more effort than its worth, however you can do this in C# and that article should get you started if you really want to give it a try.
I know your looking for a plain code way to do this, but I invite you to check out DevExpress manged (yes it's third party forgive me), just google it.. I seen this thread and I started asking questions at devexpress with support and got some impressive results that you might be interested in.
Here is the ticket I put in... http://www.devexpress.com/Support/Center/Issues/ViewIssue.aspx?issueid=Q399941
Here is the result... http://www.devexpress.com/Support/Center/GetSCAttachment.ashx?id=684270b5-faed-415e-9010-64338523f8cf
So Far I used this on Xp, Vista and Windows 7 without problems using winforms only.
I hope this helps or gives you another option if the windows API don't pan out like you want on different versions of windows.
Thanks,
David
Don't think it's an icon, if you mean precisely the ICO image format.
Considering the Skype window is definitely ownerdraw window, that image can potentially be whatever you want format.
The trick is, basically, render an image skipping the pixels of some color (background color) of the "icon", so render it in "transparency".
This article can give you a hint:
Drawing Transparent Images and Shapes using Alpha Blending
It's old, but always a good one.
Yes. Override WndProc and implement WM_NCPAINT.
I am currently developing a Winforms Application that will run on a very specific tablet PC.
My development environment uses dual-17" monitors which are far bigger than the tablet screen size of 10.4" (1024x768).
Due to the purchasing department at my company the delivery of the tablet will not be until well into the design cycle.
Is it possible to mimic the tablet size so that I can adjust my forms to match?
You have couple of options:
set one of your screens to the tablet resolution. You might need to move your taskbar to that screen to get the proper-sized workspace.
install Virtual PC and create a VM with the tablet resolution.
set your main form size explicitly to the tablet PC resolution. For best results size it to the proper workspace size, not the desktop size.
Note that your form will have to still be relatively flexible, since users might configure their taskbar to be at a different position, or different size, thus affecting the available workspace for your app.
The fact that you have 1024x768 on 10.4" means the pixels are denser than your typical PC monitor. That means that text 10 pixels high on your monitor might look fine, but 10 pixels high on the tablet PC may be tiny and almost unreadable (even without loss of resolution).
Unless you can find a monitor with similar pixel density, I don't think you can properly mimic it. Even if you can shrink the application to a 10.4" section of the monitor, now you're probably dealing with sub-pixel shading which will look blurrier than on the tablet PC.
The best you can probably do is setting one of your monitors to 1024x768 (without stretching to fill the screen!), or just set your app to that size and eyeball it to take into account that it will actually be smaller.
You could try hosting your main form inside a user control or another form limited to the relevant size. However, the form is then not a "top level" form, but fairly closely looks and behaves like one.
You can perform normal form actions (minimise / maximise / move / resize / etc) so you can get a feel for what it is like and a certain size.
However in this instance, its best to always design the UI for the minimum resolution you have to target, and have it scale upwards on larger monitors.
very easy - if you're concerned about size, or users have to use the touch screen, start your form out with 10pt+ font
very cool - design the form size as, oh, 950x650. Experiment with the anchor property of each control. Allows you to make basically totally resizable controls (if you get creative with the anchor on groupboxes/panels and the controls inside them).
then set your form to maximize itself on the tablet PC (or e.g., if screen size is <= 1280x1024 - the Anchor property has its limitations as to what size increase looks reasonable).