i.e. anything interesting…
Need to left click on a NotifyIcon?
I’m working on a client/server application that uses touch screens for user input. The app uses the NotifyIcon class to minimise the app to the tray when not required with a ContextMenuStrip to handle right click operations, herin lies the problem – touch screens are using touch, not mice to interface with the application hence you cannot right click!
Solution is the code below, it allows you to left click (or touch) the trayicon and still display the ContextMenu. What a PIA it was to find this!
using System.Reflection;
private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
MethodInfo mi = typeof(NotifyIcon).GetMethod(“ShowContextMenu”, BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(notifyIcon1, null);
}
}
| Print article | This entry was posted by Simon Steed on September 17, 2008 at 8:40 am, and is filed under C# and ASP.Net. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Redirect your user to their starting point when validation errors occur
about 6 days ago - No comments
Ever had a long webpage with validation that fails on postback but returns the user to the top of the page instead of where you want them? Annoying isnt it. Well in .Net Framework 2.0 (yes it’s been there a while now), you can use the property: Page.MaintainScrollPositionOnPostBack = true; Well this will force the
Umbraco Redirects
about 5 months ago - Comments Off
Started to do a lot more Umbraco work recently so inevitably I will be looking for loads ot shortcuts, tips etc along the way – feel free to let me know of any I can include here. The most recent one I came across was I needed to add external redirects in the main menu.
Getting the control that posted back to asp.net application
about 11 months ago - Comments Off
Need to know which specific control posted back to your page? (Original article at http://geekswithblogs.net/mahesh/archive/2006/06/27/83264.aspx) /// <summary> /// Tells us which control posted back /// </summary> /// <returns></returns> public Control getPostBackControlName() { Control control = null; //first we will check the “__EVENTTARGET” because if post back made by the controls //which used “_doPostBack” function also
Preparing an asp.net master page for print only view – stripping out css etc
about 11 months ago - Comments Off
Searching google turned up nothing on this so did some digging in MSDN and worked out a method of disabling all the style sheets, javascript etc to produce a text only page: 1/ Add a content block to your master page – i’ve called mine ‘cssContentHolder’ <asp:contentplaceholder id=”cssContentHolder” runat=”server”> <link rel=”stylesheet” href=”css/master.css” type=”text/css” media=”all” />
Muting audio channels using Mixer Control API
about 1 year ago - Comments Off
I recently had a problem on a job where no matter what we did, we could not control the left/right balance programmatically on two specific PC’s. We tried using various methods: Windows Media player API DirectSound APi WinMM.dll Praying None of them worked although you could control the balance using the Windows sound vol (sndvol.exe)
URL Rewriting in Asp.net using URLRewriter
about 1 year ago - 8 comments
One way to get yourselves rated better in the search engines is to get rid of the basic aspx page and replace it with something much more descriptive so this article goes on how to use URLrewriting in your project.
Prime minister visits Manchester Engineering Company EDM
about 1 year ago - Comments Off
Prime Minister Gordon Brown
Add META keywords and Description in ASP.NET (DigitalColony.com)
about 1 year ago - Comments Off
Add META keywords and Description in ASP.NET Here is the syntax for programmatically adding META tags to an ASP.NET 2.0 page. HtmlMeta metaDesc = new HtmlMeta(); metaDesc.Name = “description”; metaDesc.Content = “Tips on roasting coffee at home”; Page.Header.Controls.Add(metaDesc); HtmlMeta metaKey = new HtmlMeta(); metaKey.Name = “keywords”; metaKey.Content = “roast, coffee, home, tips”; Page.Header.Controls.Add(metaKey); ASP.NET will
Client Socket Programming in C# using the built in libraries – a fully working production example Part 2
about 1 year ago - Comments Off
My previous article which you can find at http://blog.xploiter.com/index.php/2009/01/16/socket-programming-in-c-using-the-built-in-libraries-a-fully-working-production-example-part-1/ covered the creation of a solid production ready Socket Server written in C#. I promised to follow up with part 2 which would be a suitable client so without further ado, here we go
Socket Programming in C# using the built in libraries – a fully working production example Part 1
about 1 year ago - Comments Off
One of the things i’ve noticed over the last few months in particular is the lack of decent programming examples in C# for a suitable client/server socket solution that just works! I was working on a contract that needed a robust and stable communications mechanism between multiple PC’s on a closed network for a Railway Simulator and Aircraft Simulator I was working on.
Comments are closed.
about 1 year ago
There is nothing more redundant which uses more of your time, from one project to the next, than coding how your project is displayed at startup, what is shown during execution, NotifyIcon? Taskbar? When is a Taskbar displayed? During normal Display? When you are minimized? Your Context Menu logic, your exit logic, your deployment logic and your update logic.
Click here for more detail