C# Custom Border Titlebar Menu - c#

I have created C# winforms with custom border and titlebar. I have disabled the controlbox (ControlBox = false) on the forum but it seems to also disable the system context menu that appears when you right click the titlebar. Is it possible to have the context menu while settings the controlbox to false?

Short answer as far as i know No
Long answer you cant use the context menu as it is part of the control box itself

#System.Object has right, context menu is part of the control box, but if you really want to have it, you can write it your own, as I see the default titlebar context menu in windows7(restore, size,move,exit,etc..) is no big deal.
OR
You could rewrite your project in c# WPF, there is no much difference. And if you're planning more complex design, it should pay off in the long run.

Related

Xamarin Forms - Hide Burger Menu

Since the release of XF 3.2, it provided the ability to create your own custom TitleBar. This feature works well but I have a couple of problems that I am hoping someone can help me with.
I am trying to hide the Burger Menu icon, but so far I have not been able to.
I can hide the Back Button by doing the following:
NavigationPage.HasBackButton="False"
This does however still leave a slight vertical bar on the left side of the TitleBar, so if someone knows how to also remove that then great.
I was expecting the same code to also hide the Burger Menu icon but this is still present so I'm hoping someone can help me to remove this.
Alternatively, if anyone knows of a way I can either change the icon (to use my own) or to change the colour of it (as it is always white and I want it to be black), then that would be great.
Cheers...
For anyone using Shell you can hide the hamburger button and implicitly disable the flyout menu using:
Globally inside AppShell (or whatever named), also you can change the hamburger icon
<Shell>
...
FlyoutBehavior="Disabled"
FlyoutIcon="flyouticon.png"
..
</Shell>
Or hide it only in some pages:
<ContentPage>
...
Shell.FlyoutBehavior="Disabled"
</ContentPage>

How to block a window as if Dialog window was displayed

I have a form which I would like to block during execution of an async event. I would like to achieve an effect similar to when a dialog window is displayed, without displaying or creating one.
I don't want to manually disable controls on the form, as some controls may be added in the future (not necessarily by me). I would like to avoid disabling the entire form / user control for aesthetic reasons.
Is there a standard/elegant way of achieving this, or am I going in a wrong direction?
You can block WinForm window by setting it's Enabled property to false, but it will prevent user from any action with that window (like moving, resizing or hiding) and it may be very annoying. Consider showing some load indicator instead.
I would not recommend to disable controls without making them look disabled because it could confuse user.
Edit: As #AvoNappo pointed out window behavior differs depend on where to set Enable property to false:
if you set it in the constructor user still will be able to move/minimize/close window;
if you call it after constructor window control buttons and windows movement also will be blocked.

In C# WPF window, adding button for topmost beside standard window buttons

I'd like add a button for changing window state to topmost to the built-in window buttons such as maximize, minimize, and close [please refer to this pic.]
However, I'm having hard time finding the way out as WPF seems not to provide such an API. I even thought using the icon next to the window title functioning as the button for topmost, but looks not feasible.
Is there anyway like using .dll or could I inherit the window class and add the button and corresponding event handler anyhow?
Thanks.
It will be very difficult as you can see below link:
How to add an extra button to the window's title bar?
To make things easy, you should consider implementing a custom window for that. This window will have custom buttons including Close,Minimize,Maximize along with any other buttons as well.

.Net controls show ghost menu items; double buffering doesn't work

I have a winforms application with a menu. The "New" item on the menu creates a new control which has a lot of sub-controls, so it takes about 300ms to construct the control.
When you click the "New" menu item, you see something like this for a brief moment:
As you can see, the menu disappears over some of the form, but over the toolbar, for example, you can still see it.
I tried this solution How to double buffer .NET controls on a form?, but it caused more problems than it solved (Laggy menus, crashes when window is not maximized).

How to set NotifyIcon behavior to AlwaysShow in C#?

Is it possible to modify NotifyIcon behavior to AlwaysShow in C#? A code snippet would be greatly appreciated:) Thanks in advance...
Cheers
---edited
One of our clients said quote "it seems necessary to customise icons to always show". What he meant was that he has to do it manually by r-clicking on task bar then click on Properties -> Task Bar -> Customize Notifications and then you can set behavior to Always Show / Always Hide / Hide when inactive for each taskbar icon on the list.
Can you do that programically in C#?
I want to ensure that my NotifyIcon is ALWAYS visible. I'm already setting icon.Visible = true but it looks like it doesn't work for him hence the complaint.
Is there any easy way of setting the behavior by altering [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify] IconsStream registry value?
NotifyIcon icon = ...;
icon.Visible = true;
Edit for updated information: There shouldn't be, and if for some reason it exists, don't use it. That's the user's preference, not yours.
I'm sure it's possible with enough Registry hacking, but not at all recommended. They added the collapsing-notification-area behavior in XP because so many applications were shoving themselves in that space. Much like Start Menu pinning behavior in XP/Vista/7, the lack of a public API means you're supposed to let the user decide that sort of thing.

Categories

Resources