Мегаобучалка Главная | О нас | Обратная связь


Программная реализация



2019-12-29 143 Обсуждений (0)
Программная реализация 0.00 из 5.00 0 оценок




 

Для реализации визуальных компонентов было создано 4 формы:

- Главное окно, в котором отображается вводимая информация, а также осуществляется вызов окон для добавления, редактирования и поиска;

- Стартовое окно, которое запрашивает у пользователя информацию о названии экрана курсового проектирования, дате утверждения экрана и состава приемной комиссии;

- Окно добавления/редактирования позволяет добавлять/редактировать записи.

- Окно поиска служит для приема искомой информации.

Большую часть главного окна занимает визуальный компонент dataGridView, который служит таблицей для отображения введенных записей. В данном случае он очень удобен, т.к. отвечает всем требованиям для хранения и отображения записей о студентах. Заполнение таблицы происходит с помощью кнопки «Добавить», которая расположена внизу окна. При нажатии на нее происходит вызов окна добавления, которое содержит текстовые поля(textbox) для ввода информации. Пользователь вводит необходимую информацию, затем необходимо нажать на кнопку «Проверка». Так как поля класса TStudent имеют различные типы данных, то необходимо провести соответствие введенных полей этим типам. В случае успешной проверки появляется кнопка добавить, с помощью которой введенные записи присваиваются полям класса. В случае ошибки ввода пользователь будет выведена ошибка о несоответствии типов, либо пользователь пропустил ввод некоторого поля.

Рассмотрим процедуру добавления записи в dataGridView:

private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {

Form2 ^newdlg=gcnewForm2();//вызов форма добавления записи

if(dialres==System::Windows::Forms::DialogResult::OK){//проверкаусловиянанажатиеклавиши «ОК» вформедобавления

Student->SetName(newdlg->textBox1->Text);//присвоение значений полям класса значений из формы добавления

dataGridView1->Rows->Add(Student->TName,…);//добавлениеполейзаписивтаблицуdataGridView1

return;//возврат в главную программу

 }

 }

Полная реализация данной процедуры представлена в приложении В.

Процедура удаления доступна при выполнении двух условий:

- В таблице есть хотя бы одна запись;

- Если значение визуального компонента checkBox->Checked равно True (стоит галочка);

При выполнении этих условий необходимо выделить удаляемую строку. Программа определяет выделенную строку и при нажатии кнопки удалить, а также подтверждения действия происходит удаление записи. Происходит обновление таблицы.

Процедураудаленияприведенаниже:

private: System::Voidbutton6_Click(System::Object^ sender, System::EventArgs^ e) {

dialres=MessageBox::Show("Выточнохотитеудалитьзапись?","Удалить?",MessageBoxButtons::OKCancel,MessageBoxIcon::Warning);//вывод предупреждения

if(dialres==System::Windows::Forms::DialogResult::OK){//проверкаусловиянаудаление

 if(this->dataGridView1->SelectedRows->Count > 0 &&

 this->dataGridView1->SelectedRows[0]->Index !=

this->dataGridView1->Rows->Count){// проверкананаличиестрокивыделенияудаляемойстроки

this->dataGridView1->Rows->RemoveAt(this->dataGridView1->SelectedRows[0]->Index);//удалениевыделеннойстроки

CountDataGrid--;//уменьшение количества записей в таблице

}

 }

 }

Полная реализация данной процедуры представлена в приложении В.

Функция редактирования использует то же окно, что и функция добавления, с той лишь разницей, что ее поля заполняются информацией редактируемой записи. Для выполнения редактирования необходимо наличие тех же двух условий, что и для удаления. После редактирования записи в выделенную строку в dataGridView возвращаются обновленные поля.

