Posts

Showing posts with the label VisualStudio

WinForm Gauge

Image
Introduction High Performance .NET Windows Form Gauge for info-graphics and real-time dashboard, created using GDI+ with no dependency on 3rd party package.  Visit official product page WinForm Gauge for more info.

Implementation of Downsampling Algorithm in MSChart Extension

Image
Introduction Throughout the years of development is MSChart Extension, performance issue on displaying large data size was still remain unsolved. When refreshing a chart on application, we want it to draw as fast as possible to minimize user waiting time and minimize memory consumption. When working with Microsoft Chart Control (MSChart) in WinForms, the amount of memory used and time to draw a chart gets longer with increased of data size. FastLine series have better performance but still suffer from performance hit when data size growth beyond 100K data points. Moreover, plotting large data points on screen with limited pixels caused all the data points and lines overlapped, resulting misinterpretation of information to user. Example below shows sinewave with constant frequency of 100K data points compare to downsampled chart with 500 data points. Sinewave with 100K data points Sinewave downsampled to 500 data points About Largest-Triangle-Three-Bucket (LTTB) Algorithm It's clear...

What's new in Microsoft Chart Control (MSChart) Extension Version 3

Image
Introduction MSChart Extension is an extension class for Microsoft Chart (MSChart) control in Visual Studio for WinForms applications. The tool was first published on July 2012 with the intention to overcome some of the limitation from the original MSChart and provide new functions. With zoom, pan and cursors added, the stock MSChart components can be use as an oscilloscope for waveform display and inspection. The source code and compiled package is available for download at: Download from GitHub Download from NuGet Articles regarding the previous release is available here: MSChartExtension Articles In this article, we will explore what are the new features included in Version 3, let's have a look. We tried to maintain backward compatibility with previous release to minimize changes required to your project, some of the methods and implementation had to be change for better implementation. New Features Chart Cursor Label Formatted String (Prefix, Post...

WinForms Quick Access List

Image
QuickAccessList automatic generate drop down menu from files in a folder. Typical implementation is to generate drop down menu for documentation or example associated with the application. Example below shows implementation of QuickAccessList to display all C# source file in the source folder. Source code and NuGet package available at WinForms Controls How to Use Drag and drop the control to your form. Add one or more search path to the controls as follow: quickAccessList.SearchPaths.Add( <Folder Path> ); Define file filter: quickAccessList.FileFilter = "*.cs"; Execute quickAccessList.UpdateList() to update the contents. Subscribed to ItemClicked event to define the action when menu item is clicked.

Start Click Once Application on Windows startup

There are few ways to configure application to run on Windows startup, register application in Windows registry is one of the common used method using this key: HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run   In CodeArtEng.Extensions library version 1.5.0, ApplicationExtensions is introduced to register / unregister running application in Windows Registry. ApplicationExtensions.AddApplicationToStartup() ApplicationExtensions.RemoveApplicationFromStartup() These methods is useful to enable / remove click one application from Windows startup since installation path for click-once application is dynamic. When click once application is updated to newer version, it execution path also changed. The registry key's value need to be updated in order for the auto startup to works again. With CodeArtEng.Extensions package, simply call method ApplicationExtensions.CheckAndUpdateApplicationStartupPath() to update the registry key if application had been registered to run...

Labeled TextBox

Image
Text field and label are working hand in hand to provide clear description of input field. Label for each text field is important to tell user what value is expected. A good design is important to assist user to enter value correctly with minimum effort. Learn more about best practice of text box and label design here:  Designing Perfect Text Field: Clarity, Accessibility and User Effort In WinForms , text field (TextBox) and Label are 2 different components. A lot of repetitive steps need to be done when creating form with multiple text boxes, no to mentioned that when you need to create more forms. We derived a component named LabeledTextbox which combine both Label and TextBox in one single component, simplify your form's design process and provide better control on width and size for label and text field. This component is part of the CodeArtEng.Controls library. LABEL Text for label and text box are accessible from property LabelText and Text. The size of the label ...

WinForms Controls

