|
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
OpenDialog1->Execute();
String fileName;
fileName = OpenDialog1->FileName;
char* po;
po = fileName.c_str();
Graphics::TBitmap *gbitmap = new Graphics::TBitmap( );
Byte *ptr;
try
{
gbitmap->LoadFromFile(po);
for (int y = 0; y < gbitmap->Height; y++)
{
ptr = (Byte *)gbitmap->ScanLine[y];
for (int x = 0; x < gbitmap->Width; x++)
ptr[x] = (Byte)y;
}
gbitmap->Height = this->PaintBox1->Height;
gbitmap->Width = this->PaintBox1->Width;
PaintBox1->Canvas->Draw(0,0,gbitmap);
delete gbitmap;
}
catch(...)
{
ShowMessage("woops");
}
}
대략 이렇게 코딩해서 비트맵을 열자니 그림이 짤려서 나오네요 1/3 정도...
비트맵을 뿌리고자 이러는건 아니구요 일단 비트맵부터 해보려고 하는데 쉽지 않네요.
ScanLine 을 어떻게 사용해야 제대로 사용하는걸까요??
도와주세요~
|