Code for extending the NETCF MainMenu to support background color property - compact-framework

I've searched for the solution to change the background color on the Compact Framework's MainMenu control, and the only answer I've found is that you need to create a custom control. Does anyone have example code for this?

I did something vaguely similar where I wanted to handle the WM_EXITMENULOOP message which was not available as an event in .NETCF.
The solution was to "subclass" the Main Menu, an old MFC trick where you replace the WndProc function with your own, handle any windows messages (WM_EXITMENULOOP in my case) and call the base class WndProc for everything else.
Some sample code is available on Alex Yakhnin's blog on how to subclass a control:
Example of subclassing a window in .NETCF
In your case you'd actually be subclassing the Form that the MainMenu resides on, and I think WM_DRAWITEM would be the windows message you'd want to handle yourself.
I haven't tried changing the background color myself so not totally sure this will work, but subclassing would be where I'd start.

There is no way of doing this.
Your right in that you'll probably need to create your own control.
This was something I was considering doing anyway to make the application go on Windows CE and Windows Mobile.
The problem with adding menus when the application needs to work with both is that the menu goes to the top of the screen on Windows CE and covers any controls that might be there.
It would be less hassle in the long run just make a new control.

I tried to do something similar a while back and discovered that you have to write your own menu; essentially from scratch. I gave up because the project I was working on couldn't afford the expense. I also discovered that OpenNETCF has a pretty awesome menu control. I don't know if it's included in their free software, but it might be worth looking into.

Related

Changing application layout via buttons in VB .NET

Currently I would like to program an application gathering forms that are callable with buttons on the side. For this, I am using the latest build of Visual Studio Community. One way I thought of would be to literally put all the form elements (textboxes, lists, etc.) in the application window and only enable them whenever the according button is clicked on. However, if this is the way to do it, I find it quite messy and unpractical, and I'm pretty sure there's another way around.
After some research, I have learned about the MDI layouts, but they don't suit my taste. I would like to keep everything in one single frame.
Could you give me a hand?

Tab Order in Visual Studio hates me

Tab Order in Visual Studio does not work for me for some reason.
I am making a VB.NET plugin for a cad program called Rhinocreos 5.
I have everything set perfect, and I don't know what the cause of it is.
I am using .Show() instead of .ShowDialog(), because I need that thread open and I don't feel like doing any thread management (not paid enough lol)
Does anyone have any pointers for this? Has anyone else ran into a tab problem with Rhino5 and .NET?
EDIT**
Seems I have to use a MODELESS Form for a rhino plugin.... So I wont have any tab keys or arrow keys unless I do a hook. But since I need to make the plugin future proof (in case I am no longer working here), I won't be doing that either. But thanks for the answers, comments, and awesome downvotes.
Very difficult to guess what's going on from the information you have provided, but I'd check the following things in the following order:
The disobedient form is open and has focus.
The form has controls in it.
At least some of the controls are enabled, focusable have their TabStop set to true.
There is no low-level keyboard handling in action (PreviewKeyDown, hooks etc).
Finally I'd call ShowDialog() instead of Show(), passing main form as parameter (to make disobedient form a child of main form) and see if that makes a difference.
It was a modeless form inside of Rhino3D as a plugin.
Rhino3D uses all plugins in the main thread. So tab is not an option.
The workaround was to tag all controls with a tag work (I used "tabMe")
Then I store all the controls in a List myTabbyControls.
Each time I press tab, I would cycle through the list.
But thanks for the down votes. It's the running joke of SO.

Custom Windows Form menu in vb.net

I want to make a Custom Windows Forms menu. Now, when I say "menu", I mean where the "Exit", "Maximize" and the "Minimize" icons are. I have seen in Microsoft Office software that Microsoft have done a custom WinForms Menu, and in many other software. I have done research for months, and searched so much and have not found anything! I have, found some companies which are currently selling Component Packages with Visual Basic, C# and Visual C++ components, however I do not have the money to buy one of these packages, therefore I need help making a custom Windows Form menu.
I would like to make a Custom Windows Form Menu as a "Ribbon" type. So, It will have a "Ribbon Form Menu". However, I do not wish to use any products or packages to do this for me, seen as I don't have money for them.
I have tried a number of ways for creating a Custom Form Menu:
Used a ToolStrip docked to the top of the form, and set the property of "Left to right" to True, and used buttons or labels for the "Exit", "Maximize" and "Minimize" buttons, although, this isn't really ideal, and I don't really want that anymore.
Used buttons at the top of the Form and docked a panel behind it to made it look like a custom form, but again, this isn't really ideal either.
Anyway, please can someone help me make a custom Windows Forms Menu? It would be nice if you could help me make it in the "Ribbon Style" too!
Please note this post is aimed at the Visual Basic Programming language.. I am using Visual Basic! :D
Thanks.
You have a few options, Firstly you can extend the ClientArea into the NonClientArea
and you would end up with something like: http://www.codeproject.com/Articles/44235/Painting-Vista-s-Aero-NonClientArea-in-VB-NET
After doing some digging i found a .net wrapper for the windows 7 ribbon control, I haven't tried using it yet but you might be able to make it work:
http://windowsribbon.codeplex.com/
Alternatively you can create it all from scratch, setting the FormBorderStyle to None and handling the moving/re-sizing etc by your own code.
As well as painting the Ribbon-like controls yourself.
The latter is a lot more work but is the most customizable, I hope this is helpful and gets you on the right track!