Рассмотримфункциюредактирования:

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {

 dl=MessageBox::Show("Редактироватьзапись?","Изменить?",MessageBoxButtons::OKCancel,MessageBoxIcon::Question);//выводпредупрежденияобизменениизаписи

 if(dl==System::Windows::Forms::DialogResult::OK){//проверкаподтверждения

 if(this->dataGridView1->SelectedRows->Count > 0 &&

 this->dataGridView1->SelectedRows[0]->Index !=

this->dataGridView1->Rows->Count){// проверкананаличиестрокивыделенияудаляемойстроки

Form2 ^newdlg=gcnewForm2();//инициализация формы редактирования

newdlg->textBox1->Text=System::Convert::ToString(this->dataGridView1->SelectedRows[0]->Cells[0]->Value);//передачавформуредактированияполейтаблицы

dialres=newdlg->ShowDialog();//вызовформыредактирования и редактирование полей записи

if(dialres==System::Windows::Forms::DialogResult::OK){//подтверждениедобавления измененныхполей

this->dataGridView1->SelectedRows[0]->Cells[0]->Value=newdlg->textBox1->Text;//возврат отредактированных полей обратно в таблицу

 }

 }

 }

Полная реализация данной процедуры представлена в приложении В.

В приложении также реализован поиск. Для его выполнения достаточно одного условия – в таблице должна быть хотя бы одна запись. Поиск производится по всем полям таблицы, независимо от типов данных, которые там хранятся. При нажатии на кнопку поиска появляется окно, в котором есть единственный компонент textBox. В него вводится искомая информация. Введенная информация сравнивается с той, что хранится в полях таблицы. Если она соответствует запросу, то происходит выделение поля таблицы. Если запрос не соответствует результату, то можно продолжить поиск, нажав на «ОК» в информационном сообщении.

Запросискомойинформации:

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

 if(textBox1->Text!=""){//проверка наличия информации для поиска

this->DialogResult=System::Windows::Forms::DialogResult::OK;//подтверждениепоска

this->Close();//закрытие окна поиска и переход в главную программу

}

 }

Полная реализация данной процедуры представлена в приложении В.

Поискинформациивтаблице:

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

 dialres=newdlg->ShowDialog();//вызовформыпоиска

System::String ^srh;//объявление строки поиска

srh=newdlg->textBox1->Text;//присвоение значения строке поиска

 for(int i=0; i<CountDataGrid; i++){//циклповсемстрокамтаблицы

 for(int j=0; j<dataGridView1->ColumnCount; j++){//циклповсемстолбцамтаблицы

 if(System::Convert::ToString(dataGridView1->Rows[i]->Cells[j]->Value)==srh){//проверканасоответствиезапросаполямтаблицы

 dataGridView1->CurrentCell=dataGridView1->Rows[i]->Cells[j];//выделениенайденногополя

 }

 }

}

 }

 }

Полная реализация данной процедуры представлена в приложении В.

Функция изменения названия экрана курсового проектирования:

private: System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {

Start ^newdlg=gcnewStart();//инициализацияформыстартового окна

dialres=newdlg->ShowDialog();//вызов стартового окна

Screen.SetName(newdlg->textBox1->Text);//присвоениеполямклассаTScreenзначенийполейформы

listBox2->Items->Add(Screen.Composition);//передачаполейклассаTScreenвlistBox1 главнойформы

}

 

 }

Полная реализация данной процедуры представлена в приложении В.


4 Тестирование

 

Конечным этапом создания программного продукта является его тестирование и отладка. В ходе тестирования программы выявляются все ее недостатки и особенности работы. Обнаруженные недостатки устраняются в ходе отладки.

В результате было создано тестирующее приложение(рисунок 2), в котором реализована структура иерархии классов, а также различные функции. А именно:

- Создание экземпляров классов;

- Добавление, удаление, редактирование и поиск данных;

- Работа с экземплярами классов через визуальные компоненты.

 

Рисунок 2 – Тестирующее приложение. Главное окно.

 

Рисунок 3 – Тестирующее приложение. Добавление/редактирование.

иерархия класс программирование

 


Рисунок 4 – Тестирующее приложение. Окно поиска.

 

Результат тестирования: в ходе тестирования программы недостатков, влияющих на правильную работу приложения, не выявлено.

Листинг тестирующего приложения предложен в Приложении В.

Данная программа тестировалась на компьютере следующей конфигурации:

1. ТипЦП DualCore AMD Athlon 64 X2, 2700 MHz (13.5 x 200) 5200+;

2. Системная память 4096 МБ (DDR2-800 DDR2 SDRAM);

3. ОС Windows 7 x64 с поддержкой 32-х приложений.

 

5. Руководство по программному продукту

 

Руководство программиста:

Созданное приложение «Экран курсового проектирования», основанное на иерархии классов, имеет открытый исходный код, что позволяет изменять его в зависимости от потребностей пользователя. Объявление экземпляров класса TScreenи TStudentпроисходит в заголовочном файле главного окна Form1.h:

public:

TStudent ^Student;//объявление указателя на экземпляр класса TStudent

TScreenScreen;//объявление экземпляра класса TScreen

Причем экземпляр класса TStudentинициализируется в конструкторе главной формы:

Form1(void)

{

Student=gcnew TStudent;//инициализацияэкземпляраклассаTStudent

}

