![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
#include <vcl.h>
#pragma hdrstop #include"Unit1.h"; #include"Unit2.h"; #include"Unit3.h"; #include"Unit4.h"; //----------------------------------------------------------------------------------------------------------------------------- -- #pragma package (smart_init) #pragma link "CSPIN" #pragma resource "*.dfm" TForm1 *Form1; //----------------------------------------------------------------------------------------------------------------------------- -- __fastcall TForm1: :TForm1 : :TForm1(TComponent* Owner) : TForm(Owner) { } //----------------------------------------------------------------------------------------------------------------------------- -- void TForm1: : EvalMArkedArea(void) { float tmp; tmp=(float) sx1/Image1->Width; startx=tmp*Image1->Picture->Bitmap->Width; tmp=(float) sy1/Image->Height; starty=tmp*Image->Picture->Bitmap->Height; tmp=(float) sx2/Image->Wigth; endx = tmp*Image->Picture->Bitmap->Wugth; tmp=(float) sy2/Inage->Height; endy = tmp*Image->Picture->Bitmap->Height; if (startx>endx) {tmp=startx; statx=endx; endx=tmp;} if (starty>endy) {tmp=starty; starty=endy; endy= tmp;} } float TForm1: :BmpToImageX (float x) { float tmp=(float)x/Image1->Picture->Bitmap->Wigth; return tmp*Image2->Picture->Bitmap->Wigth; } float TForm1: :ImageToBmpY (float y) { float tmp=(float)y/Image1->Picture->Bitmap->Height; return tmp*Image2->Picture->Bitmap->Height; } float TForm1: :BmpToImageX (float x) { float tmp=(float)x/Image2->Picture->Bitmap->Wigth; return tmp*Image1->Picture->Bitmap->Wigth; } float TForm1: :ImageToBmpY (float y) { float tmp=(float)y/Image2->Picture->Bitmap->Height; return tmp*Image1->Picture->Bitmap->Height; } float TForm1: : Level (TColor clr) { int cl=clr, green, blue, red; float res; blue=(cl&0x00FF0000)>>16; green=(cl&0x0000FF00)>>8; red=cl&0x000000FF; switch(Raidogroup1->ItemIndex) { case 0: res=red; break; case 1: res=blue; break; case 2: res=green; break; case 3: res=(blue+green+red)/3; break; } res=225-res; if (avgbg !=-1) { switch(Radiogroup2->ItemIndex) { case 0: res-=avgbg; break; case 1: res=res<avgbg ? 0: res; break; } } //if (CheckBox1->Checked) return 255-res; //else return res; return res; } //---------------------------------------------------------------------------------------------------------------------------- -- |
![]() |
![]() |
![]() |
#2 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
void __Fastcall TForm1: :N7Click(TObject *Sender)
{ Form3->Show(); } //---------------------------------------------------------------------------------------------------------------------------- -- void __TForm1: :ClearSelection(void) { delete Image2; Image2=new TImage(this); Image2->Parent=this; Image2->Top=1; Image-> Left=1; Image2->Left=1; Image2->Align=alClient; Image2->Transparent=true; Image2->OnMouseDown=Image2MouseDown; Image2->OnMouseup=Image2MouseUp; } void __fastcall TForm: : Image2MouseDown(TObject *Sender, TMouseButton Button, TSiftState Shift, int X, int Y) { if(!setbg) { sx1=X; sy1=Y; } } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm: :Image2MouseUp(TObject *Sender, TMouseButton, TsiftState Shift, int X, int Y) { if(setbg) { bg[bgb]=Level (Image1->Canvas->Pixels[ImageToBmpX(x)][ImageToBmp(Y)]); if(bgb==2) { bgb=0; setbg=false; avgbg=(bg[0]+bg[1]+bg[2])/3; ShowMessage("Фон задан успешно"); StatusBar1->Panels->Items[1]->Text=""; } else { sx2=X; sy2=Y; DrawSelRect(); } } //---------------------------------------------------------------------------------------------------------------------------- -- void TForm1: :DrawMaxes(void) { Image2->Canvas->Pen->Style=psSolid; Image2->Canvas->Pen->Color=clBlack; Image2->Canvas->MoveTo(BmpToImageX(startx), maxy); Image2->Canvas->LineTo(BmpToImageX(endx), maxy); Image2->Canvas->MoveTo(BmpToImageY(starty)); Image2->Canvas->LineTo(BmpToImageY(endy)); } void __fastcall TForm1: :FormPaint(TObject *Sender) { if(sel) DrawRect(); if(eval) DrawMaxes(); } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :OpenSpotExecute(TObject *Sender) { if (OpenPictureDialog1->Execute()) { ClearSelection(); Image1->Picture->LoadFormFile(OpenPictureDialog1->FileName); CalcIntens->Enabled=true; BuildGraph->Enabled=true; SetBackgound->Enabled=true; StatusBar1->Panels->Items[0]->Text="Изображение готово к работе"; } } //---------------------------------------------------------------------------------------------------------------------------- -- |
![]() |
![]() |
![]() |
#3 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
void __fastcall TForm1: :BuildGraphExecute(TObject *Sender)
{ Form2->Series1->Clear(); Form2->LineSeries1->Clear(); EvalMarkedArea(); int hstep=(endx-startx)/CSpinEdit1->Value; int vstep=(endy-starty)/CSpinEdit1->Value; float val, maxval; for(int i=0; <CSpinEdit1->Value; i++ ); { x=startx+i*hstep; maxval=val=0; for(y=starty; y<=endy; y++0) val+=Level(Image1->Canvas->Pixels[x][y]); Form2->Series1->AddXY(x, val, "", clRed); } for(int i=0; i<CSpinEdit1->Value; i++) { y=starty+i*vstep; maxval=val=0; for(x=startx; x<=endx; y++0) val+=Level(Image1->Canvas->Pixels[x][y]); Form2->Series1->AddXY(y, val, "", clRed); } maxval=0; for(int i=0; i< Form2->Series1->YValues->Count(); i++) if(Form2->Series1->YValues->Value[i]>maxval) { maxval=Form2->Series1->Yvalue->Value[i]; maxx=Form2->series1->XValues->Value[i]; } maxval=0; for(int i=0; i< Form2->LineSeries1->YValues->Count(); i++) if(Form2->LineSeries1->YValues->Value[i]>maxval) { maxval=Form2->LineSeries1->Yvalue->Value[i]; maxy=Form2->LineSeries1->XValues->Value[i]; } maxx=BmpToImageX(maxx); maxy=BmpToImageY(maxy); DrawMaxes(); Form2->Show; } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :CalcIntensExecute(Tobject *Sender) { float sum=0; int i, j; EvalMarkedArea(); for (j=starty; j<=endy; j++) for(i=startx; i<=endx; i++) sum+=Level(Image1->Canvas->Pixels[i][j])/255; int nop=(endx-startx)*(endy-starty); last_iids=sum; Label1->Caption="Общая интенс.: "+FloatToStrF(sum, ffGeneral, 3,6); Label2->Caption="Средняя интенс.: "+FloatToStrF(sum/nop, ffGeneral, 3,8); Label3->Caption="Число точек: "+IntToStr(nop); PutIntoTable->Enbled=true; } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :PutIntoTableExecute(TObject *Sender) { // if(CheckBox2->Checked) Form3->AddEtalon(last_iids); else Form3->AddSample(last_iids); } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :SetBackgroundExecute(TObject *Sender) { avgbg=-1; setbg=true; bgb=0; StatusBar1->Panels->Items[1]->Text= "Задайте 1-ю точку фона(щелкните по изображению)..."; } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :ExitExecute(TObject *Sender) { Close(); } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :AboutExecute(TObject *Sender) { Form4->ShowModal(); } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm1: :ShowTabExecute(TObject *Sender) { Form3->Show(); } |
![]() |
![]() |
![]() |
#4 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
#include <vcl.h>
#pragma hdrstop #include "Unit2.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm2 *Form2; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { |
![]() |
![]() |
![]() |
#5 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
#include <vcl.h>
#pragma hdrstop #include "Unit3.h" //---------------------------------------------------------------------------------------------------------------------------- -- #pragma package(smart_init) #pragma resource ".dfm" TForm3 *TForm3; //---------------------------------------------------------------------------------------------------------------------------- -- __fastcall TForm2: :TForm2(TComponent* Owner) : TForm(Owner) { } void TForm3: :AddEtalon(float iids) { // StringGrid1->Cells[0][StringGrid1->RowCount-1]=IntToStr(StringGrid1->RowCount-1); StringGrid1->Cells[1][StringGrind1->RowCount-1]=FloatToStr(iids); StringGrid1->RowCount++; } void TForm3: :AddSample (float iids) { // StringGrid2->Cells[0][StringGrind2->RowCount-1]=IntToStr(StringGrind2->Rowcount-1); StringGrid2->Cells[1][StringGrind2->RowCount-1]=FloatToStr(iids); StringGrid2->RowCount++; } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :FormCreate (Tobject *Sender) { StringGrid1->Cells[0][0]="Номер"; StringGrid1->Cells[1][0]="ИИДС"; StringGrid1->Cells[2][0]="Кол-во"; StringGrid1->Cells[3][0]="К"; StringGrid2->Cells[0][0]="Номер"; StringGrid2->Cells[1][0]="ИИДСС"; StringGrid2->Cells[2][0]="Кол-во"; } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :BitBtn2Click (TObject *Sender) { int n=0; float sumk=0; for(int i=0; i<StringGrid->RowCount; i++) { if(SAtringGrid1->1->Cells[2][i]!="") { n++; StringGrid1->Cells[3][i]=FloatToStr(StrToFloat(StringGrid1->Cells[1][i])/StrToFloat(StringGrid1->Cells[2][i])); } sumk+=StrToFloat(StringGrid1->Cells[3][i]); } k_avd=sumk/n; Label4->Caption=FloatToStr(k_avg); } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :BitBtn3Click(TOblect *Sender) { if(OpenDialog1->Execute()) { if(FileExists(OpenDialog1->FileName)) DeleteFile(OpenDialog1->FileName)) Table1->Close; Table1->TableName=OpenDialog1->FileName; Table1->Createble(); Table1->Open(); for(int i=1; <StringGrid1->RowCount; i++) { Table1->Append(); Table1->FieldValues["num"]=StringGrid1->Cells[0][i]; Table1->FieldValues["iids"]=StringGrid1->Cells[1][i]; Table1->FieldValues["kolvo"]=StringGrid1->Cells[2][i]; Table1->FieldValues["kkk"]=StringGrid1->Cells[3][i]; } table->Close(); } } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :Bitbtn4Click(TObject *Sender) { if(OpenDialog1->Execute()) { Table1->Close; Table1->TableName=OpenDialog1->FileName; Table1->Open(); int i=StringGrid1->RowCount-1; StringGrid1->RowCount+=Table1->RecordCount; while(!Table1->Eof) { if(!Table1->FiledByName("num")->IsNull) StringGrid1->Cells[0][i]=Table1->FieldValues["num"]; if(!Table1->FiledByName("iids")->IsNull) StringGrid1->Cells[1][i]=Table1->FieldValues["iids"]; if(!Table1->FiledByName("kolvo")->IsNull) StringGrid1->Cells[2][i]=Table1->FieldByName("kolvo")->AsString; if(!Table1->FiledByName("kkk")->IsNull) StringGrid1->Cells[3][i]=Table1->FieldByName("kkk")->AsString; i++; Table1->Next(); } Table->Close(); } } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :BitBtn7Click(TObject *Sender) { for(int i=1; i<StringGrid2->RowCount; i++) { if(StringGrid2->Cells[1][i]!="") StringGrid2->Cells[2][i]=FloatToStr(StrToFloat(StringGrid2->Cells[1][i])/k_avg); } } //---------------------------------------------------------------------------------------------------------------------------- -- void __fastcall TForm3: :FormResize(TObject *Sender) { Panel1->Width=ClientWidth/2; } |
![]() |
![]() |
![]() |
#6 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
-
#include <vcl.h> #pragma hdrstop #include "Unit4.h" //----------------------------------------------------------------------------------------------------------------------------- -- #pragma package(smart_init) #pragma resource "*.dfm" TForm4 *Form4; //----------------------------------------------------------------------------------------------------------------------------- -- __fastcall TForm4: :TForm4(TComponent* Owner) : TForm(Owner) { } |
![]() |
![]() |
![]() |
#7 |
Старожил
Регистрация: 30.12.2009
Сообщений: 11,434
|
![]()
А вы вообще имеете представление об файлообменниках файлах и архивах?
И где ваше задание, бюджет? Далее это на c++ не таняет. Это код для C++ Builder'а. |
![]() |
![]() |
![]() |
#8 |
Регистрация: 25.03.2012
Сообщений: 7
|
![]()
Я не делал такие,сложные задания,листинг и скопирован с билдера,в программе нет самой формы,задание обработка хромотогафических пятен и вывод графика для них,буджет 1-2 тыс руб
|
![]() |
![]() |
![]() |
#9 |
Регистрация: 20.01.2012
Сообщений: 3
|
![]()
E-mail: zerg202@yandex.ru
ICQ: 453939604 |
![]() |
![]() |
![]() |
#10 |
Новичок
Джуниор
Регистрация: 18.09.2012
Сообщений: 0
|
![]()
Skype steferttone, обсудим если актуально
|
![]() |
![]() |
![]() |
|
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
кто сможет написать програмку по листингу | алексей errrr | Фриланс | 4 | 20.11.2011 11:18 |
Написать программу для перевода из 16-ричной системы счисления в 10-тичную, использовать процедурую(написать Delphi) | BLADIMIR | Помощь студентам | 3 | 07.09.2011 16:35 |
Написать программу | Holzz | Фриланс | 3 | 16.07.2011 12:27 |
Комментарии к листингу(калькулятор,текстовый редактор) С++ Builder | lexoff | Помощь студентам | 2 | 30.05.2011 19:31 |
Зделать блок-схему или алгоритм по листингу!!! | metamfetamin | Паскаль, Turbo Pascal, PascalABC.NET | 4 | 04.11.2007 10:08 |