Copy Chart

Copy Chart To Clipboard MemoryStream MemoryStream1 = new MemoryStream(); Chart1.SaveImage(MemoryStream1, System.Windows.Forms.DataVisualization.Charting.ChartImageFormat.Bmp); System.Drawing.Bitmap Bitmap1 = new System.Drawing.Bitmap(MemoryStream1); System.Windows.Forms.Clipboard.SetImage(Bitmap1); Save Chart To File const string MY_FILE_EXTENSION = "png"; String SaveAsFilename; //If last directory is not valid then default to My Documents if (!Directory.Exists(Path.GetDirectoryName(ApMain.LastFileDirectory))) ApMain.LastFileDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); SaveFileDialog SelectFileDialog = new SaveFileDialog(); SelectFileDialog.Filter = "Image File (*." + […]

Read More

Creating A Chart With 2 Y Axis

  //——————————– //—– DO CHART BASIC SETUP —– //——————————– System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = (new System.Windows.Forms.DataVisualization.Charting.ChartArea()); System.Windows.Forms.DataVisualization.Charting.Legend legend1 = (new System.Windows.Forms.DataVisualization.Charting.Legend()); chartArea1.AxisX.TitleFont = new System.Drawing.Font("Arial", 9); chartArea1.AxisY.TitleFont = new System.Drawing.Font("Arial", 9); chartArea1.AxisY2.TitleFont = new System.Drawing.Font("Arial", 9); //—– SETUP X AXIS (TIME) —– chartArea1.AxisX.Title = "Secs"; chartArea1.AxisX.Minimum = 0; chartArea1.AxisX.Maximum = (ApMain.GRAPHS_BUFFER_LOG_EVERY_SECS * ApMain.GRAPHS_BUFFER_LENGTH); chartArea1.AxisX.Interval = 60; //Axis […]

Read More

.Chart Control General

Good Tutorial https://msdn.microsoft.com/en-us/library/dd489237.aspx?f=255&MSPPError=-2147217396 Add a chart to a form Toolbox. > Data category > drag a Chart control onto the form If you can't see the Chart control right click in the Toolbox, select Choose Items, and then select the following namespaces in the .NET Framekwork Components tab: System.Web.UI.DataVisualization.Charting System.Windows.Forms.DataVisualization.Charting  

Read More

Using Strings-Values

ToString() https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings Display Values With Decimal Places Force display of value with fixed number of decimal places When formatting numbers you can use “0” as mandatory place and “#” as optional place. Display Decimal Value Display Decimal Places Display Hex Value Display Binary Value Display Software Version Typical Solution Display DateTime Link to all format […]

Read More

Encode/Decode Strings

HtmlEncode Enabling HttpUtility for projects By default your app probably can't see "System.Web.HttpUtility".  You need to include a reference to System.Web. Right-click your project in the Solution Explorer > Add Reference > Assemblies > Framework > Scroll to System.Web and enable it  

Read More

Enter key calls method

Pressing enter in a text box calls a method private void txtPingAddress_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) btnPing_Click(this, new EventArgs()); }  

Read More

Application Settings

Right click on the project in Solution Explorer and choose Properties > Settings tab Use this page to create individual application settings Scope Typically select 'User'. If you select Application scope then Settings.Default[] will be read-only (save deosn't work) Visual Studio will create the files "Settings.settings" and "Settings.Designer".settings that contain the singleton class Settings. Reading and writing […]

Read More