OK
So I am learning c++ and I have created my design using the windows forms,
I now have to do the coding,
I have implemented a code which is returning a nice amount of 102 errors,
Any help would be appreciated or rewarded.
I look forward to learning from an experienced user.
#pragma once
namespace waveplayer {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Panel^ panel1;
protected:
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::TabControl^ tabControl1;
private: System::Windows::Forms::TabPage^ tabPage1;
private: System::Windows::Forms::ListBox^ listBox1;
private: System::Windows::Forms::TabPage^ tabPage2;
private: System::Windows::Forms::Button^ button8;
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
private: System::Windows::Forms::Button^ button7;
private: System::Windows::Forms::Button^ button6;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Button^ button3;
private: AxWMPLib::AxWindowsMediaPlayer^ axWindowsMediaPlayer1;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#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)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
this->button8 = (gcnew System::Windows::Forms::Button());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->button7 = (gcnew System::Windows::Forms::Button());
this->button6 = (gcnew System::Windows::Forms::Button());
this->button5 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->axWindowsMediaPlayer1 = (gcnew AxWMPLib::AxWindowsMediaPlayer());
this->panel1->SuspendLayout();
this->tabControl1->SuspendLayout();
this->tabPage1->SuspendLayout();
this->tabPage2->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axWindowsMediaPlayer1))->BeginInit();
this->SuspendLayout();
//
// panel1
//
this->panel1->BackColor = System::Drawing::Color::White;
this->panel1->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"panel1.BackgroundImage")));
this->panel1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->panel1->Controls->Add(this->label1);
this->panel1->Controls->Add(this->button1);
this->panel1->Controls->Add(this->button2);
this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
this->panel1->Location = System::Drawing::Point(0, 0);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(555, 107);
this->panel1->TabIndex = 1;
//
// label1
//
this->label1->AutoSize = true;
this->label1->BackColor = System::Drawing::Color::Transparent;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 22, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->ForeColor = System::Drawing::SystemColors::ActiveCaption;
this->label1->Location = System::Drawing::Point(245, 0);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(186, 36);
this->label1->TabIndex = 3;
this->label1->Text = L"Music Player";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// button1
//
this->button1->Location = System::Drawing::Point(442, 3);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(21, 38);
this->button1->TabIndex = 1;
this->button1->Text = L"_";
this->button1->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
this->button1->UseVisualStyleBackColor = true;
//
// button2
//
this->button2->Location = System::Drawing::Point(469, 3);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(22, 38);
this->button2->TabIndex = 2;
this->button2->Text = L"X";
this->button2->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
this->button2->UseVisualStyleBackColor = true;
//
// tabControl1
//
this->tabControl1->Controls->Add(this->tabPage1);
this->tabControl1->Controls->Add(this->tabPage2);
this->tabControl1->Location = System::Drawing::Point(10, 161);
this->tabControl1->Name = L"tabControl1";
this->tabControl1->SelectedIndex = 0;
this->tabControl1->Size = System::Drawing::Size(533, 199);
this->tabControl1->TabIndex = 14;
//
// tabPage1
//
this->tabPage1->Controls->Add(this->listBox1);
this->tabPage1->Location = System::Drawing::Point(4, 22);
this->tabPage1->Name = L"tabPage1";
this->tabPage1->Padding = System::Windows::Forms::Padding(3);
this->tabPage1->Size = System::Drawing::Size(525, 173);
this->tabPage1->TabIndex = 0;
this->tabPage1->Text = L"Library";
this->tabPage1->UseVisualStyleBackColor = true;
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(3, 3);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(526, 212);
this->listBox1->TabIndex = 0;
//
// tabPage2
//
this->tabPage2->Controls->Add(this->axWindowsMediaPlayer1);
this->tabPage2->Location = System::Drawing::Point(4, 22);
this->tabPage2->Name = L"tabPage2";
this->tabPage2->Padding = System::Windows::Forms::Padding(3);
this->tabPage2->Size = System::Drawing::Size(525, 173);
this->tabPage2->TabIndex = 1;
this->tabPage2->Text = L"Visualisation";
this->tabPage2->UseVisualStyleBackColor = true;
//
// button8
//
this->button8->Location = System::Drawing::Point(437, 113);
this->button8->Name = L"button8";
this->button8->Size = System::Drawing::Size(75, 23);
this->button8->TabIndex = 13;
this->button8->Text = L"Import";
this->button8->UseVisualStyleBackColor = true;
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
this->openFileDialog1->Filter = L"Wav Music|*.wav";
//
// button7
//
this->button7->Location = System::Drawing::Point(356, 113);
this->button7->Name = L"button7";
this->button7->Size = System::Drawing::Size(75, 23);
this->button7->TabIndex = 12;
this->button7->Text = L"Previous";
this->button7->UseVisualStyleBackColor = true;
//
// button6
//
this->button6->Location = System::Drawing::Point(275, 113);
this->button6->Name = L"button6";
this->button6->Size = System::Drawing::Size(75, 23);
this->button6->TabIndex = 11;
this->button6->Text = L"Next";
this->button6->UseVisualStyleBackColor = true;
//
// button5
//
this->button5->Location = System::Drawing::Point(194, 113);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(75, 23);
this->button5->TabIndex = 10;
this->button5->Text = L"Stop";
this->button5->UseVisualStyleBackColor = true;
//
// button4
//
this->button4->Location = System::Drawing::Point(114, 113);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(75, 23);
this->button4->TabIndex = 9;
this->button4->Text = L"Pause";
this->button4->UseVisualStyleBackColor = true;
//
// button3
//
this->button3->Location = System::Drawing::Point(33, 113);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(75, 23);
this->button3->TabIndex = 8;
this->button3->Text = L"Play";
this->button3->UseVisualStyleBackColor = true;
//
// axWindowsMediaPlayer1
//
this->axWindowsMediaPlayer1->Enabled = true;
this->axWindowsMediaPlayer1->Location = System::Drawing::Point(-4, 3);
this->axWindowsMediaPlayer1->Name = L"axWindowsMediaPlayer1";
this->axWindowsMediaPlayer1->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^ >(resources->GetObject(L"axWindowsMediaPlayer1.OcxState")));
this->axWindowsMediaPlayer1->Size = System::Drawing::Size(533, 202);
this->axWindowsMediaPlayer1->TabIndex = 0;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(555, 366);
this->Controls->Add(this->tabControl1);
this->Controls->Add(this->button8);
this->Controls->Add(this->button7);
this->Controls->Add(this->button6);
this->Controls->Add(this->button5);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->panel1);
this->Name = L"Form1";
this->Text = L"Form1";
this->panel1->ResumeLayout(false);
this->panel1->PerformLayout();
this->tabControl1->ResumeLayout(false);
this->tabPage1->ResumeLayout(false);
this->tabPage2->ResumeLayout(false);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axWindowsMediaPlayer1))->EndInit();
this->ResumeLayout(false);
}
#pragma endregion
};
}
public ref class Form1
{
private:
int XP;
int YP;
System::Drawing::Point NewPoint;
void Panel1_MouseDown(Object ^sender, System::Windows::Forms::MouseEventArgs ^e)
{
Handles panel1::MouseDown XP = MousePosition.X - this->Location.X YP == MousePosition.Y - this->Location.Y;
}
void Panel1_MouseMove(Object ^sender, System::Windows::Forms::MouseEventArgs ^e)
{
Handles Panel1::MouseMove;
if (e->Button == MouseButtons::Left)
{
NewPoint = MousePosition NewPoint.X == NewPoint.X - XP NewPoint.Y == NewPoint.Y - YP this->Location == NewPoint;
}
}
void Button1_Click(Object ^sender, System::EventArgs ^e)
{
Handles Button1.Click this->Close();
End Sub Sub Button2_Click(ByVal sender As System::Object, ByVal e As System::EventArgs);
Handles Button2.Click this->WindowState = FormWindowState::Minimized;
}
void Button8_Click(Object ^sender, System::EventArgs ^e)
{
Handles Button8::Click OpenFileDialog1->ShowDialog();
}
void OpenFileDialog1_FileOk(Object ^sender, System::ComponentModel::CancelEventArgs ^e)
{
Handles OpenFileDialog1::FileOk;
for each (String ^track in OpenFileDialog1::FileNames ListBox1::Items->Add(track) Next)
{
}
Object ^Sub;
Button3_Click(ByVal sender As System::Object, ByVal e As System::EventArgs);
Handles Button3.Click AxWindowsMediaPlayer1->URL = ListBox1::SelectedItem;
}
void Button5_Click(Object ^sender, System::EventArgs ^e)
{
Handles Button5::Click AxWindowsMediaPlayer1::Ctlcontrols::stop();
}
void Button4_Click(Object ^sender, System::EventArgs ^e)
{
AxWindowsMediaPlayer1::Ctlcontrols::pause();
}
void Button6_Click(Object ^sender, System::EventArgs ^e)
{
Handles Button6::Click AxWindowsMediaPlayer1::Ctlcontrols::next();
}
void Button7_Click(Object ^sender, System::EventArgs ^e)
{
Handles Button7::Click AxWindowsMediaPlayer1::Ctlcontrols::previous();
}
private:
bool initialized;
void InitializeInstanceFields()
{
if ( ! initialized)
{
NewPoint = System::Drawing::Point();
initialized = true;
}
}
public:
Form1()
{
InitializeInstanceFields();
}
};