Оба этих экземпляра объявляются глобально и с атрибутом доступа Public, что позволяет получить к ним доступ из любой части главной формы и других форм. Поля и методы этих классов также имеют атрибут доступа Public и имеют стандартные типы данных платформы .NETFramework. Все входные данные в программу имеют текстовый формат, а именно System::String^. В зависимости от полей и методов класса они конвертируются с помощью стандартного конвертора в нужный тип данных:

Student->SetControlScore(System::Convert::ToInt16(newdlg->textBox17->Text));//пример использования конвертора типа данных

Руководство системного администратора:

Данное приложение использует структуру иерархии классов «Экран курсового проектирования». Объявление полей и методов абстрактного базового класса TObject находится в файле TObject.h, а их описание в файле TObject.cpp. Объявление полей и методов класса TScreen находится в файле TScreen.h, а их описание в файле TScreen.cpp. Объявление полей и методов класса TStudent находится в файле TStudent.h, а их описание в файле TStudent.cpp. Описание главного окна приложения находится в файле Form1.h; описание окна добавления/изменения информации об экране курсового проектирования находится в файле Start.h; описания окна добавления/изменения записи о студенте находится в файле Form2.h; описание окна поиска находится в файле Search.h.

Приложение «Экран курсового проектирования» было разработано в интегрированной среде программирования MicrosoftVisualStudio 2010. Приложение использует платформу .NETFramework 4, которая присутствует в операционной системе MicrosoftWindows 7.

Руководство пользователя:

Для выполнения приложения «Экран курсового проектирования» необходимы следующие минимальные системные требования:

- Pentium III 1.5 ГГц;

- GeForceFX 5200 или ATI Radeon 9550-9600 с 128 MB, поддержка шейдеров 2.0;

- 512 МбОЗУ;

- Windows® XP/Vista/7, Windows2000, DirectX 9.0c;

- .NET Framework версии 4.0;

- Место на жестком диске: 4 GB;

- Монитор с поддержкой разрешения 800x600;

- Клавиатура, мышь.

Данное приложение запускается из файла WindowsFormApplication C++.exe. При выполнении системных требований появится окно добавления информации о текущем экране курсового проектирования. После ввода доступно главное окно, в котором отражается полная информация об экране курсового проектирования и о студентах, выполняющих курсовые работы. В этом режиме программа ожидает действия от пользователя. При первом запуске доступны только команды «Добавить» и «Выход», а также справка о программе.

Для добавления записи необходимо нажать кнопку «Добавить», после чего появится форма добавления. Затем нужно заполнить все поля и нажать кнопку «Ок». Если не заполнены все поля, то программа выдаст сообщение об ошибке и предложит заполнить все поля. Также при неправильном соответствии форматов полей программа проинформирует пользователя. При желании возможно отказаться от добавления и нажать кнопку «Отмена». После добавления запись автоматически отображается в таблице.

Чтобы удалить запись необходимо поставить галочку на «Разрешить редактирование таблицы». Удаление доступно при наличии записей в таблице. Далее программа переходит в режим редактирования таблицы. Для удаления необходимо выделить удаляемую строку, нажав на треугольник рядом с именем записи. При подтверждении выбранного действия программа удаляет запись, о чем информирует пользователя.

Для редактирования записи необходимо поставить галочку на «Разрешить редактирование таблицы». Редактирование записи , как и удаление, доступно лишь при наличии записей в таблице. Для редактирования записи необходимо выделить строку, нажав на треугольник рядом с именем записи. При подтверждении выбранного действия открывается окно редактирования записи. Необходимо отредактировать нужные поля и подтвердить свои действия.

Поиск осуществляется по всем полям таблицы. Для поиска необходимо наличие записей в таблице. Чтобы выполнить поиск необходимо нажать на кнопку «Поиск», после этого откроется окно поиска, в котором необходимо ввести информацию для запроса, а затем нажать кнопку «Поиск». При первом же совпадении запрошенной информации с информацией в таблице программа выделяет совпадающее поле и запрашивает у пользователя разрешение на продолжение поиска, если найденная информация не удовлетворила запросу пользователя.

Для вызова справочной системы необходимо выбрать на панели команд меню «Help», а затем «Helpfile».

 


Заключение

 

В ходе выполнения курсового проекта была создана иерархия классов «Экран курсового проектирования», на основе которой было создано визуальное тестирующее приложение. Данное приложение наделено возможностью добавлять, редактировать, удалять записи, а также выполнять поиск информации по введенным данным. Проект отвечает тем требованиям, которые были предъявлены к нему в ходе проектирования, а именно использовании структуры классов, наглядности и удобству в использовании.

 


Список литературы

 

1. Павловская Т.А. С/С++. Программирование на языке высокого уровня. – СПб.: Лидер, 2010. – 461с.

2. Пахомов Б. И. С/С++ и MSVisualC++ 2008 для начинающих. – СПб.: БХВ-Петербург. 2009. – 624с.

3. Иванова Г.С, Ничушкина Т.Н., Пугачев Е.К. И21 Объектно-ориентированное программирование: Учеб. для вузов/ Под ред. Г.С. Ивановой. - М.: Изд-во МГТУ им. Н.Э. Баумана, 2001. – 320 с.

4. Пауэрс Л. MicrosoftVisualStudio 2008 / Л. Пауэрс, М. Снелл: Пер. с англ. – СПб.: БХВ-Петербург, 2009. – 1200 с.

 


 

Приложения

 

 


Приложение А

Реализация иерархии классов

ФайлTObject.h

#pragma once

public ref class TObject abstract

{

public:

System::String ^TName;

virtual void SetName(System::String ^) abstract;

TObject(void);

};

 

Файл TObject.cpp

#include "StdAfx.h"

#include "TObject.h"

 

 

TObject::TObject(void)

{

TName="Default";

}

Файл TStudent.h

#pragma once

#include "TObject.h"

using namespace System;

 

ref class TStudent :

public TObject

{

public:

 

System::Int16 ControlScore;

System::Int16 NumberWeek;

System::Int16 *Plan;

System::Int16 *Fact;

System::Int16 *Control

 

System::String ^Test;

System::String ^TestF;

System::String ^Revision;

System::String ^RevisionF;

System::String ^Protection;

System::String ^ProtectionF;

 

virtual void SetName(System::String ^) override;

void SetNumberWeek(System::Int16 );

void SetPlan(System::Int16 , System::Int16);

void SetFact(System::Int16, System::Int16);

void SetControl(System::Int16, System::Int16);

 

void SetTest(System::String ^ );

void SetTestF(System::String ^ );

void SetRevision(System::String ^ );

void SetRevisionF(System::String ^ );

void SetProtection(System::String ^ );

void SetProtectionF(System::String ^ );

 

void SetControlScore(System::Int16 );

 

TStudent(void);

};

Файл TStudent.cpp

#include "StdAfx.h"

#include "TStudent.h"

 

 

void TStudent::SetName(String ^name){

TName=name;

}

 

void TStudent::SetNumberWeek(System::Int16 num){

NumberWeek=num;

}

 

void TStudent::SetPlan(System::Int16 num1, System::Int16 num2){

Plan[num2]=num1;

}

 

void TStudent::SetFact(System::Int16 num1, System::Int16 num2){

Fact[num2]=num1;

}

 

void TStudent::SetControl(System::Int16 num1, System::Int16 num2){

Control[num2]=num1;

}

 

void TStudent::SetTest(String ^ num){

Test=num;

}

 

void TStudent::SetTestF(String ^ num){

TestF=num;

}

 

void TStudent::SetRevision(String ^ num){

Revision=num;

}

 

void TStudent::SetRevisionF(String ^ num){

RevisionF=num;

}

 

void TStudent::SetProtection(String ^ num){

Protection=num;

}

 

void TStudent::SetProtectionF(String ^ num){

ProtectionF=num;

}

 

void TStudent::SetControlScore(System::Int16 score){

ControlScore=score;

}

 

TStudent::TStudent(void)

{

Plan=new System::Int16[3];

Fact=new System::Int16[3];

Control=new System::Int16[3];

}

 

Файл TScreen.h

#pragma once

#include "TObject.h"

#include "TStudent.h"

 

using namespace System;

 

using namespace System::Collections::Generic;

 

ref class TScreen :

public TObject

{

public:

System::String ^ Date;

System::String ^ Composition;

 

virtual void SetName(System::String ^) override;

void SetDate(System::String ^);

void SetComposition(System::String ^);

 

public:

TScreen(void);

};

Файл TScreen.cpp

#include "StdAfx.h"

#include "TScreen.h"

 

 

void TScreen::SetName(System::String ^s){

TName=s;

}

 

void TScreen::SetComposition(System::String ^s){

Composition=s;

}

 

void TScreen::SetDate(System::String ^s){

Date=s;

}

 

 

TScreen::TScreen(void)

{

 

}


Приложение В

 

Листинг тестирующего приложения

Файл Form1.h. Главное окно.

#pragma once

 

#include "Form2.h"

#include "TScreen.h"

#include "Start.h"

#include "Search.h"

 