Windows Phone 7 WebBrowser control swallows manipulation events?

If I place a WebBrowser control on any page, the page no longer responds to manipulation events under the WebBrowser. Other areas of the page work fine.
It's easily confirmed by overriding OnManipulationCompleted in a page, then placing a WebBrowser control on the page. Try swiping over the WebBrowser, and OnManipulationCompleted is never called.
I can't set the WebBrowser to IsHitTestVisible=false because I need to be able to click on links. But I want the page to respond to left/right swipes.
Anyone got any bright ideas? Or know if this is a bug in the current release?
I'd like to extend what Skeet already written.
The point is, that the MS WP7 dev team has published "guidelines", where they highly discourage putting (on the same page) multiple layout controls that accept and react to the same set of gestures. For example, you shouldn't try to embed a Pivot inside a Pano, because the horizontal-swipe will clash and it will be hard do distinguish which of them should execute its actions. The same case is with the browser: it responds to all swipes and pans.. so should not be put in almost any scrolling control!!
Now, having said that, I want to tell you it is possible to overcame it - although it may turn not easy, depending on your actual case.
The most trivial thing to do, if you want to still be notified about the gestures is to use GestureService/GestureListener from the Silverlight Toolkit library. Even when the WebBrowser extinguishes the raw manipulations events, the GestureListener will still be able to notify you - because it apparently listens on some "other layer", I don't exactly want to get in to it now. Just fetch the library, add-reference it, do something like:
GestureService.GetListener( targetcontrol ).Flick( myBrowserFlickHandler );
and it's done - you get the notification whenever someone flicks on the control, with completely no regard of the manipulation events being e.handled=true or not. Small disclaimer here: I don't remember if on 7.0 it works, because the WebBrowser is build a bit differenlty there. On 7.1 and 7.5 it should work.
However, if you apply that on a WebBrowser - you will get the notif - but the webbrowser will get it too. That means, that 2 controls will react, and it turn to be visually quite rejecting if you start some storyboards from within the handler..
On 7.1 and almost-current 7.5, it is possible to play hard with the WebBrowser and to completely control which manipulation-event it will see. Thus, by filtering the mani-events for the WB, and by using GestureListener to see the events yourself, you can both block the WB from doing anything, and at the same time you can respond with your own action instead. I've written about that extensively in a response to similar problem, see WP7 Pivot control and a WebBrowser control for details. It is not a quick/easy/funny thing to do though.
EDIT: and MOST importantly, it is NOT guaranteed to work in the future. Throughout the 7.1 and 7.5 SDK/OS/API versions, inside the WebBrowser control some major internal undergoing changes are visible, and I would not be surprised, if it would dramatically change in the next few releases. Don't play with the things I've wrote there about if you do not want to have to revisit the subject again in the next 1-2 years.
This is a consequence of the way we implemented WebBrowser. The touch events are handed off directly to the browser engine. Once that happens Silverlight is basically out of the picture. Unfortunately I can't think of any workarounds that might give you what you want. -Skeets, MS dev
If you really want it:
<Grid>
<phone:WebBrowser Source="http://www.microsoft.com" />
<Rectangle Fill="Transparent" ManipulationCompleted="HandleManipulationCompleted"/>
</Grid>
But of course it completely locks down interaction with web browser control and there's just no way to echo manipulation events to browser...
I think you have a better way capturing the manipulation events, if it is in WP7.5 Mango since the browser controls are completely different, which I read from this link

Refresh designer in Blend

Either I'm not as intelligent as I once believed or the UI in Blend is really this bad.
Is there any way to 'refresh' changes I've made to an XAML file in the designer? Something simple like changing 'Fill="Red"' to 'Fill="Blue"' does not show up in the designer unless I close and re-open the file.
Google and SO were sadly and surprisingly not helpful. Thanks!
I can't say I've ever had this problem. The only time I've had the designer not refresh was if I was tinking in code view, or if I had changed some code and not rebuilt.
Does it always do this? Do you have issues with any other WPF apps or any other UI glitches? I'm assuming this is Blend 2 or 3?
Changes in xaml are reflected on the Blend design surface for me. Preferably, you would change the fill using the properties panel.