namespace PictureViever { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void tableLayoutPanel2_Paint(object sender, PaintEventArgs e) { } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked) pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; else pictureBox1.SizeMode = PictureBoxSizeMode.Normal; } private void clearButton_Click(object sender, EventArgs e) { pictureBox1.Image = null; } private void backgroundButton_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.BackColor = colorDialog1.Color; } } private void closeButton_Click(object sender, EventArgs e) { this.Close(); } private void pictureBox1_Click(object sender, EventArgs e) { } private void showButton_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.Load(openFileDialog1.FileName); } } } } namespace PictureViever { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { tableLayoutPanel1 = new TableLayoutPanel(); pictureBox1 = new PictureBox(); checkBox1 = new CheckBox(); flowLayoutPanel1 = new FlowLayoutPanel(); showButton = new Button(); clearButton = new Button(); backgroungButton = new Button(); closeButton = new Button(); openFileDialog1 = new OpenFileDialog(); colorDialog1 = new ColorDialog(); tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); flowLayoutPanel1.SuspendLayout(); SuspendLayout(); // // tableLayoutPanel1 // tableLayoutPanel1.ColumnCount = 2; tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F)); tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 85F)); tableLayoutPanel1.Controls.Add(pictureBox1, 0, 0); tableLayoutPanel1.Controls.Add(checkBox1, 0, 1); tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 1, 1); tableLayoutPanel1.Dock = DockStyle.Fill; tableLayoutPanel1.Location = new Point(0, 0); tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.RowCount = 2; tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 90F)); tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 10F)); tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F)); tableLayoutPanel1.Size = new Size(722, 474); tableLayoutPanel1.TabIndex = 0; // // pictureBox1 // pictureBox1.BorderStyle = BorderStyle.Fixed3D; tableLayoutPanel1.SetColumnSpan(pictureBox1, 2); pictureBox1.Dock = DockStyle.Fill; pictureBox1.Location = new Point(3, 3); pictureBox1.Name = "pictureBox1"; pictureBox1.Size = new Size(716, 420); pictureBox1.TabIndex = 0; pictureBox1.TabStop = false; pictureBox1.Click += pictureBox1_Click; // // checkBox1 // checkBox1.AutoSize = true; checkBox1.Location = new Point(3, 429); checkBox1.Name = "checkBox1"; checkBox1.Size = new Size(63, 19); checkBox1.TabIndex = 1; checkBox1.Text = "Stretch"; checkBox1.UseVisualStyleBackColor = true; checkBox1.CheckedChanged += checkBox1_CheckedChanged; // // flowLayoutPanel1 // flowLayoutPanel1.Controls.Add(showButton); flowLayoutPanel1.Controls.Add(clearButton); flowLayoutPanel1.Controls.Add(backgroungButton); flowLayoutPanel1.Controls.Add(closeButton); flowLayoutPanel1.Dock = DockStyle.Fill; flowLayoutPanel1.FlowDirection = FlowDirection.RightToLeft; flowLayoutPanel1.Location = new Point(111, 429); flowLayoutPanel1.Name = "flowLayoutPanel1"; flowLayoutPanel1.Size = new Size(608, 42); flowLayoutPanel1.TabIndex = 2; // // showButton // showButton.AutoSize = true; showButton.Location = new Point(478, 3); showButton.Name = "showButton"; showButton.Size = new Size(127, 25); showButton.TabIndex = 0; showButton.Text = "Pokaz obraz"; showButton.UseVisualStyleBackColor = true; showButton.Click += showButton_Click; // // clearButton // clearButton.AutoSize = true; clearButton.Location = new Point(366, 3); clearButton.Name = "clearButton"; clearButton.Size = new Size(106, 25); clearButton.TabIndex = 1; clearButton.Text = "Wyczysc obraz"; clearButton.UseVisualStyleBackColor = true; clearButton.Click += clearButton_Click; // // backgroundButton // backgroungButton.AutoSize = true; backgroungButton.Location = new Point(257, 3); backgroungButton.Name = "backgroungButton"; backgroungButton.Size = new Size(103, 25); backgroungButton.TabIndex = 2; backgroungButton.Text = "Ustaw kolor"; backgroungButton.UseVisualStyleBackColor = true; backgroungButton.Click += backgroundButton_Click; // // closeButton // closeButton.AutoSize = true; closeButton.Location = new Point(176, 3); closeButton.Name = "closeButton"; closeButton.Size = new Size(75, 25); closeButton.TabIndex = 3; closeButton.Text = "Zamknij"; closeButton.UseVisualStyleBackColor = true; closeButton.Click += closeButton_Click; // // openFileDialog1 // openFileDialog1.FileName = "openFileDialog1"; openFileDialog1.Filter = "JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png|BMP Files (*.bmp)|*.bmp|All files (*.*)|*.*"; openFileDialog1.Title = "Wybierz plik obrazu"; // // Form1 // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(722, 474); Controls.Add(tableLayoutPanel1); Name = "Form1"; Text = "Przegladarka obrazow"; tableLayoutPanel1.ResumeLayout(false); tableLayoutPanel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); flowLayoutPanel1.ResumeLayout(false); flowLayoutPanel1.PerformLayout(); ResumeLayout(false); } #endregion private TableLayoutPanel tableLayoutPanel1; private PictureBox pictureBox1; private CheckBox checkBox1; private FlowLayoutPanel flowLayoutPanel1; private Button showButton; private Button clearButton; private Button backgroungButton; private Button closeButton; private OpenFileDialog openFileDialog1; private ColorDialog colorDialog1; } }