Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# afficher texte


private bool m_readOnly = false;
private const int EM_SETREADONLY = 0x00CF;

internal delegate bool EnumChildWindowsCallBack( IntPtr hwnd, IntPtr lParam );

[DllImport("user32.dll", CharSet = CharSet.Auto)]
internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

[ DllImport( "user32.dll" ) ]
internal static extern int EnumChildWindows( IntPtr hWndParent, EnumChildWindowsCallBack lpEnumFunc, IntPtr lParam );


private bool EnumChildWindowsCallBackFunction(IntPtr hWnd, IntPtr lparam)
{
      if( hWnd != IntPtr.Zero )
       {
              IntPtr readonlyValue = ( m_readOnly ) ? new IntPtr( 1 ) : IntPtr.Zero;
             SendMessage( hWnd, EM_SETREADONLY, readonlyValue, IntPtr.Zero );
             comboBox1.Invalidate();
             return true;
       }
       return false;
}

private void MakeComboBoxReadOnly( bool readOnly )
{
    m_readOnly = readOnly;
    EnumChildWindowsCallBack callBack = new EnumChildWindowsCallBack(this.EnumChildWindowsCallBackFunction );
    EnumChildWindows( comboBox1.Handle, callBack, IntPtr.Zero );
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: how to make a specific scene load only on game start in unity 
Csharp :: entity framework update child records 
Csharp :: how to make error sound c# 
Csharp :: how do I print something in the console at the start of the game unity 
Csharp :: replace elements with greatest element on right side 
Csharp :: c# make first letter uppercase 
Csharp :: stop a thread c# 
Csharp :: unity3d remove parent 
Csharp :: c# compile code at runtime 
Csharp :: c# sqlite query 
Csharp :: unity on inspector change 
Csharp :: debug c# console 
Csharp :: c# void 
Csharp :: How to create connection string dynamically in C# 
Csharp :: how set function when props update in vue 
Csharp :: how to make a custom cursor in windows forms c# 
Csharp :: c# first item i list 
Csharp :: c# stop process 
Csharp :: list removeall unity 
Csharp :: c# list remove item based on property duplicate 
Csharp :: c# get datatable column names to list 
Csharp :: remove index from array c# 
Csharp :: c# array to string 
Csharp :: c# windows forms print 
Csharp :: c# for loop 
Csharp :: order by length descending C# 
Csharp :: gameobject on click unity 
Csharp :: function on animation exit unity 
Csharp :: c# how to fill a datatable 
Csharp :: html.beginform 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =