On the mousedown event for the listview place the following code: if (ListView1.GetItemAt(new Point(e.X, e.Y)) != null) ListView1.ContextMenu = yourContextMenu; else ListView1.ContextMenu = null;
Jupiter9
Posts
-
Question about ContextMenu on ListView? [modified] -
Conversion of LastModified methodIf the return value is a long, then it's probably the date value in ticks. You can convert it to a DateTime object via: DateTime dt = new DateTime(LastModified(directory));
-
Detect system shutdownOne trick is to make the services dependent on the monitoring service. Then on the service OnStart, set the shutdown priority for the monitoring service to a high priority to guarantee everything happens in the correct sequence. This can be done via: NOTE: the SHUTDOWN_LEVEL is set at the minimum user-level available priority to set the service at the top most spot of the list. using System.Runtime.InteropServices; [DllImport("Kernel32.DLL")] private static extern bool SetProcessShutdownParameters(Int32 dwLevel, Int32 dwFlags); private const Int32 SHUTDOWN_NORETRY = 0x00000001; private const Int32 SHUTDOWN_LEVEL = 0x281; protected override void OnStart(string[] args) { if (!SetProcessShutdownParameters(SHUTDOWN_LEVEL, SHUTDOWN_NORETRY)) System.Diagnostics.Debug("Failed to set shutdown priority."); } However, if the service monitor is simply acting as a recovery app, then using the service recovery options may be more optimal to allow windows service manager to automatically restart the service for you.
-
How to covnert ByteArray into a JPEG image?byte[] buffer; System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer); System.Drawing.Bitmap bm = new Bitmap(ms); bm.Save("FilePath", System.Drawing.Imaging.ImageFormat.Jpeg);
-
Great PlainsIt depends on how the apps need to talk. You can communicate directly with the database which will pass the data back and forth. Otherwise, script whatever is needed. The VBScript will allow you to do anything with windows.
-
l Robot?Mouser electronics or digikey will have the servos. As for microcontroller, depends on how much you want to spend. The PIC's and Motorola HCxx will have the cheapest test/eval boards for development and open source or inexpensive compilers. If your looking for more brute force, you can always get student discounts. I.e. ARM risc processor compilers are around $500 for student discount. -good luck
-
GoDaddy.com ASP .Net hosting?I second that. Been using them for several years now, and have never had a problem. Plus, they have all necessary services for hosting sites.
-
Backspace key on RichtextEditorYou can trap in the wndproc of the control. But you need to get the wndproc of the control, not the parent form. Try the following code to grab the event: class RichTextBoxEx : System.Windows.Forms.RichTextBox { private const int WM_VSCROLL = 0x0115; protected override void WndProc(ref System.Windows.Forms.Message m) { if (m.Msg == WM_VSCROLL) System.Diagnostics.Debug.WriteLine("vertical scroll"); base.WndProc(ref m); } }
-
How to show file size in kb in dataGridThere are 1024 bytes in a KB. int kb = (int)(size/1024);
-
Division and decimals in C#/ASP.netyour doing integer arithmetic. Cast to float to retain the decimal and then cast back to int (size type): image.heig;)ht = (int)(100 * (float)2 / (float)3);