Snippets tagged winforms

  • Structural BeginUpdate / EndUpdate with Lambda

    Several WinForms controls, like TreeView and ListView, implement methods BeginUpdate and EndUpdate, which suspend repainting of the control while items are being individually added to a control, preventing flicker caused by rapid repainting. But using BeginUpdate and EndUpdate is very imperative, and opens up the possibility for bugs, such as neglecting to call the matching EndUpdate. An obvious improvement would be to create an extension method on types implementing this pattern which takes a unit -> unit lambda which is executed between update pairs. But the pattern is only conventional, rather than through a common base class or interface. Hence this presents a reasonable opportunity to use F#'s statically resolved structural type system to implement a function which only works on Control types with the correct structural signature.

    3 people like this

    Posted: 13 years ago by Stephen Swensen

  • Basic WinForms drag and drop

    Quick example of using drag-n-drop with WinForms.

    4 people like this

    Posted: 13 years ago by MichaelGG

  • Auto-completion in any winforms text box

    The standard windows.forms text box supports auto-completion, but only for single-line text boxes. The code below can be used to add auto-completion against a fixed set of words to any text box that inherits from TextBoxBase.

    5 people like this

    Posted: 12 years ago by Johann Deneux

  • DataGridView BindingSource Sorting and Filtering

    The code snippet for working with Windows Forms DatagridView with filtering and sorting features.

    2 people like this

    Posted: 2 years ago by Vladimir Demydov