| | |
Please help me find problem in code :)
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
this is the code
I want to be able to press a button after the bitmap,jpeg ect. has been loaded into the picturebox, and it spit it out as an icon. This works for the other formats. It doest work for this one, it says its an icon on it but u cant see the picture like you should be able to.
(The different color is where i think my problem is)
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Runtime.InteropServices; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // TODO: } private void button1_Click(object sender, EventArgs e) { try { // Create the OpenFileDialog object OpenFileDialog myOpenFileDialog = new OpenFileDialog(); myOpenFileDialog.Filter = "*.bmp|*.bmp|*.ico|*ico|*.jpg|*.jpg|*.gif|*.gif|*.pic|*.pic|*.tif|*.tif|*.png|*.png|*.qtif|*.qtif|*.*|*.*"; // Set properties appropriate. myOpenFileDialog.CheckFileExists = true; myOpenFileDialog.DefaultExt = "bmp"; myOpenFileDialog.InitialDirectory = @"C:\"; myOpenFileDialog.Multiselect = false; // Use the OpenFileDialog and put the path and name of the // selected file in the txtFileName text box. if (myOpenFileDialog.ShowDialog() == DialogResult.OK) { this.txtFileName.Text = myOpenFileDialog.FileName; } } catch { // } } private void folderBrowserDialog1_HelpRequest(object sender, EventArgs e) { // } private void button2_Click(object sender, EventArgs e) { // } private void txtFileName_TextChanged(object sender, EventArgs e) { // } private void button3_Click(object sender, EventArgs e) { try { string J = Convert.ToString(txtFileName.Text); if (J == "") { } else { pictureBox1.Image = Image.FromFile(Convert.ToString(txtFileName.Text)); } } catch { // } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { // } private void checkBox1_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog1.ShowDialog() == DialogResult.OK) File.Copy(txtFileName.Text, saveFileDialog1.FileName); } catch { // } } private void checkBox2_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog2.ShowDialog() == DialogResult.OK) saveFileDialog2.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog2.FileName); } catch { // } } private void checkBox3_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog3.ShowDialog() == DialogResult.OK) saveFileDialog3.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog3.FileName); } catch { // } } private void button4_Click(object sender, EventArgs e) { try { } catch { MessageBox.Show("ERROR: Please make sure path is valid"); } } private void button5_Click(object sender, EventArgs e) { // } private void button5_Click_1(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { } } private void saveFileDialog1_FileOk(object sender, CancelEventArgs e) { } private void label3_Click(object sender, EventArgs e) { // } private void button4_Click_1(object sender, EventArgs e) { pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); pictureBox1.Refresh(); } private void checkBox4_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog4.ShowDialog() == DialogResult.OK) saveFileDialog4.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog4.FileName); } catch { // } } private void checkBox5_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog5.ShowDialog() == DialogResult.OK) saveFileDialog5.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog5.FileName); } catch { // } } private void checkBox6_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog6.ShowDialog() == DialogResult.OK) saveFileDialog6.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog6.FileName); } catch { } } private void checkBox7_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog7.ShowDialog() == DialogResult.OK) saveFileDialog7.Filter = "*.WPC|*.WPC"; File.Copy(txtFileName.Text, saveFileDialog7.FileName); } catch { } } private void checkBox8_CheckedChanged(object sender, EventArgs e) { try { if (saveFileDialog8.ShowDialog() == DialogResult.OK) saveFileDialog8.Filter = "*.qtif|*.qtif"; File.Copy(txtFileName.Text, saveFileDialog8.FileName); } catch { } } private void customConversionToolStripMenuItem_Click(object sender, EventArgs e) { try { if (saveFileDialog9.ShowDialog() == DialogResult.OK) saveFileDialog9.Filter = "*.qtif|*.qtif"; File.Copy(txtFileName.Text, saveFileDialog9.FileName); } catch { } } private void aboutToolStripMenuItem1_Click(object sender, EventArgs e) { MessageBox.Show("Image Tweaker: By GHOST"); } private void pictureBox1_Click(object sender, EventArgs e) { } private void copytoClipboardToolStripMenuItem_Click(object sender, EventArgs e) { DataObject myDataObject = new DataObject(); myDataObject.SetData(DataFormats.Bitmap, true, pictureBox1.Image); Clipboard.SetDataObject(myDataObject, true); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { frmAbout frm = new frmAbout(); frm.ShowDialog(this); frm.Dispose(); } private void button4_Click_2(object sender, EventArgs e) { try { pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX); pictureBox1.Refresh(); } catch { // } } private void button5_Click_2(object sender, EventArgs e) { pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); pictureBox1.Refresh(); } private void button6_Click(object sender, EventArgs e) { pictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipXY); pictureBox1.Refresh(); } private void button7_Click(object sender, EventArgs e) { pictureBox1.Image.RotateFlip(RotateFlipType.Rotate270FlipXY); pictureBox1.Refresh(); } private void saveEditsToolStripMenuItem_Click(object sender, EventArgs e) { try { saveFileDialog10.Filter = "*.jpg|*.jpg|*.bmp|*.bmp|*.gif|*.gif"; saveFileDialog10.ShowDialog(); if (saveFileDialog1.FileName != "") { System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog10.OpenFile(); switch (saveFileDialog10.FilterIndex) { case 1: this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg); break; case 2: this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp); break; case 3: this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Gif); break; } fs.Close(); } } catch { MessageBox.Show("there is no Pic selected please select a Pic first", "Dear " + System.Environment.UserDomainName); } } private void hhToolStripMenuItem_Click(object sender, EventArgs e) { saveFileDialog11.Filter = "*.ico|*.ico"; saveFileDialog11.ShowDialog(); System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog11.OpenFile(); this.pictureBox1.Image.Save(saveFileDialog11.FileName); } } }
I want to be able to press a button after the bitmap,jpeg ect. has been loaded into the picturebox, and it spit it out as an icon. This works for the other formats. It doest work for this one, it says its an icon on it but u cant see the picture like you should be able to.
(The different color is where i think my problem is)
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes
Member - Alliance of Security Analysis Professionals - Since 2006
Ewido
Tune up windows
Get detailed system information
My Fixes
Member - Alliance of Security Analysis Professionals - Since 2006
![]() |
Similar Threads
- send email with attachment (PHP)
- Find out the problem of my code. (Java)
- Why this code cant work ???? (ASP.NET)
- non-lvalue in assignment (C)
- find out the error in my code (Java)
- resource problem code 12 (Troubleshooting Dead Machines)
Other Threads in the C# Forum
- Previous Thread: Textbox quotes and send
- Next Thread: hi can someone teach me how to link my forms?
| Thread Tools | Search this Thread |
.net access algorithm array asp.net bitmap box broadcast c# check checkbox client combobox control conversion csharp database datagrid datagridview dataset datetime dbconnection decryption degrees design developer draganddrop drawing encryption enum eventhandlers excel file firefox focus form format forms function gdi+ grantorrevokepermissionthroughc#.net hospitalmanagementsystem image input install interface java libraries list loop marshalbyrefobject math mouseclick movingimage mysql netcfsvcutil.exe numeric operator path photoshop php picturebox pixelinversion platform polynomial post programming properties radians read regex remote remoting richtextbox server sleep socket sql statistics string stringformatting study system.servicemodel table tcpclientchannel text textbox thread time timer update usb usercontrol validation visualstudio webbrowser winforms wpf wpfc# xml