namespace WindowsFormApplicationC {

 

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

using namespace System::Collections::Generic;

 

public ref class Form1 : public System::Windows::Forms::Form

{

public:

private: System::Windows::Forms::MenuStrip^ menuStrip1;

private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;

private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;

private: System::Windows::Forms::ToolStripMenuItem^ helpToolStripMenuItem;

private: System::Windows::Forms::ToolStripMenuItem^ aboutToolStripMenuItem;

private: System::Windows::Forms::Button^ button4;

private: System::Windows::Forms::Button^ button5;

 

public:

TStudent ^Student;

TScreen Screen;

System::Int16 CountDataGrid;

 

private: System::Windows::Forms::Button^ button6;

private: System::Windows::Forms::Button^ button7;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::Button^ button2;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column2;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column3;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column4;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column5;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column6;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column7;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column8;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column9;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column10;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column11;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column12;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column13;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column14;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column15;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column16;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column17;

private: System::Windows::Forms::ToolStripMenuItem^ aboutToolStripMenuItem1;

private: System::Windows::Forms::ListBox^ listBox1;

private: System::Windows::Forms::ListBox^ listBox2;

private: System::Windows::Forms::CheckBox^ checkBox1;

 

public:

Form1(void)

{

InitializeComponent();

Student=gcnew TStudent;

CountDataGrid=0;

}

protected:

 

~Form1()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::DataGridView^ dataGridView1;

protected:

private:

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::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle2 = (gcnew System::Windows::Forms::DataGridViewCellStyle());

this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());

this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column6 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column7 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column8 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column9 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column10 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column11 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column12 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column13 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column14 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column15 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column16 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Column17 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());

this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());

this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());

this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());

this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());

this->aboutToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());

this->button4 = (gcnew System::Windows::Forms::Button());

this->button5 = (gcnew System::Windows::Forms::Button());

this->button6 = (gcnew System::Windows::Forms::Button());

this->button7 = (gcnew System::Windows::Forms::Button());

this->button1 = (gcnew System::Windows::Forms::Button());

this->button2 = (gcnew System::Windows::Forms::Button());

this->listBox1 = (gcnew System::Windows::Forms::ListBox());

this->listBox2 = (gcnew System::Windows::Forms::ListBox());

this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataGridView1))->BeginInit();

this->menuStrip1->SuspendLayout();

this->SuspendLayout();

//

// dataGridView1

//

this->dataGridView1->AccessibleRole = System::Windows::Forms::AccessibleRole::Graphic;

this->dataGridView1->AllowUserToAddRows = false;

this->dataGridView1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)

| System::Windows::Forms::AnchorStyles::Left)

| System::Windows::Forms::AnchorStyles::Right));

this->dataGridView1->BackgroundColor = System::Drawing::Color::White;

this->dataGridView1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;

this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;

this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(17) {this->Column1,

this->Column2, this->Column3, this->Column4, this->Column5, this->Column6, this->Column7, this->Column8, this->Column9, this->Column10,

this->Column11, this->Column12, this->Column13, this->Column14, this->Column15, this->Column16, this->Column17});

dataGridViewCellStyle2->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;

dataGridViewCellStyle2->BackColor = System::Drawing::SystemColors::Window;

dataGridViewCellStyle2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(204)));

dataGridViewCellStyle2->ForeColor = System::Drawing::SystemColors::ControlText;

dataGridViewCellStyle2->SelectionBackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(128)),

static_cast<System::Int32>(static_cast<System::Byte>(128)), static_cast<System::Int32>(static_cast<System::Byte>(255)));

dataGridViewCellStyle2->SelectionForeColor = System::Drawing::SystemColors::HighlightText;

dataGridViewCellStyle2->WrapMode = System::Windows::Forms::DataGridViewTriState::False;

this->dataGridView1->DefaultCellStyle = dataGridViewCellStyle2;

this->dataGridView1->GridColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(224)), static_cast<System::Int32>(static_cast<System::Byte>(224)),

static_cast<System::Int32>(static_cast<System::Byte>(224)));

this->dataGridView1->Location = System::Drawing::Point(0, 63);

this->dataGridView1->Name = L"dataGridView1";

this->dataGridView1->RowHeadersVisible = false;

this->dataGridView1->Size = System::Drawing::Size(944, 537);

this->dataGridView1->TabIndex = 0;

//

// Column1

//

this->Column1->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column1->Frozen = true;

this->Column1->HeaderText = L"ФИОстудента";

this->Column1->Name = L"Column1";

this->Column1->ReadOnly = true;

this->Column1->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column1->Width = 200;

//

// Column2

//

