上面是使用介面
MainMenu1上File-Open、Save,、Set-Color、、Help-說明-作者-離開
MainMenu1上File-Open、Save,、Set-Color、、Help-說明-作者-離開
Open語法:
OpenPictureDialog1 -> Execute();
Image1 -> Picture -> LoadFromFile( OpenPictureDialog1 -> FileName );
Save語法:
AnsiString as;
as = ChangeFileExt(SavePictureDialog1->FileName,".BMP");
if(SavePictureDialog1 -> Execute())
{
Image1 -> Picture -> SaveToFile( SavePictureDialog1 -> FileName );
ShowMessage(OpenPictureDialog1->FileName + " Saved to " + as);
}
Color語法:
ColorDialog1 -> Execute();
Image1 -> Canvas -> Pen -> Color = ColorDialog1 -> Color;
另外設計一個說明選項方便使用者上手:
ShowMessage("Step 1. 先從File中Open...挑選出最喜愛的圖檔且為BMP格式!!");
ShowMessage("Step 2. 右鍵點選為設定初始座標、左鍵點選為以初始座標至目前點選座標兩點取一直線!!");
ShowMessage("Step 3. 滑鼠中鍵顯示目前鼠標所在位置顏色");
ShowMessage("Set中Color可改變畫筆顏色");
作者語法:
ShowMessage("數位媒體概論作業一 Ver9.0 Beta \n \n by 97360961 資工二乙林永祥");
離開語法:
Close();
OpenPictureDialog1 -> Execute();
Image1 -> Picture -> LoadFromFile( OpenPictureDialog1 -> FileName );
Save語法:
AnsiString as;
as = ChangeFileExt(SavePictureDialog1->FileName,".BMP");
if(SavePictureDialog1 -> Execute())
{
Image1 -> Picture -> SaveToFile( SavePictureDialog1 -> FileName );
ShowMessage(OpenPictureDialog1->FileName + " Saved to " + as);
}
Color語法:
ColorDialog1 -> Execute();
Image1 -> Canvas -> Pen -> Color = ColorDialog1 -> Color;
另外設計一個說明選項方便使用者上手:
ShowMessage("Step 1. 先從File中Open...挑選出最喜愛的圖檔且為BMP格式!!");
ShowMessage("Step 2. 右鍵點選為設定初始座標、左鍵點選為以初始座標至目前點選座標兩點取一直線!!");
ShowMessage("Step 3. 滑鼠中鍵顯示目前鼠標所在位置顏色");
ShowMessage("Set中Color可改變畫筆顏色");
作者語法:
ShowMessage("數位媒體概論作業一 Ver9.0 Beta \n \n by 97360961 資工二乙林永祥");
離開語法:
Close();
Click按鈕則是點選後出現"HELLO"
左下角有X,Y座標與R,G,B所佔比重
Label1 -> Caption = AnsiString(X);
Label2 -> Caption = AnsiString(Y);
Label3 -> Caption = AnsiString(GetRValue(Image1->Canvas->Pixels[X][Y]));
Label4 -> Caption = AnsiString(GetGValue(Image1->Canvas->Pixels[X][Y]));
Label5 -> Caption = AnsiString(GetBValue(Image1->Canvas->Pixels[X][Y]));
畫線:
if(Button == mbRight)
Image1->Canvas->MoveTo(X,Y);
if(Button == mbLeft)
Image1->Canvas->LineTo(X,Y);
Label1 -> Caption = AnsiString(X);
Label2 -> Caption = AnsiString(Y);
Label3 -> Caption = AnsiString(GetRValue(Image1->Canvas->Pixels[X][Y]));
Label4 -> Caption = AnsiString(GetGValue(Image1->Canvas->Pixels[X][Y]));
Label5 -> Caption = AnsiString(GetBValue(Image1->Canvas->Pixels[X][Y]));
畫線:
if(Button == mbRight)
Image1->Canvas->MoveTo(X,Y);
if(Button == mbLeft)
Image1->Canvas->LineTo(X,Y);
點滑鼠中鍵可得目前鼠標所在位置顏色:
if(Button == mbMiddle)
Panel1->Color=RGB(GetRValue(Image1->Canvas->Pixels[X][Y]),
GetGValue(Image1->Canvas->Pixels[X[Y]),GetBValue(Image1->Canvas->Pixels[X][Y]));
Panel1->Color=RGB(GetRValue(Image1->Canvas->Pixels[X][Y]),
GetGValue(Image1->Canvas->Pixels[X[Y]),GetBValue(Image1->Canvas->Pixels[X][Y]));
沒有留言:
張貼留言