'textbox'에 해당되는 글 2건

  1. 2015.02.05 TextBox.OnTextChanged 에서 발생하는 예외 처리
  2. 2015.02.05 Label, TextBlock, TextBox
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

未处理 System.InvalidOperationException

  Message=无法关闭撤消单元,因为不存在已打开的单元。


  Source=PresentationFramework

  StackTrace:

       在 MS.Internal.Documents.UndoManager.Close(IParentUndoUnit unit, UndoCloseAction closeAction)

       在 System.Windows.Documents.ImmComposition.CloseCompositionUndoUnit(UndoCloseAction undoCloseAction, ITextPointer compositionEnd)

       在 System.Windows.Documents.ImmComposition.UpdateCompositionText(FrameworkTextComposition composition, Int32 resultLength, Boolean includeResultText, ITextPointer& start, ITextPointer& end)

       在 System.Windows.Documents.ImmComposition.RaiseTextInputStartEvent(FrameworkTextComposition composition, Int32 resultLength, String compositionString)

       在 System.Windows.Documents.ImmComposition.OnWmImeChar(IntPtr wParam, Boolean& handled)

       在 System.Windows.Documents.ImmComposition.ImmCompositionFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       在 System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

       在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

       在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

       在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

       在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       在 MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       在 MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       在 MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

       在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

       在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

       在 System.Windows.Application.RunDispatcher(Object ignore)

       在 System.Windows.Application.RunInternal(Window window)

       在 System.Windows.Application.Run(Window window)

       在 System.Windows.Application.Run()

       在 LiveChainCHIS_Client.App.Main() 位置 D:\项目\LiveChainCHIS-Client\LiveChainCHIS-Client\obj\x86\Debug\App.g.cs:行号 0

       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       在 System.Threading.ThreadHelper.ThreadStart()

  InnerException: 


补充说明一下 ,这个错误只出现于 数据绑定后的TextBox控件上。



解决办法:  设置Textbox的UndoLimit 为0就ok。


중문 윈도우에서 중문 IME를 이용해 TextBox에 글자를 입력하려고 하면 발생하는 예외 처리 방법

위에 써있듯이 TextBox에 UndoLimit을 0으로 설정해주면 해결된다


출처 : http://www.cnblogs.com/muzizongheng/p/3169812.html

Posted by 역시인생한방
,
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

(1) Intro

 윈폼을 건드려본 사람은 Label 과 TextBox 컨트롤은 매우 친숙할 것이다. WPF 에서는 여기에 TextBlock 이라는 컨트롤이 추가되었는데, 무엇이 다른걸까? 우선 MSDN 에서 각각의 컨트롤을 어떻게 정의했는지 살펴보자.


(이들은 모두 System.Windows.Controls 네임스페이스에 정의되어 있다.)

 컨트롤 

정의

 Label

Represents the text label for a control and provides support for access keys. 

 TextBlock

Provides a lightweight control for displaying small amounts of flow content.

 TextBox

Represents a control that can be used to display or edit unformatted text. 


Label 은 Access Key 를 이용해 접근하는 것을 지원한다. TextBlock 은 간단한 Content 를 매우 가볍게 제공한다. TextBox 는 우리가 알던대로 텍스트의 편집 / 뷰어를 제공한다. 의미만 봐서는 Label 과 TextBlock 의 차이점을 잘 알지 못하겠다. 왜냐하면 우리가 지금까지 알고있던 Label 의 개념과 이번에 나온 TextBlock 의 개념이 크게 차이가 나지 않기 때문이다. 이들의 차이점은 기본 자식의 개념에서 확실히 드러난다.


(2) 차이점

 Content Property 의 리턴타입은 object 형으로 거의 모든(Window를 제외하므로) 컨트롤을 지정할 수 있다. 여기서 Label 과 TextBlock 의 기본적인 차이가 드러난다.


 Label 과 TextBlock 과 TextBox 의 자식요소

 1. Label 의 기본 자식은 Content(object) 이다.

 2. TextBlock 의 기본 자식은 Text(string) 이다.

 3. TextBox 의 기본 자식은 Text(string) 이다.


 그렇다. Label 의 자식은 Content 로서, string 을 포함한 그 어떤 Control 이라도 지정할 수 있다. 하지만 TextBlock 의 자식은 string 밖에 되지 않는다. 기본 설계부터가 다른 것이다. 마음만 먹는다면 Label 의 Content 로 Button 을 지정할 수도 있다. 물론 Text 를 기본 자식으로 갖는 TextBlock 에서는 꿈도 꾸지 못할 일이다. Label 과 TextBlock 을 분류하자면 사용 용도에 따른 분류가 될 것이다.


 사용 용도에 따른 Label 과 TextBlock 의 분류

 * Text 만을 사용할 것이라면 TextBlock 을 쓰는 쪽이 가볍고 빠르다.

 * Text 외의 것까지 사용하고 싶다면 Label 을 사용하자(추후에 변화를 주고 싶다면)


출처 : http://blog.naver.com/PostView.nhn?blogId=inasie&logNo=70025582628&viewDate=%C2%A4tPage=1&listtype=0

Posted by 역시인생한방
,