this->Column2->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column2->HeaderText = L"1к.н. задан. % вып.";

this->Column2->Name = L"Column2";

this->Column2->ReadOnly = true;

this->Column2->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column2->Width = 70;

//

// Column3

//

this->Column3->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column3->HeaderText = L"1к.н. факт. % вып.";

this->Column3->Name = L"Column3";

this->Column3->ReadOnly = true;

this->Column3->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column3->Width = 70;

//

// Column4

//

this->Column4->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column4->HeaderText = L"1к.н. контр. оценка";

this->Column4->Name = L"Column4";

this->Column4->ReadOnly = true;

this->Column4->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column4->Width = 70;

//

// Column5

//

this->Column5->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column5->HeaderText = L"2к.н. задан. % вып.";

this->Column5->Name = L"Column5";

this->Column5->ReadOnly = true;

this->Column5->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column5->Width = 70;

//

// Column6

//

this->Column6->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column6->HeaderText = L"2к.н. факт. % вып.";

this->Column6->Name = L"Column6";

this->Column6->ReadOnly = true;

this->Column6->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column6->Width = 70;

//

// Column7

//

this->Column7->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column7->HeaderText = L"2к.н. контр. оценка";

this->Column7->Name = L"Column7";

this->Column7->ReadOnly = true;

this->Column7->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column7->Width = 70;

//

// Column8

//

this->Column8->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column8->HeaderText = L"3к.н. задан. % вып.";

this->Column8->Name = L"Column8";

this->Column8->ReadOnly = true;

this->Column8->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column8->Width = 70;

//

// Column9

//

this->Column9->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column9->HeaderText = L"3к.н. факт. % вып.";

this->Column9->Name = L"Column9";

this->Column9->ReadOnly = true;

this->Column9->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column9->Width = 70;

//

// Column10

//

this->Column10->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column10->HeaderText = L"3к.н. контр. оценка";

this->Column10->Name = L"Column10";

this->Column10->ReadOnly = true;

this->Column10->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column10->Width = 70;

//

// Column11

//

this->Column11->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column11->HeaderText = L"Дата сдачи заверш. проекта (работы) на проверку План";

this->Column11->Name = L"Column11";

this->Column11->ReadOnly = true;

this->Column11->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column11->Width = 120;

//

// Column12

//

this->Column12->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column12->HeaderText = L"Дата сдачи заверш. проекта (работы) на проверку Факт.";

this->Column12->Name = L"Column12";

this->Column12->ReadOnly = true;

this->Column12->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column12->Width = 120;

//

// Column13

//

this->Column13->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column13->HeaderText = L"Дата выдачи проекта (работы) препод. на доработку План";

this->Column13->Name = L"Column13";

this->Column13->ReadOnly = true;

this->Column13->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column13->Width = 120;

//

// Column14

//

this->Column14->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column14->HeaderText = L"Дата выдачи проекта (работы) препод. на доработку Факт.";

this->Column14->Name = L"Column14";

this->Column14->ReadOnly = true;

this->Column14->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column14->Width = 120;

//

// Column15

//

this->Column15->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column15->HeaderText = L"ДатазащитыПлан";

this->Column15->Name = L"Column15";

this->Column15->ReadOnly = true;

this->Column15->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column15->Width = 120;

//

// Column16

//

this->Column16->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column16->HeaderText = L"ДатазащитыФакт.";

this->Column16->Name = L"Column16";

this->Column16->ReadOnly = true;

this->Column16->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column16->Width = 120;

//

// Column17

//

this->Column17->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::None;

this->Column17->FillWeight = 30;

this->Column17->HeaderText = L"Оценказаработу";

this->Column17->Name = L"Column17";

this->Column17->ReadOnly = true;

this->Column17->Resizable = System::Windows::Forms::DataGridViewTriState::False;

this->Column17->Width = 75;

//

// menuStrip1

//

this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->fileToolStripMenuItem,

this->helpToolStripMenuItem});

this->menuStrip1->Location = System::Drawing::Point(0, 0);

this->menuStrip1->Name = L"menuStrip1";

this->menuStrip1->Size = System::Drawing::Size(944, 24);

this->menuStrip1->TabIndex = 8;

this->menuStrip1->Text = L"menuStrip1";

//

// fileToolStripMenuItem

//

this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->exitToolStripMenuItem});

this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";

this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);

this->fileToolStripMenuItem->Text = L"File";

//

// exitToolStripMenuItem

//

this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";

this->exitToolStripMenuItem->Size = System::Drawing::Size(92, 22);

this->exitToolStripMenuItem->Text = L"Exit";

this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::button5_Click);

