Posts filed under 'General'

MDI Merge on Menu’s

Okay, MSDN has very little useful information regarding merging MDI menu’s.  I found this post useful in getting mine to work:

http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/679e084f8b5ef978/d79083072c56842c?lnk=st&q=mergeaction++menustrip&rnum=1&hl=en#d79083072c56842c

With that said, I still don’t get the merge/index system.. I think it may actually be bugged.. even with the above post I had to add a couple of non-visible seperators into the parent form’s menu to get my items to merge right..  MS could of easily just made this a 3-digit index based system (that worked) with the insert/merge/replace as the only options and it seems like it would of addressed most of the needs.  Anything else could be handled with manual code.

Add comment March 5th, 2006

How to make standard cut, copy, paste, and undo work on a MenuStrip in C# (VS2005)

Okay, the “add standard menu items” in the menustrip in C#/VS2005 is really cool, but it breaks cut/paste/copy/undo in windows (including the default ctrl+c, ctrl+v, etc. hotkeys).

So after tons of looking around for a c# example of how to do this with no success, I stumbled across a VB example that pointed me in the right direction (do a search for winuser.h - open it, then look for the constants below to see where I finally found the right pointers I needed.)

Anyway, in the end I got cut/paste/copy/undo working by calling out to windows for the default behaviour..

Post if you have any questions or comments - next .NET post will give some code examples on how to do cascade/minimize all/tile windows under the Window standard menu.

See my below code example on how to make cut/paste/copy/undo work.
Regards,

-Raskawa

Edit: If you have a MDI based app, and the menu or toolbar resides on the main window, you will need to pass “ActiveMdiChild.ActiveControl.Handle” vs. “ActiveControl.Handle” to the SendMessage function.
———————————————–

using System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
System.Runtime.InteropServices;

namespace testwindows
{

public partial class Form1 : Form
{

[DllImport(“user32.dll”, CharSet=CharSet.Auto)]
public static extern int SendMessage(IntPtr hwnd, int wMsg,

IntPtr wParam,
IntPtr lParam);
private const int WM_CUT = 0×0300;
private const int WM_COPY = 0×0301;
private const int WM_PASTE = 0×0302;
private const int WM_CLEAR = 0×0303;
private const int WM_UNDO = 0×0304;

public Form1()
{
InitializeComponent();
}

private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
SendMessage(ActiveControl.Handle, WM_COPY, IntPtr.Zero, IntPtr.Zero);
}

private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
SendMessage(ActiveControl.Handle, WM_CUT, IntPtr.Zero, IntPtr.Zero);
}

private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
SendMessage(ActiveControl.Handle, WM_PASTE, IntPtr.Zero, IntPtr.Zero);
}

private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
SendMessage(ActiveControl.Handle, WM_UNDO, IntPtr.Zero, IntPtr.Zero);
}

}
}

3 comments March 3rd, 2006

List of hosted source control sites

Needed a place to put code Rodric and I are working on, found this good list of hosted source control sites:
http://weblogs.asp.net/fmarguerie/archive/2005/04/27/404793.aspx

Enjoy!

-Rask

Add comment February 25th, 2006

David’s Blog @ Seal Software - Welcome!

Hi there,

This is going to be a ongoing blog. It’s going to be pretty loose, I thought it could be .NET focused, but I don’t want to limit myself to it being just a “code specific blog”.
Instead I am going to just share my thoughts/findings/etc. Most of what I will post here will be technology related to some extent.  At this point my hobby interests are in gadgets, games, and .net development stuff.

Hopefully some will find useful tidbits, while I am sure there will be some pretty useless things that will pass unnoticed as well.  Anyway - enjoy and drop me a note when you stop by!

Regards,

-David

Add comment February 11th, 2006


Calendar

March 2010
M T W T F S S
« Mar    
1234567
891011121314
15161718192021
22232425262728
293031  

Posts by Month

Posts by Category