Posts
[C#]使用Win32 API為編輯框與下拉方塊加上提示字串
const int EM_SETCUEBANNER = 0x1501; private string _cueText; [Localizable(true)] public string CueText { get { if (_cueText == null) return string.Empty; return _cueText; } set { _cueText = value; updateCue(); } } private void updateCue() { SendMessage(this.Handle, EM_SETCUEBANNER, 0, CueText); } }</pre></div>
read morePosts
[C++/CLI]Nativated物件處理Managed物件的事件
void OnAutoRunTimerTick(System::Object^ sender, System::EventArgs^ e) { _handler->AutoRunTimer_Tick(sender, e); } };
read morePosts
[VB.NET]MDI Thumbnail Preview
Public Class ThumbnailDialog
Private _mdiParent As Form Private _thumbnailPool As Dictionary(Of Form, Image) Private Property m_MDIParent As Form Get Return _mdiParent End Get Set(ByVal value As Form) _mdiParent = value End Set End Property Private ReadOnly Property m_ThumbnailPool As Dictionary(Of Form, Image) Get If _thumbnailPool Is Nothing Then _thumbnailPool = New Dictionary(Of Form, Image) End If Return _thumbnailPool End Get End Property Public ReadOnly Property SelectedChildForm As Form Get Return If(ListBox1.
read morePosts
用Extension Method在執行階段進行控制項的拖曳
Public Module ControlExtension
#Region “Var” Private _runtimeDragClickPoint As Point #End Region
#Region “Private Property” Private Property m_RuntimeDragClickPoint() As Point Get Return _runtimeDragClickPoint End Get Set(ByVal value As Point) If _runtimeDragClickPoint <> value Then _runtimeDragClickPoint = value End If End Set End Property #End Region
#Region “Public Method” <Extension()> _ Public Sub EnableRuntimeDrag(ByVal ctrl As Control) DisableRuntimeDrag(ctrl) AddHandler ctrl.MouseDown, AddressOf ctrl_MouseDown AddHandler ctrl.MouseMove, AddressOf ctrl_MouseMove AddHandler ctrl.HandleDestroyed, AddressOf ctrl_HandleDestroyed End Sub
read more