//

// helpToolStripMenuItem

//

this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->aboutToolStripMenuItem,

this->aboutToolStripMenuItem1});

this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";

this->helpToolStripMenuItem->Size = System::Drawing::Size(44, 20);

this->helpToolStripMenuItem->Text = L"Help";

//

// aboutToolStripMenuItem

//

this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";

this->aboutToolStripMenuItem->Size = System::Drawing::Size(152, 22);

this->aboutToolStripMenuItem->Text = L"Help file";

this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem_Click);

//

// aboutToolStripMenuItem1

//

this->aboutToolStripMenuItem1->Name = L"aboutToolStripMenuItem1";

this->aboutToolStripMenuItem1->Size = System::Drawing::Size(152, 22);

this->aboutToolStripMenuItem1->Text = L"About";

this->aboutToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem1_Click);

//

// button4

//

this->button4->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));

this->button4->Location = System::Drawing::Point(12, 727);

this->button4->Name = L"button4";

this->button4->Size = System::Drawing::Size(106, 23);

this->button4->TabIndex = 9;

this->button4->Text = L"Добавитьзапись";

this->button4->UseVisualStyleBackColor = true;

this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);

//

// button5

//

this->button5->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right));

this->button5->Location = System::Drawing::Point(860, 706);

this->button5->Name = L"button5";

this->button5->Size = System::Drawing::Size(72, 44);

this->button5->TabIndex = 10;

this->button5->Text = L"Выход";

this->button5->UseVisualStyleBackColor = true;

this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);

//

// button6

//

this->button6->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right));

this->button6->Enabled = false;

this->button6->Location = System::Drawing::Point(806, 664);

this->button6->Name = L"button6";

this->button6->Size = System::Drawing::Size(126, 23);

this->button6->TabIndex = 12;

this->button6->Text = L"Удалитьзапись";

this->button6->UseVisualStyleBackColor = true;

this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);

//

// button7

//

this->button7->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right));

this->button7->Location = System::Drawing::Point(806, 606);

this->button7->Name = L"button7";

this->button7->Size = System::Drawing::Size(126, 23);

this->button7->TabIndex = 13;

this->button7->Text = L"Изменитьназавние";

this->button7->UseVisualStyleBackColor = true;

this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);

//

// button1

//

this->button1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));

this->button1->Enabled = false;

this->button1->Location = System::Drawing::Point(137, 727);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(75, 23);

this->button1->TabIndex = 19;

this->button1->Text = L"Поиск";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

//

// button2

//

this->button2->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right));

this->button2->Enabled = false;

this->button2->Location = System::Drawing::Point(806, 635);

this->button2->Name = L"button2";

this->button2->Size = System::Drawing::Size(126, 23);

this->button2->TabIndex = 20;

this->button2->Text = L"Редактировать";

this->button2->UseVisualStyleBackColor = true;

this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);

//

// listBox1

//

this->listBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)

| System::Windows::Forms::AnchorStyles::Right));

this->listBox1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->listBox1->FormattingEnabled = true;

this->listBox1->ItemHeight = 21;

this->listBox1->Location = System::Drawing::Point(12, 27);

this->listBox1->Name = L"listBox1";

this->listBox1->Size = System::Drawing::Size(920, 25);

this->listBox1->TabIndex = 21;

this->listBox1->Tag = L"";

//

// listBox2

//

this->listBox2->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left)

| System::Windows::Forms::AnchorStyles::Right));

this->listBox2->Font = (gcnew System::Drawing::Font(L"Times New Roman", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(204)));

this->listBox2->FormattingEnabled = true;

this->listBox2->HorizontalScrollbar = true;

this->listBox2->ItemHeight = 21;

this->listBox2->Location = System::Drawing::Point(12, 606);

this->listBox2->Name = L"listBox2";

this->listBox2->ScrollAlwaysVisible = true;

this->listBox2->Size = System::Drawing::Size(788, 109);

this->listBox2->TabIndex = 22;

//

// checkBox1

//

this->checkBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));

this->checkBox1->AutoSize = true;

this->checkBox1->Enabled = false;

this->checkBox1->Location = System::Drawing::Point(256, 727);

this->checkBox1->Name = L"checkBox1";

this->checkBox1->Size = System::Drawing::Size(214, 17);

this->checkBox1->TabIndex = 23;

this->checkBox1->Text = L"Разрешитьредактированиетаблицы";

this->checkBox1->UseVisualStyleBackColor = true;

this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged);

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);

this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

this->BackColor = System::Drawing::Color::White;

this->ClientSize = System::Drawing::Size(944, 762);

