|
Y 값을 주목하세요.
Y 는 확실히 항상 증가하기만 합니다.
ㅋㅊㅌㅍㅌㅋㅊㅍㅌㅍ 님이 쓰신 글 :
: 동적 제거 하려고하는데요. 아는데로 해봤는데
: 몇번은 동적제거가 돼다가
: 나중에는 오류가 나네요.
: Project Project1.exe raised exception class EAccessViolation with message
: 'Access violation at address 00000000. Read of address 00000000'. Process stopped.
: Use Step or Run to continue. 이라고납니다.
:
: 이유와 방법을 제발제발알려주세요.
:
: //---------------------------------------------------------------------------
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: TImage *I[150][150];
: int X=0;
: int Y=0;
: int i=0;
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
: I[X][Y] = new TImage(Form1->ScrollBox1);
: I[X][Y]->Name = String("I") + X;
: I[X][Y]->Width = 189;
: I[X][Y]->Height = 91;
: I[X][Y]->Stretch = true;
: I[X][Y]->AutoSize = false;
: I[X][Y]->Visible = true;
: I[X][Y]->Parent = ScrollBox1;
: I[X][Y]->Picture->LoadFromFile("C:\\dsfsdf.bmp");
: I[X][Y]->Left = Y;
: I[X][Y]->Top = 0;
: I[X][Y]->Transparent = true;
:
: Y++;
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button2Click(TObject *Sender)
: {
: for(int i = 0; i <= Y; i++)
: {
: if(i <= Y)
: {
: delete I[0][i];
: }
: else
: {
: Y = 0;
: }
: }
:
: }
: //---------------------------------------------------------------------------
|