Add project files.
4a692488a2e4e57e7b3c618e48d78b8e66cee477
8 files changed
AnnuiteitenFormApp.slnAnnuiteitenFormApp/AnnuiteitenFormApp.csprojAnnuiteitenFormApp/Form1.Designer.csAnnuiteitenFormApp/Form1.csAnnuiteitenFormApp/Form1.resxAnnuiteitenFormApp/PrintableListView.csAnnuiteitenFormApp/PrintableListView.resxAnnuiteitenFormApp/Program.cs
diff --git a/AnnuiteitenFormApp.sln b/AnnuiteitenFormApp.sln
new file mode 100644
index 0000000..7e99a7b
--- /dev/null
+++ b/AnnuiteitenFormApp.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.10.34928.147
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnnuiteitenFormApp", "AnnuiteitenFormApp\AnnuiteitenFormApp.csproj", "{93FDB633-349C-42B8-87E9-D743475C45DF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {93FDB633-349C-42B8-87E9-D743475C45DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {93FDB633-349C-42B8-87E9-D743475C45DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {93FDB633-349C-42B8-87E9-D743475C45DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {93FDB633-349C-42B8-87E9-D743475C45DF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {DCF6089A-6C3C-4118-B879-377504375326}
+ EndGlobalSection
+EndGlobal
diff --git a/AnnuiteitenFormApp/AnnuiteitenFormApp.csproj b/AnnuiteitenFormApp/AnnuiteitenFormApp.csproj
new file mode 100644
index 0000000..663fdb8
--- /dev/null
+++ b/AnnuiteitenFormApp/AnnuiteitenFormApp.csproj
@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net8.0-windows</TargetFramework>
+ <Nullable>enable</Nullable>
+ <UseWindowsForms>true</UseWindowsForms>
+ <ImplicitUsings>enable</ImplicitUsings>
+ </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/AnnuiteitenFormApp/Form1.Designer.cs b/AnnuiteitenFormApp/Form1.Designer.cs
new file mode 100644
index 0000000..1ac9a50
--- /dev/null
+++ b/AnnuiteitenFormApp/Form1.Designer.cs
@@ -0,0 +1,349 @@
+namespace AnnuiteitenFormApp
+{
+ partial class Form1
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ statusStrip1 = new StatusStrip();
+ panel1 = new Panel();
+ button4 = new Button();
+ button3 = new Button();
+ groupBox1 = new GroupBox();
+ button2 = new Button();
+ textBoxAnnuiteit = new TextBox();
+ label4 = new Label();
+ textBoxJaarrente = new TextBox();
+ label3 = new Label();
+ buttonPerioden = new Button();
+ textBoxPerioden = new TextBox();
+ label2 = new Label();
+ button1 = new Button();
+ textBoxHoofdsom = new TextBox();
+ label1 = new Label();
+ groupBox2 = new GroupBox();
+ listView1 = new PrintableListView();
+ columnHeader1 = new ColumnHeader();
+ columnHeader2 = new ColumnHeader();
+ columnHeader3 = new ColumnHeader();
+ columnHeader4 = new ColumnHeader();
+ columnHeader5 = new ColumnHeader();
+ contextMenuStrip1 = new ContextMenuStrip(components);
+ selectAllToolStripMenuItem = new ToolStripMenuItem();
+ copyToolStripMenuItem = new ToolStripMenuItem();
+ panel1.SuspendLayout();
+ groupBox1.SuspendLayout();
+ groupBox2.SuspendLayout();
+ contextMenuStrip1.SuspendLayout();
+ SuspendLayout();
+ //
+ // statusStrip1
+ //
+ statusStrip1.Location = new Point(0, 558);
+ statusStrip1.Name = "statusStrip1";
+ statusStrip1.Size = new Size(462, 22);
+ statusStrip1.TabIndex = 0;
+ statusStrip1.Text = "statusStrip1";
+ //
+ // panel1
+ //
+ panel1.Controls.Add(button4);
+ panel1.Controls.Add(button3);
+ panel1.Controls.Add(groupBox1);
+ panel1.Dock = DockStyle.Top;
+ panel1.Location = new Point(0, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(462, 173);
+ panel1.TabIndex = 1;
+ //
+ // button4
+ //
+ button4.Location = new Point(322, 65);
+ button4.Name = "button4";
+ button4.Size = new Size(108, 23);
+ button4.TabIndex = 4;
+ button4.Text = "Prt. Preview";
+ button4.UseVisualStyleBackColor = true;
+ button4.Click += button4_Click;
+ //
+ // button3
+ //
+ button3.Location = new Point(322, 36);
+ button3.Name = "button3";
+ button3.Size = new Size(108, 23);
+ button3.TabIndex = 3;
+ button3.Text = "Print";
+ button3.UseVisualStyleBackColor = true;
+ button3.Click += button3_Click;
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(button2);
+ groupBox1.Controls.Add(textBoxAnnuiteit);
+ groupBox1.Controls.Add(label4);
+ groupBox1.Controls.Add(textBoxJaarrente);
+ groupBox1.Controls.Add(label3);
+ groupBox1.Controls.Add(buttonPerioden);
+ groupBox1.Controls.Add(textBoxPerioden);
+ groupBox1.Controls.Add(label2);
+ groupBox1.Controls.Add(button1);
+ groupBox1.Controls.Add(textBoxHoofdsom);
+ groupBox1.Controls.Add(label1);
+ groupBox1.Location = new Point(12, 12);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Size = new Size(288, 145);
+ groupBox1.TabIndex = 0;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "bereken ennuiteit";
+ //
+ // button2
+ //
+ button2.Location = new Point(189, 106);
+ button2.Name = "button2";
+ button2.Size = new Size(75, 23);
+ button2.TabIndex = 11;
+ button2.Text = "Bereken";
+ button2.UseVisualStyleBackColor = true;
+ button2.Click += button2_Click;
+ //
+ // textBoxAnnuiteit
+ //
+ textBoxAnnuiteit.Location = new Point(108, 106);
+ textBoxAnnuiteit.Name = "textBoxAnnuiteit";
+ textBoxAnnuiteit.Size = new Size(69, 23);
+ textBoxAnnuiteit.TabIndex = 10;
+ textBoxAnnuiteit.TextAlign = HorizontalAlignment.Right;
+ //
+ // label4
+ //
+ label4.AutoSize = true;
+ label4.Location = new Point(23, 109);
+ label4.Name = "label4";
+ label4.Size = new Size(73, 15);
+ label4.TabIndex = 9;
+ label4.Text = "Annuïteit [€]";
+ //
+ // textBoxJaarrente
+ //
+ textBoxJaarrente.Location = new Point(108, 77);
+ textBoxJaarrente.Name = "textBoxJaarrente";
+ textBoxJaarrente.Size = new Size(69, 23);
+ textBoxJaarrente.TabIndex = 7;
+ textBoxJaarrente.Text = "6.00";
+ textBoxJaarrente.TextAlign = HorizontalAlignment.Right;
+ //
+ // label3
+ //
+ label3.AutoSize = true;
+ label3.Location = new Point(21, 80);
+ label3.Name = "label3";
+ label3.Size = new Size(75, 15);
+ label3.TabIndex = 6;
+ label3.Text = "Jaarrente [%]";
+ //
+ // buttonPerioden
+ //
+ buttonPerioden.Location = new Point(189, 48);
+ buttonPerioden.Name = "buttonPerioden";
+ buttonPerioden.Size = new Size(75, 23);
+ buttonPerioden.TabIndex = 5;
+ buttonPerioden.Text = "Bereken";
+ buttonPerioden.UseVisualStyleBackColor = true;
+ buttonPerioden.Click += buttonPerioden_Click;
+ //
+ // textBoxPerioden
+ //
+ textBoxPerioden.Location = new Point(108, 48);
+ textBoxPerioden.Name = "textBoxPerioden";
+ textBoxPerioden.Size = new Size(69, 23);
+ textBoxPerioden.TabIndex = 4;
+ textBoxPerioden.Text = "120";
+ textBoxPerioden.TextAlign = HorizontalAlignment.Right;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(6, 51);
+ label2.Name = "label2";
+ label2.Size = new Size(90, 15);
+ label2.TabIndex = 3;
+ label2.Text = "Perioden [mnd]";
+ //
+ // button1
+ //
+ button1.Location = new Point(189, 19);
+ button1.Name = "button1";
+ button1.Size = new Size(75, 23);
+ button1.TabIndex = 2;
+ button1.Text = "Bereken";
+ button1.UseVisualStyleBackColor = true;
+ button1.Click += button1_Click;
+ //
+ // textBoxHoofdsom
+ //
+ textBoxHoofdsom.Location = new Point(108, 19);
+ textBoxHoofdsom.Name = "textBoxHoofdsom";
+ textBoxHoofdsom.Size = new Size(69, 23);
+ textBoxHoofdsom.TabIndex = 1;
+ textBoxHoofdsom.Text = "100000";
+ textBoxHoofdsom.TextAlign = HorizontalAlignment.Right;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(15, 22);
+ label1.Name = "label1";
+ label1.Size = new Size(81, 15);
+ label1.TabIndex = 0;
+ label1.Text = "Hoofdsom [€]";
+ //
+ // groupBox2
+ //
+ groupBox2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ groupBox2.Controls.Add(listView1);
+ groupBox2.Location = new Point(12, 179);
+ groupBox2.Name = "groupBox2";
+ groupBox2.Size = new Size(438, 376);
+ groupBox2.TabIndex = 2;
+ groupBox2.TabStop = false;
+ groupBox2.Text = "aflossing";
+ //
+ // listView1
+ //
+ listView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ listView1.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3, columnHeader4, columnHeader5 });
+ listView1.ContextMenuStrip = contextMenuStrip1;
+ listView1.FitToPage = false;
+ listView1.FullRowSelect = true;
+ listView1.GridLines = true;
+ listView1.Location = new Point(6, 22);
+ listView1.Name = "listView1";
+ listView1.Size = new Size(413, 348);
+ listView1.TabIndex = 0;
+ listView1.Title = "";
+ listView1.UseCompatibleStateImageBehavior = false;
+ listView1.View = View.Details;
+ //
+ // columnHeader1
+ //
+ columnHeader1.Text = "Maand";
+ //
+ // columnHeader2
+ //
+ columnHeader2.Text = "Annuiteit";
+ columnHeader2.TextAlign = HorizontalAlignment.Right;
+ columnHeader2.Width = 75;
+ //
+ // columnHeader3
+ //
+ columnHeader3.Text = "Rente";
+ columnHeader3.TextAlign = HorizontalAlignment.Right;
+ //
+ // columnHeader4
+ //
+ columnHeader4.Text = "Aflossing";
+ columnHeader4.TextAlign = HorizontalAlignment.Right;
+ columnHeader4.Width = 75;
+ //
+ // columnHeader5
+ //
+ columnHeader5.Text = "Restant";
+ columnHeader5.TextAlign = HorizontalAlignment.Right;
+ columnHeader5.Width = 75;
+ //
+ // contextMenuStrip1
+ //
+ contextMenuStrip1.Items.AddRange(new ToolStripItem[] { selectAllToolStripMenuItem, copyToolStripMenuItem });
+ contextMenuStrip1.Name = "contextMenuStrip1";
+ contextMenuStrip1.Size = new Size(165, 48);
+ //
+ // selectAllToolStripMenuItem
+ //
+ selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
+ selectAllToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
+ selectAllToolStripMenuItem.Size = new Size(164, 22);
+ selectAllToolStripMenuItem.Text = "Select All";
+ selectAllToolStripMenuItem.Click += selectAllToolStripMenuItem_Click;
+ //
+ // copyToolStripMenuItem
+ //
+ copyToolStripMenuItem.Name = "copyToolStripMenuItem";
+ copyToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
+ copyToolStripMenuItem.Size = new Size(164, 22);
+ copyToolStripMenuItem.Text = "Copy";
+ copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
+ //
+ // Form1
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(462, 580);
+ Controls.Add(groupBox2);
+ Controls.Add(panel1);
+ Controls.Add(statusStrip1);
+ Name = "Form1";
+ Text = "Form1";
+ Load += Form1_Load;
+ panel1.ResumeLayout(false);
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
+ groupBox2.ResumeLayout(false);
+ contextMenuStrip1.ResumeLayout(false);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private StatusStrip statusStrip1;
+ private Panel panel1;
+ private Button button4;
+ private Button button3;
+ private GroupBox groupBox1;
+ private Button button2;
+ private TextBox textBoxAnnuiteit;
+ private Label label4;
+ private TextBox textBoxJaarrente;
+ private Label label3;
+ private Button buttonPerioden;
+ private TextBox textBoxPerioden;
+ private Label label2;
+ private Button button1;
+ private TextBox textBoxHoofdsom;
+ private Label label1;
+ private GroupBox groupBox2;
+ private PrintableListView listView1;
+ private ColumnHeader columnHeader1;
+ private ColumnHeader columnHeader2;
+ private ColumnHeader columnHeader3;
+ private ColumnHeader columnHeader4;
+ private ColumnHeader columnHeader5;
+ private ContextMenuStrip contextMenuStrip1;
+ private ToolStripMenuItem selectAllToolStripMenuItem;
+ private ToolStripMenuItem copyToolStripMenuItem;
+ }
+}
diff --git a/AnnuiteitenFormApp/Form1.cs b/AnnuiteitenFormApp/Form1.cs
new file mode 100644
index 0000000..67652af
--- /dev/null
+++ b/AnnuiteitenFormApp/Form1.cs
@@ -0,0 +1,203 @@
+using System.Text;
+
+namespace AnnuiteitenFormApp
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private double MaandRente(double jaarrente)
+ {
+ return Math.Pow(1.0 + (jaarrente / 100.0), 1.0 / 12.0) - 1.0;
+ }
+
+ private double Annuiteit(double hoofdsom, double jaarrente, double perioden)
+ {
+ double maandrente = MaandRente(jaarrente);
+ double annuiteit = (maandrente * hoofdsom) / (1.0 - Math.Pow(1.0 + maandrente, -perioden));
+ return annuiteit;
+ }
+
+ private double Hoofdsom(double annuiteit, double jaarrente, double perioden)
+ {
+ double maandrente = MaandRente(jaarrente);
+ double hoofdsom = (annuiteit * (1.0 - Math.Pow(1.0 + maandrente, -perioden))) / maandrente;
+ return hoofdsom;
+ }
+
+ private double Jaarrente(double hoofdsom, double perioden, double annuiteit)
+ {
+ double maandrente = 0.0;
+ // ??????
+ double jaarrente = 100.0 * (Math.Pow((maandrente + 1.0), 12) - 1.0);
+ return jaarrente;
+ }
+
+ private double Perioden(double hoofdsom, double jaarrente, double annuiteit)
+ {
+ double T = hoofdsom;
+ double J = annuiteit;
+ double i = MaandRente(jaarrente);
+
+ if (J > (i * T))
+ {
+ double n = -Math.Log(1 - (i * T) / J) / Math.Log(1 + i);
+ return Math.Round(n);
+ }
+ return 0;
+ }
+
+ private void Calc()
+ {
+ try
+ {
+ double hoofdsom;
+ double jaarrente;
+ double perioden;
+ double annuiteit;
+
+ double.TryParse(this.textBoxHoofdsom.Text, out hoofdsom);
+ double.TryParse(this.textBoxJaarrente.Text.Replace('.', ','), out jaarrente);
+ double.TryParse(this.textBoxPerioden.Text, out perioden);
+ double.TryParse(this.textBoxAnnuiteit.Text, out annuiteit);
+
+ if (annuiteit == 0.0)
+ annuiteit = Annuiteit(hoofdsom, jaarrente, perioden);
+ if (hoofdsom == 0.0)
+ hoofdsom = Hoofdsom(annuiteit, jaarrente, perioden);
+ if (perioden == 0.0)
+ perioden = Perioden(hoofdsom, jaarrente, annuiteit);
+ this.textBoxAnnuiteit.Text = string.Format("{0:N0}", annuiteit);
+ this.textBoxHoofdsom.Text = string.Format("{0:N0}", hoofdsom);
+ this.textBoxPerioden.Text = string.Format("{0:N0}", perioden);
+
+ ShowSchema(hoofdsom, annuiteit, jaarrente, perioden);
+ }
+ catch
+ {
+ this.textBoxAnnuiteit.Text = "?";
+ }
+ }
+
+ private void ShowSchema(double hoofdsom, double annuiteit, double jaarrente, double perioden)
+ {
+ this.listView1.Items.Clear();
+ double maandrente = MaandRente(jaarrente);
+ for (int intN = 0; intN <= (int)perioden; intN++)
+ {
+ ListViewItem lvi = new ListViewItem(intN.ToString());
+ if (intN == 0)
+ {
+ lvi.Text = "";
+ lvi.SubItems.Add("");
+ lvi.SubItems.Add(string.Format("{0:0.00}%", jaarrente));
+ lvi.SubItems.Add("");
+ lvi.SubItems.Add(string.Format("{0:N0}", hoofdsom));
+ }
+ else
+ {
+ double rente = hoofdsom * maandrente;
+ double aflossing = annuiteit - rente;
+ hoofdsom -= aflossing;
+ lvi.SubItems.Add(string.Format("{0:N0}", annuiteit));
+ lvi.SubItems.Add(string.Format("{0:N0}", rente));
+ lvi.SubItems.Add(string.Format("{0:N0}", aflossing));
+ lvi.SubItems.Add(string.Format("{0:N0}", hoofdsom));
+ }
+ this.listView1.Items.Add(lvi);
+ }
+ }
+
+ public void CopyListViewToClipboard(ListView lv)
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ for (int i = 0; i < lv.Columns.Count; i++)
+ {
+ buffer.Append(lv.Columns[i].Text);
+ buffer.Append("\t");
+ }
+
+ buffer.AppendLine();
+
+
+ if (lv.SelectedItems.Count == 0)
+ {
+ for (int i = 0; i < lv.Items.Count; i++)
+ {
+ for (int j = 0; j < lv.Columns.Count; j++)
+ {
+ buffer.Append(lv.Items[i].SubItems[j].Text);
+ buffer.Append("\t");
+ }
+
+ buffer.AppendLine();
+ }
+ }
+ else
+ {
+ for (int i = 0; i < lv.SelectedItems.Count; i++)
+ {
+ for (int j = 0; j < lv.Columns.Count; j++)
+ {
+ buffer.Append(lv.SelectedItems[i].SubItems[j].Text);
+ buffer.Append("\t");
+ }
+
+ buffer.AppendLine();
+ }
+ }
+ Clipboard.SetText(buffer.ToString());
+ }
+
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ this.textBoxHoofdsom.Text = "";
+ Calc();
+ }
+
+ private void buttonPerioden_Click(object sender, EventArgs e)
+ {
+ this.textBoxPerioden.Text = "";
+ Calc();
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ this.textBoxAnnuiteit.Text = "";
+ Calc();
+ }
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ this.listView1.Print();
+ }
+
+ private void button4_Click(object sender, EventArgs e)
+ {
+ this.listView1.PrintPreview();
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ Calc();
+ }
+
+ private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ foreach (ListViewItem item in this.listView1.Items)
+ {
+ item.Selected = true;
+ }
+ }
+
+ private void copyToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ CopyListViewToClipboard(this.listView1);
+ }
+ }
+}
diff --git a/AnnuiteitenFormApp/Form1.resx b/AnnuiteitenFormApp/Form1.resx
new file mode 100644
index 0000000..1217449
--- /dev/null
+++ b/AnnuiteitenFormApp/Form1.resx
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
diff --git a/AnnuiteitenFormApp/PrintableListView.cs b/AnnuiteitenFormApp/PrintableListView.cs
new file mode 100644
index 0000000..fa827aa
--- /dev/null
+++ b/AnnuiteitenFormApp/PrintableListView.cs
@@ -0,0 +1,397 @@
+
+using System.Drawing.Printing;
+
+
+namespace AnnuiteitenFormApp
+{
+ /// <summary>
+ /// Summary description for PrintableListView.
+ /// </summary>
+ public class PrintableListView : ListView
+ {
+ // Print fields
+ private PrintDocument m_printDoc = new PrintDocument();
+ private PageSetupDialog m_setupDlg = new PageSetupDialog();
+ private PrintPreviewDialog m_previewDlg = new PrintPreviewDialog();
+ private PrintDialog m_printDlg = new PrintDialog();
+
+ private int m_nPageNumber=1;
+ private int m_nStartRow=0;
+ private int m_nStartCol=0;
+
+ private bool m_bPrintSel=false;
+
+ private bool m_bFitToPage=false;
+
+ private float m_fListWidth=0.0f;
+ private float[] m_arColsWidth;
+
+ private float m_fDpi=96.0f;
+
+ private string m_strTitle="";
+
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ #region Properties
+ /// <summary>
+ /// Gets or sets whether to fit the list width on a single page
+ /// </summary>
+ /// <value>
+ /// <c>True</c> if you want to scale the list width so it will fit on a single page.
+ /// </value>
+ /// <remarks>
+ /// If you choose false (the default value), and the list width exceeds the page width, the list
+ /// will be broken in multiple page.
+ /// </remarks>
+ public bool FitToPage
+ {
+ get {return m_bFitToPage;}
+ set {m_bFitToPage=value;}
+ }
+
+ /// <summary>
+ /// Gets or sets the title to dispaly as page header in the printed list
+ /// </summary>
+ /// <value>
+ /// A <see cref="string"/> the represents the title printed as page header.
+ /// </value>
+ public string Title
+ {
+ get {return m_strTitle;}
+ set {m_strTitle=value;}
+ }
+ #endregion
+
+ public PrintableListView()
+ {
+ // This call is required by the Windows.Forms Form Designer.
+ InitializeComponent();
+
+ m_printDoc.BeginPrint += new PrintEventHandler(OnBeginPrint);
+ m_printDoc.PrintPage += new PrintPageEventHandler(OnPrintPage);
+
+ m_setupDlg.Document = m_printDoc;
+ m_previewDlg.Document = m_printDoc;
+ m_printDlg.Document = m_printDoc;
+
+ m_printDlg.AllowSomePages = false;
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if( components != null )
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Component Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+ #endregion
+
+ /// <summary>
+ /// Show the standard page setup dialog box that lets the user specify
+ /// margins, page orientation, page sources, and paper sizes.
+ /// </summary>
+ public void PageSetup()
+ {
+ m_setupDlg.ShowDialog();
+ }
+
+ /// <summary>
+ /// Show the standard print preview dialog box.
+ /// </summary>
+ public void PrintPreview()
+ {
+ m_printDoc.DocumentName = "List View";
+
+ m_nPageNumber = 1;
+ m_bPrintSel = false;
+
+ m_previewDlg.ShowDialog(this);
+ }
+
+ /// <summary>
+ /// Start the print process.
+ /// </summary>
+ public void Print()
+ {
+ m_printDlg.AllowSelection = this.SelectedItems.Count>0;
+
+ // Show the standard print dialog box, that lets the user select a printer
+ // and change the settings for that printer.
+ if (m_printDlg.ShowDialog(this) == DialogResult.OK)
+ {
+ m_printDoc.DocumentName = m_strTitle;
+
+ m_bPrintSel = m_printDlg.PrinterSettings.PrintRange==PrintRange.Selection;
+
+ m_nPageNumber = 1;
+
+ // Start print
+ m_printDoc.Print();
+ }
+ }
+
+ #region Events Handlers
+ private void OnBeginPrint(object sender, PrintEventArgs e)
+ {
+ PreparePrint();
+ }
+
+ private void OnPrintPage(object sender, PrintPageEventArgs e)
+ {
+ int nNumItems = GetItemsCount(); // Number of items to print
+
+ if (nNumItems==0 || m_nStartRow>=nNumItems)
+ {
+ e.HasMorePages = false;
+ return;
+ }
+
+ int nNextStartCol = 0; // First column exeeding the page width
+ float x = 0.0f; // Current horizontal coordinate
+ float y = 0.0f; // Current vertical coordinate
+ float cx = 4.0f; // The horizontal space, in hundredths of an inch,
+ // of the padding between items text and
+ // their cell boundaries.
+ float fScale = 1.0f; // Scale factor when fit to page is enabled
+ float fRowHeight = 0.0f; // The height of the current row
+ float fColWidth = 0.0f; // The width of the current column
+
+ RectangleF rectFull; // The full available space
+ RectangleF rectBody; // Area for the list items
+
+ bool bUnprintable = false;
+
+ Graphics g = e.Graphics;
+
+ if (g.VisibleClipBounds.X<0) // Print preview
+ {
+ rectFull = e.MarginBounds;
+
+ // Convert to hundredths of an inch
+ rectFull = new RectangleF(rectFull.X/m_fDpi*100.0f,
+ rectFull.Y/m_fDpi*100.0f,
+ rectFull.Width/m_fDpi*100.0f,
+ rectFull.Height/m_fDpi*100.0f);
+ }
+ else // Print
+ {
+ // Printable area (approximately) of the page, taking into account the user margins
+ rectFull = new RectangleF(
+ e.MarginBounds.Left - (e.PageBounds.Width - g.VisibleClipBounds.Width)/2,
+ e.MarginBounds.Top - (e.PageBounds.Height - g.VisibleClipBounds.Height)/2,
+ e.MarginBounds.Width,
+ e.MarginBounds.Height);
+ }
+
+ rectBody = RectangleF.Inflate(rectFull, 0, -2*Font.GetHeight(g));
+
+ // Display title at top
+ StringFormat sfmt = new StringFormat();
+ sfmt.Alignment = StringAlignment.Center;
+ g.DrawString(m_strTitle, Font, Brushes.Black, rectFull, sfmt);
+
+ // Display page number at bottom
+ sfmt.LineAlignment = StringAlignment.Far;
+ g.DrawString("Page " + m_nPageNumber, Font, Brushes.Black, rectFull, sfmt);
+
+ if (m_nStartCol==0 && m_bFitToPage && m_fListWidth>rectBody.Width)
+ {
+ // Calculate scale factor
+ fScale = rectBody.Width / m_fListWidth;
+ }
+
+ // Scale the printable area
+ rectFull = new RectangleF(rectFull.X/fScale,
+ rectFull.Y/fScale,
+ rectFull.Width/fScale,
+ rectFull.Height/fScale);
+
+ rectBody = new RectangleF(rectBody.X/fScale,
+ rectBody.Y/fScale,
+ rectBody.Width/fScale,
+ rectBody.Height/fScale);
+
+ // Setting scale factor and unit of measure
+ g.ScaleTransform(fScale, fScale);
+ g.PageUnit = GraphicsUnit.Inch;
+ g.PageScale = 0.01f;
+
+ // Start print
+ nNextStartCol=0;
+ y = rectBody.Top;
+
+ // Columns headers ----------------------------------------
+ Brush brushHeader = new SolidBrush(Color.LightGray);
+ Font fontHeader = new Font(this.Font, FontStyle.Bold);
+ fRowHeight = fontHeader.GetHeight(g)*3.0f;
+ x = rectBody.Left;
+
+ for (int i=m_nStartCol; i<Columns.Count; i++)
+ {
+ ColumnHeader ch = Columns[i];
+ fColWidth = m_arColsWidth[i];
+
+ if ( (x + fColWidth) <= rectBody.Right)
+ {
+ // Rectangle
+ g.FillRectangle(brushHeader, x, y, fColWidth, fRowHeight);
+ g.DrawRectangle(Pens.Black, x, y, fColWidth, fRowHeight);
+
+ // Text
+ StringFormat sf = new StringFormat();
+ if (ch.TextAlign == HorizontalAlignment.Left)
+ sf.Alignment = StringAlignment.Near;
+ else if (ch.TextAlign == HorizontalAlignment.Center)
+ sf.Alignment = StringAlignment.Center;
+ else
+ sf.Alignment = StringAlignment.Far;
+
+ sf.LineAlignment = StringAlignment.Center;
+ sf.FormatFlags = StringFormatFlags.NoWrap;
+ sf.Trimming = StringTrimming.EllipsisCharacter;
+
+ RectangleF rectText = new RectangleF(x+cx, y, fColWidth-1-2*cx, fRowHeight);
+ g.DrawString(ch.Text, fontHeader, Brushes.Black, rectText, sf);
+ x += fColWidth;
+ }
+ else
+ {
+ if (i==m_nStartCol)
+ bUnprintable=true;
+
+ nNextStartCol=i;
+ break;
+ }
+ }
+ y += fRowHeight;
+
+ // Rows ---------------------------------------------------
+ int nRow = m_nStartRow;
+ bool bEndOfPage = false;
+ while (!bEndOfPage && nRow<nNumItems)
+ {
+ ListViewItem item = GetItem(nRow);
+
+ fRowHeight = item.Bounds.Height/m_fDpi*100.0f + 5.0f;
+
+ if (y+fRowHeight>rectBody.Bottom)
+ {
+ bEndOfPage=true;
+ }
+ else
+ {
+ x = rectBody.Left;
+
+ for (int i=m_nStartCol; i<Columns.Count; i++)
+ {
+ ColumnHeader ch = Columns[i];
+ fColWidth = m_arColsWidth[i];
+
+ if ( (x + fColWidth) <= rectBody.Right)
+ {
+ // Rectangle
+ g.DrawRectangle(Pens.Black, x, y, fColWidth, fRowHeight);
+
+ // Text
+ StringFormat sf = new StringFormat();
+ if (ch.TextAlign == HorizontalAlignment.Left)
+ sf.Alignment = StringAlignment.Near;
+ else if (ch.TextAlign == HorizontalAlignment.Center)
+ sf.Alignment = StringAlignment.Center;
+ else
+ sf.Alignment = StringAlignment.Far;
+
+ sf.LineAlignment = StringAlignment.Center;
+ sf.FormatFlags = StringFormatFlags.NoWrap;
+ sf.Trimming = StringTrimming.EllipsisCharacter;
+
+ // Text
+ string strText = i==0 ? item.Text : item.SubItems[i].Text;
+ Font font = i==0 ? item.Font : item.SubItems[i].Font;
+
+ RectangleF rectText = new RectangleF(x+cx, y, fColWidth-1-2*cx, fRowHeight);
+ g.DrawString(strText, font, Brushes.Black, rectText, sf);
+ x += fColWidth;
+ }
+ else
+ {
+ nNextStartCol=i;
+ break;
+ }
+ }
+
+ y += fRowHeight;
+ nRow++;
+ }
+ }
+
+ if (nNextStartCol==0)
+ m_nStartRow = nRow;
+
+ m_nStartCol = nNextStartCol;
+
+ m_nPageNumber++;
+
+ e.HasMorePages = (!bUnprintable && (m_nStartRow>0 && m_nStartRow<nNumItems) || m_nStartCol>0);
+
+ if (!e.HasMorePages)
+ {
+ m_nPageNumber=1;
+ m_nStartRow=0;
+ m_nStartCol=0;
+ }
+
+ brushHeader.Dispose();
+ }
+ #endregion
+
+ private int GetItemsCount()
+ {
+ return m_bPrintSel ? SelectedItems.Count : Items.Count;
+ }
+
+ private ListViewItem GetItem(int index)
+ {
+ return m_bPrintSel ? SelectedItems[index] : Items[index];
+ }
+
+ private void PreparePrint()
+ {
+ // Gets the list width and the columns width in units of hundredths of an inch.
+ this.m_fListWidth = 0.0f;
+ this.m_arColsWidth = new float[this.Columns.Count];
+
+ Graphics g = CreateGraphics();
+ m_fDpi = g.DpiX;
+ g.Dispose();
+
+ for (int i=0; i<Columns.Count; i++)
+ {
+ ColumnHeader ch = Columns[i];
+ float fWidth = ch.Width/m_fDpi*100 + 1; // Column width + separator
+ m_fListWidth += fWidth;
+ m_arColsWidth[i] = fWidth;
+ }
+ m_fListWidth += 1; // separator
+ }
+
+ }
+}
diff --git a/AnnuiteitenFormApp/PrintableListView.resx b/AnnuiteitenFormApp/PrintableListView.resx
new file mode 100644
index 0000000..3f337e0
--- /dev/null
+++ b/AnnuiteitenFormApp/PrintableListView.resx
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="ResMimeType">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="Version">
+ <value>1.0.0.0</value>
+ </resheader>
+ <resheader name="Reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="Writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
diff --git a/AnnuiteitenFormApp/Program.cs b/AnnuiteitenFormApp/Program.cs
new file mode 100644
index 0000000..13c9e81
--- /dev/null
+++ b/AnnuiteitenFormApp/Program.cs
@@ -0,0 +1,22 @@
+using System.Globalization;
+
+namespace AnnuiteitenFormApp
+{
+ internal static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL", false);
+ Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-NL", false);
+
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form1());
+ }
+ }
+}
\ No newline at end of file