RSS 2.0 Feed
2005-10 Entries
摘要:无数人奔走相告,传送着VS2005正式版本发行的喜讯。虽然想着又要卸载各个机器上的Beta版本甚至重新格式化,但想想那种对正式版本的等待终于要过去了,又是无限的欣慰 欣慰之余,读到大师Charles Petzold 的“Does Visual Studio Rot the Mind?”,甚有同感,不知道对Visual Studio的日益依赖应该是庆幸还是惋惜......[阅读全文]

posted @ | Feedback (26) | Filed Under [ .NET 杂类 ]

摘要:针对论坛上的问题“如何禁止在标题栏上点右键”,有如下方法: 1。用API去掉Move, [DllImport("user32.dll",EntryPoint="GetSystemMenu")] extern static System.IntPtr GetSystemMenu(System.IntPtr hWnd , System.IntPtr bRevert); [DllImport("user32.dll",EntryPoint="RemoveMenu")] extern static int RemoveMenu (IntPtr hMenu, int nPos, int flags); static int MF_BYPOSITION = 0x400; static int MF_REMOVE = 0x1000; System.IntPtr hdl= GetSystemMenu(this.Handle,System.IntPtr.Zero); int nflag =MF_BYPOSITION | MF_REMOVE; int npos =1; RemoveMenu(hdl,npos,nflag); 2。去掉系统菜单(不推荐) private const int WS_SYSMENU = 0x00080000; protected override CreateParams CreateParams   {    get    {     CreateParams cp =  base.CreateParams;     cp.Style = cp.Style & ~WS_SYSMENU;     return cp;    } } 示范代码如下using System; using System.Windows.Forms; using System.Runtime.InteropServices; public class Test : Form { [DllImport("user32.dll",EntryPoint="GetSystemMenu")] extern static System.IntPtr GetSystemMenu(System.IntPtr......[阅读全文]

posted @ | Feedback (4) | Filed Under [ .NET ]

摘要:看到这个问题,怎样让自定义控件的子控件不会自动生成变量定义? 研究了一下Table对象,发现,你需要使用自定义的集合编辑器,示范编码如下 using System; using System.Collections; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.ComponentModel.Design; using System.Web.UI.Design.WebControls; using System.Drawing.Design; using System.Reflection; namespace CSDNControls { [ToolboxData("<{0}:ColorToolbar runat=server></{0}:ColorToolbar>")] public class ColorToolbar : System.Web.UI.WebControls.WebControl { ColorButtonCollection colorButtons; [PersistenceMode(PersistenceMode.InnerProperty)] public ColorButtonCollection Buttons { get { if (colorButtons == null) colorButtons = new ColorButtonCollection(this); return colorButtons; } } } [ToolboxItem(false)] public class ColorButton : Button { } [Editor(typeof(ColorButtonCollectionEditor),typeof(UITypeEditor))] public class ColorButtonCollection : CollectionBase { private Control _owner; internal ColorButtonCollection(Control owner) { this._owner = owner; } public ColorButton this[int Index] { get { return (ColorButton) List[Index]; } } public bool Contains(ColorButton btn) { return List.Contains(btn); } public int Add(ColorButton btn) { int i; i = List.Add(btn); _owner.Controls.Add(btn); return i; } public void Insert( int index, ColorButton btn ) { List.Insert( index, btn ); _owner.Controls.AddAt(index,btn); } public int IndexOf( ColorButton btn) { return List.IndexOf( btn ); } public void Remove(ColorButton btn) { List.Remove(btn); _owner.Controls.Remove(btn); } } public class ColorButtonCollectionEditor : CollectionEditor { public ColorButtonCollectionEditor(Type type) : base(type){} //protected override bool CanSelectMultipleInstances() {return false;} protected override object CreateInstance(Type......[阅读全文]

posted @ | Feedback (3) | Filed Under [ ASP.NET/IIS ]