Majdnem kész

This commit is contained in:
István Priskin 2022-04-11 14:55:02 +02:00
parent 9e89b3afb7
commit f25c318871
4 changed files with 93 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace Cukraszda
Console.WriteLine(segedtomb.Length); Console.WriteLine(segedtomb.Length);
sutemenyekToolStripMenuItem.Enabled = true; sutemenyekToolStripMenuItem.Enabled = true;
//sutemenyekToolStripMenuItem_Click(this, null); sutemenyekToolStripMenuItem_Click(this, null);
} }
} }

View File

@ -29,9 +29,14 @@ namespace Cukraszda
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.sToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel1 // tableLayoutPanel1
@ -45,12 +50,13 @@ namespace Cukraszda
this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(453, 426); this.tableLayoutPanel1.Size = new System.Drawing.Size(453, 259);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(176, 498); this.button1.ContextMenuStrip = this.contextMenuStrip1;
this.button1.Location = new System.Drawing.Point(181, 527);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1; this.button1.TabIndex = 1;
@ -67,16 +73,41 @@ namespace Cukraszda
this.label1.TabIndex = 2; this.label1.TabIndex = 2;
this.label1.Text = "ÁRLISTA"; this.label1.Text = "ÁRLISTA";
// //
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(22, 329);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(418, 176);
this.richTextBox1.TabIndex = 3;
this.richTextBox1.Text = "";
this.richTextBox1.Visible = false;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
//
// sToolStripMenuItem
//
this.sToolStripMenuItem.Name = "sToolStripMenuItem";
this.sToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.sToolStripMenuItem.Text = "Számlát kér";
this.sToolStripMenuItem.Click += new System.EventHandler(this.sToolStripMenuItem_Click);
//
// Rendelo // Rendelo
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(478, 562); this.ClientSize = new System.Drawing.Size(478, 562);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Rendelo"; this.Name = "Rendelo";
this.Text = "ItallapForm"; this.Text = "ItallapForm";
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -87,5 +118,8 @@ namespace Cukraszda
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem sToolStripMenuItem;
} }
} }

View File

@ -12,6 +12,9 @@ namespace Cukraszda
{ {
public partial class Rendelo : Form public partial class Rendelo : Form
{ {
bool nincsjelolve;
String[,] sutiktomb;
public Rendelo() public Rendelo()
{ {
InitializeComponent(); InitializeComponent();
@ -19,17 +22,19 @@ namespace Cukraszda
public void setSuti(String[,] tomb) public void setSuti(String[,] tomb)
{ {
for (int i = 0; i < tomb.Length; i++) sutiktomb = tomb;
for (int i = 0; i < tomb.GetLength(0); i++)
{ {
CheckBox cb = new CheckBox(); CheckBox cb = new CheckBox();
cb.Size = new Size(300,25); cb.Size = new Size(300,25);
cb.Text = tomb[i,0]+" ("+tomb[i,1]+" Ft)"; cb.Text = tomb[i,0]+" ("+tomb[i,1]+" Ft)";
cb.Tag = i;
tableLayoutPanel1.Controls.Add(cb, 0, i); tableLayoutPanel1.Controls.Add(cb, 0, i);
TextBox tb = new TextBox(); TextBox tb = new TextBox();
tb.Size = new Size(30, 25); tb.Size = new Size(30, 25);
tableLayoutPanel1.Controls.Add(tb, 1, i); tableLayoutPanel1.Controls.Add(tb, 1, i);
tb.Tag = tomb[i, 1];
cb.Tag = tb;
Label label = new Label(); Label label = new Label();
label.Text = " adag"; label.Text = " adag";
@ -39,7 +44,53 @@ namespace Cukraszda
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
nincsjelolve = true;
foreach (var item in tableLayoutPanel1.Controls)
{
if ( item is CheckBox)
{
if( (item as CheckBox).Checked) nincsjelolve=false;
}
}
if (nincsjelolve) MessageBox.Show("Nincs jelölt süti!", "Hiba!", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
private void sToolStripMenuItem_Click(object sender, EventArgs e)
{
button1_Click(sender, e);
if(!nincsjelolve)
{
string[] sorok = new string[tableLayoutPanel1.RowCount+10];
sorok[0] = "SZÁMLA";
sorok[1] = "";
int sox = 2;
foreach (var item in tableLayoutPanel1.Controls)
{
if (item is CheckBox)
{
CheckBox cb = (CheckBox)item;
if (cb.Checked)
{
TextBox tb = (TextBox)cb.Tag;
if (tb.Text.Length>0)
{
int darab = int.Parse(tb.Text);
int ear = int.Parse((String)tb.Tag);
sorok[sox] = $"{cb.Text,-50} {ear,4} {darab,2} db {darab*ear,6}";
sox++;
}
}
}
}
richTextBox1.Lines = sorok;
richTextBox1.Visible = true;
}
}
} }
} }

View File

@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>