| redbull (3) | |
|
#pragma 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> void InitializeComponent(void) { this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox()); this->groupBox2 = (gcnew System::Windows::Forms::GroupBox()); this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip()); this->toolStripMenuItemFile = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuNew = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuOpen = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuItemSave = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuItemSaveAS = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuItemPrint = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuItemExit = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuItemHelp = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->toolStripMenuHelp = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog()); this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox()); this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->BeginInit(); this->groupBox2->SuspendLayout(); this->menuStrip1->SuspendLayout(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit(); this->groupBox1->SuspendLayout(); this->SuspendLayout(); // // pictureBox2 // this->pictureBox2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None; this->pictureBox2->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; this->pictureBox2->Location = System::Drawing::Point(20, 30); this->pictureBox2->Name = L"pictureBox2"; this->pictureBox2->Size = System::Drawing::Size(512, 512); this->pictureBox2->TabIndex = 0; this->pictureBox2->TabStop = false; // // groupBox2 // this->groupBox2->Controls->Add(this->pictureBox2); this->groupBox2->FlatStyle = System::Windows::Forms::FlatStyle::Popup; this->groupBox2->Location = System::Drawing::Point(619, 67); this->groupBox2->Name = L"groupBox2"; this->groupBox2->Size = System::Drawing::Size(555, 562); this->groupBox2->TabIndex = 6; this->groupBox2->TabStop = false; this->groupBox2->Text = L"Output Image"; // // menuStrip1 // this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripMenuItemFile, this->toolStripMenuItemHelp}); this->menuStrip1->Location = System::Drawing::Point(0, 0); this->menuStrip1->Name = L"menuStrip1"; this->menuStrip1->Size = System::Drawing::Size(1206, 24); this->menuStrip1->TabIndex = 4; this->menuStrip1->Text = L"menuStrip1"; // // toolStripMenuItemFile // this->toolStripMenuItemFile->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {this->toolStripMenuNew, this->toolStripMenuOpen, this->toolStripMenuItemSave, this->toolStripMenuItemSaveAS, this->toolStripMenuItemPrint, this->toolStripMenuItemExit}); this->toolStripMenuItemFile->Name = L"toolStripMenuItemFile"; this->toolStripMenuItemFile->Size = System::Drawing::Size(35, 20); this->toolStripMenuItemFile->Text = L"&File"; // // toolStripMenuNew // this->toolStripMenuNew->Name = L"toolStripMenuNew"; this->toolStripMenuNew->Size = System::Drawing::Size(152, 22); this->toolStripMenuNew->Text = L"&New"; // // toolStripMenuOpen // this->toolStripMenuOpen->Name = L"toolStripMenuOpen"; this->toolStripMenuOpen->Size = System::Drawing::Size(152, 22); this->toolStripMenuOpen->Text = L"&Open"; this->toolStripMenuOpen->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuOpen_Click); // // toolStripMenuItemSave // this->toolStripMenuItemSave->Name = L"toolStripMenuItemSave"; this->toolStripMenuItemSave->Size = System::Drawing::Size(152, 22); this->toolStripMenuItemSave->Text = L"&Save"; // // toolStripMenuItemSaveAS // this->toolStripMenuItemSaveAS->Name = L"toolStripMenuItemSaveAS"; this->toolStripMenuItemSaveAS->Size = System::Drawing::Size(152, 22); this->toolStripMenuItemSaveAS->Text = L"Save &As"; // // toolStripMenuItemPrint // this->toolStripMenuItemPrint->Name = L"toolStripMenuItemPrint"; this->toolStripMenuItemPrint->Size = System::Drawing::Size(152, 22); this->toolStripMenuItemPrint->Text = L"&Print"; // // toolStripMenuItemExit // this->toolStripMenuItemExit->Name = L"toolStripMenuItemExit"; this->toolStripMenuItemExit->Size = System::Drawing::Size(152, 22); this->toolStripMenuItemExit->Text = L"&Exit"; // // toolStripMenuItemHelp // this->toolStripMenuItemHelp->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->toolStripMenuHelp}); this->toolStripMenuItemHelp->Name = L"toolStripMenuItemHelp"; this->toolStripMenuItemHelp->Size = System::Drawing::Size(40, 20); this->toolStripMenuItemHelp->Text = L"&Help"; // // toolStripMenuHelp // this->toolStripMenuHelp->Name = L"toolStripMenuHelp"; this->toolStripMenuHelp->Size = System::Drawing::Size(165, 22); this->toolStripMenuHelp->Text = L"About the Program"; // // openFileDialog1 // this->openFileDialog1->FileName = L"openFileDialog1"; // // pictureBox1 // this->pictureBox1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None; this->pictureBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; this->pictureBox1->Location = System::Drawing::Point(20, 30); this->pictureBox1->Name = L"pictureBox1"; this->pictureBox1->Size = System::Drawing::Size(512, 512); this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::AutoSize; this->pictureBox1->TabIndex = 0; this->pictureBox1->TabStop = false; // // groupBox1 // this->groupBox1->Controls->Add(this->pictureBox1); this->groupBox1->FlatStyle = System::Windows::Forms::FlatStyle::Popup; this->groupBox1->Location = System::Drawing::Point(12, 67); this->groupBox1->Name = L"groupBox1"; this->groupBox1->Size = System::Drawing::Size(555, 562); this->groupBox1->TabIndex = 5; this->groupBox1->TabStop = false; this->groupBox1->Text = L"Test Image"; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1206, 718); this->Controls->Add(this->groupBox2); this->Controls->Add(this->groupBox1); this->Controls->Add(this->menuStrip1); this->Name = L"Form1"; this->Text = L"Form1"; (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->EndInit(); this->groupBox2->ResumeLayout(false); this->menuStrip1->ResumeLayout(false); this->menuStrip1->PerformLayout(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit(); this->groupBox1->ResumeLayout(false); this->groupBox1->PerformLayout(); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void toolStripMenuOpen_Click(System::Object^ sender, System::EventArgs^ e) { PictureBox ^picturebox1 = gcnew PictureBox(); OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog(); openFileDialog1 ->Filter = "Jpeg |*.Jpg"; openFileDialog1 ->Title = "Select a Jpeg File"; //Show the openFileDialog if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) { filename = openFileDialog1->FileName; picturebox1->ImageLocation = Bitmap::FromFile(); } else { return; } Controls->Add(pictureBox1); } }; } Is there anyone who could fix my problem in loading the picture in picture box using open button in the menu bar. because it always says "filename" has the problem. filename = openFileDialog1->FileName; picturebox1->ImageLocation = Bitmap::FromFile(); I dont know why it is not working. | |
|
|
|
| samrux (132) | |||
FOR THE LOVE OF GOD, PLEASE USE CODE TAGS:
| |||
|
|
|||
| Moschops (5961) | |
| This looks like some kind of Microsoft .NET or managed language. It is not C++. Try the windows section, where some people might be familiar with whatever libraries/runtime you're using, or if that doesn't work, find a forum for whatever this language is. | |
|
|
|
| redbull (3) | |
| oh thank you so much for your help. i really really appreciate it a lot. I admit that i am a newbie in c++ programming and in this group also. I will read it carefully ^_^ | |
|
|
|
| naraku9333 (923) | |
Try changing picturebox1->ImageLocation = Bitmap::FromFile(); to picturebox1->Image = Bitmap::FromFile(filename);
| |
|
|
|