Image
Description Collection of .NET Windows Forms controls for WinForms application. Named as CodeArtEng.Controls.dll Download GitHub NuGet Features  Command Line Helper Labeled Text Box Hinted Text Box Multi-Line Button Status Label Open File Panel and Folder Browse Panel MRU (Most Recent Used File List) File Explorer Control Quick Access List Rich Text Box Editor Features Description Command Macro Editor Input editing dialog inspired by Visual Studio "Edit Pre-Build" and "Edit Post-Build" Dialog... ( Learn More... ) Command Line Helper Generate and parse command line with command line helper. ( Learn More... ) Labeled Text Box  Text box with label and hint, derived from Hinted Text Box. Hinted Text Box  Enhanced version of WinForms TextBox with capability to show hint in gray color text. Multi-Line Button  Button control with optional image and 2 lines of text, main and sub title. Each line can be configured using d...

VS2015 UserControlTestContainer

Image
Introduction UserControlTestContainer is a tool provided my Microsoft in Visual Studio to test the run-time behavior of UserControl. This tool is useful when come to verify properties of a user control especially during development phase. VS2010 In VS2010, the tool is automatically launched when we run a Class Library project which contains user control. VS2015 The tool is still shipped with VS2015, located at ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\UserControlTestContainer.exe". However, it is no longer launch from Visual Studio automatically. The good news is we still can manually add this tool to Visual Stu dio 2015 IDE from "External Tools" using the following configuration for new tool entry. External Tools configuration window is located at Tools - External Tools..." Title: UserControl Test Container Command : C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\UserControlTestContainer.exe Arg...

Password Property in PropertyGrid

To mask a property of an object in property grid with password like editor, simply add attribute [PasswordPropertyText(true)] on the selected property. Example: [PasswordPropertyText(true)] public string Label { get; set; }

Dynamic Load Assembly

Image
Introduction    Dynamic library loading is nothing new in native C++. In Microsoft Window’s implementation, this capability is realized with the use of Dynamic Link Library (DLL) . This feature greatly expands the flexibility of an application where new features can be added / modified in the form of plug-in without the need to recompile the entire application. Similar capability is provided in .NET framework to dynamically load assemblies which make plug-in development for .NET based application possible. Moreover, dynamic assembly loading that .NET framework provides is much more powerful than native C++ DLL. Wikipedia : plug-in is a software component that adds a specific feature to an existing software application.  Download Demo Download Sample Project

C# Stop / Suspend painting for a control.

Original post from stack overflow: How do I suspend painting for a control and its children? The code below is used to suspend painting for control to speed up processing. using  System.Runtime.InteropServices; class   DrawingControl {     [ DllImport ( "user32.dll" )]      public   static   extern   int  SendMessage(IntPtr hWnd, Int32 wMsg, bool  wParam, Int32 lParam);      private   const   int  WM_SETREDRAW = 11;      public   static   void  SuspendDrawing(Control parent)     {         SendMessage(parent.Handle, WM_SETREDRAW,  false , 0);     }      public   static   void  ResumeDrawing(Control parent)   ...

Speedup MSChart Clear Data Points

Problem Statement Clearing data points in MSChart is known to be very slow. http://connect.microsoft.com/VisualStudio/feedback/details/596212/performance-problem-in-mschart-datapointcollection-clear Solution However, there is a work around for this problem. Suggested work around from link stated above is as below:        public   void  ClearPointsQuick()     {         Points.SuspendUpdates();          while  (Points.Count > 0)             Points.RemoveAt(Points.Count - 1);         Points.ResumeUpdates();         Points.Clear(); //NOTE 1     }   Extension method implementation is as below:      internal   static   class   ...

VS2010 User Control - Text Property

In VS2010, Text property in user control are not visible by default. Adding Browsable(true) attribute will display the Text property in properties window but the value was not stored in designer file (xxxx.designer.cs). Solutions:   [ EditorBrowsable ( EditorBrowsableState . Always )] [ Browsable ( true )] [ DesignerSerializationVisibility ( DesignerSerializationVisibility . Visible )] [ Bindable ( true )] public override string Text ...