this->Controls->Add(this->checkBox1);

this->Controls->Add(this->listBox2);

this->Controls->Add(this->listBox1);

this->Controls->Add(this->button2);

this->Controls->Add(this->button1);

this->Controls->Add(this->button7);

this->Controls->Add(this->button6);

this->Controls->Add(this->button5);

this->Controls->Add(this->button4);

this->Controls->Add(this->dataGridView1);

this->Controls->Add(this->menuStrip1);

this->Location = System::Drawing::Point(388, 613);

this->MainMenuStrip = this->menuStrip1;

this->MinimumSize = System::Drawing::Size(960, 800);

this->Name = L"Form1";

this->Text = L"Form1";

this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);

this->Shown += gcnew System::EventHandler(this, &Form1::button7_Click);

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataGridView1))->EndInit();

this->menuStrip1->ResumeLayout(false);

this->menuStrip1->PerformLayout();

this->ResumeLayout(false);

this->PerformLayout();

 

}

#pragma endregion

 

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {

 

}

private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {

 System::Windows::Forms::DialogResult dialres;

 Form2 ^newdlg=gcnew Form2();

 dialres=newdlg->ShowDialog();

 if(dialres==System::Windows::Forms::DialogResult::OK){

 

 Student->SetName(newdlg->textBox1->Text);

 Student->SetControl(System::Convert::ToInt16(newdlg->textBox4->Text),0);

 Student->SetControl(System::Convert::ToInt16(newdlg->textBox7->Text),1);

 Student->SetControl(System::Convert::ToInt16(newdlg->textBox10->Text),2);

 Student->SetControlScore(System::Convert::ToInt16(newdlg->textBox17->Text));

 Student->SetFact(System::Convert::ToInt16(newdlg->textBox3->Text),0);

 Student->SetFact(System::Convert::ToInt16(newdlg->textBox6->Text),1);

 Student->SetFact(System::Convert::ToInt16(newdlg->textBox9->Text),2);

 Student->SetPlan(System::Convert::ToInt16(newdlg->textBox2->Text),0);

 Student->SetPlan(System::Convert::ToInt16(newdlg->textBox5->Text),1);

 Student->SetPlan(System::Convert::ToInt16(newdlg->textBox8->Text),2);

 Student->SetTest(newdlg->textBox11->Text);

 Student->SetTestF(newdlg->textBox12->Text);

 Student->SetRevision(newdlg->textBox13->Text);

 Student->SetRevisionF(newdlg->textBox14->Text);

 Student->SetProtection(newdlg->textBox15->Text);

 Student->SetProtectionF(newdlg->textBox16->Text);

 dataGridView1->Rows->Add(Student->TName,Student->Plan[0],Student->Fact[0],Student->Control[0],

 Student->Plan[1],Student->Fact[1],Student->Control[1],Student->Plan[2],Student->Fact[2],

 Student->Control[2],Student->Test,Student->TestF,Student->Revision,Student->RevisionF,

 Student->Protection,Student->ProtectionF,Student->ControlScore);

 CountDataGrid++;

 button1->Enabled=true;

 checkBox1->Enabled=true;

 MessageBox::Show("Записьдобавлена!","Information",MessageBoxButtons::OK,MessageBoxIcon::Information);

return;

 }

 }

private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {

 this->Close();

 }

private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {

 System::Windows::Forms::DialogResult dialres;

 dialres=MessageBox::Show("Выточнохотитеудалитьзапись?","Удалить?",MessageBoxButtons::OKCancel,MessageBoxIcon::Warning);

 if(dialres==System::Windows::Forms::DialogResult::OK){

 if(this->dataGridView1->SelectedRows->Count > 0 &&

 this->dataGridV



2019-12-29 143 Обсуждений (0)
Программная реализация 0.00 из 5.00 0 оценок









Обсуждение в статье: Программная реализация

Обсуждений еще не было, будьте первым... ↓↓↓

Отправить сообщение

Популярное:
Почему люди поддаются рекламе?: Только не надо искать ответы в качестве или количестве рекламы...
Организация как механизм и форма жизни коллектива: Организация не сможет достичь поставленных целей без соответствующей внутренней...
Как выбрать специалиста по управлению гостиницей: Понятно, что управление гостиницей невозможно без специальных знаний. Соответственно, важна квалификация...



©2015-2024 megaobuchalka.ru Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. (143)

Почему 1285321 студент выбрали МегаОбучалку...

Система поиска информации

Мобильная версия сайта

Удобная навигация

Нет шокирующей рекламы



(0.013 сек.)