|
변수를 수정했습니다..나타나긴 하는데..셀을 이동시키면 같이 이동해서 나타나야 하는데..
첫번째 ACol = 4, ARow = 0 에만 나타나고 이동하질 않아요..어케된건지 몰것네..
#include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: int StartX, StartY;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::StringGrid1MouseDown(TObject *Sender, TMouseButton Button,
: TShiftState Shift, int X, int Y)
: {
: StartX = X;
: StartY = Y;
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::StringGrid1SelectCell(TObject *Sender, int ACol, int ARow,
: bool &CanSelect)
: {
: int c, r;
: TRect t;
:
: StringGrid1->MouseToCell( StartX, StartY, c, r);
:
: if (r < 1) return;
: c = 4;
: ARow = r;
: t = StringGrid1->CellRect(c, r);
:
: ComboBox1->Left = StringGrid1->Left + t.Left+1;
: ComboBox1->Top = StringGrid1->Top + t.Top+1;
: ComboBox1->Width = (t.Right - t.Left)+3;
: ComboBox1->Visible = true;
: }
: //---------------------------------------------------------------------------
:
시후 님이 쓰신 글 :
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: int X, Y;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::SG1MouseDown(TObject *Sender, TMouseButton Button,
: TShiftState Shift, int X, int Y)
: {
: X, Y;
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::SG1SelectCell(TObject *Sender, int ACol, int ARow,
: bool &CanSelect)
: {
: int c, r;
: TRect t;
:
: SG1->MouseToCell( X, Y, c, r);
:
: if (r<1) return;
: c=4;
: ARow = r;
: t = SG1->CellRect(c, r);
:
: ComboBox1->Left = SG1->Left + t.Left+1;
: ComboBox1->Top = SG1->Top + t.Top+1;
: ComboBox1->Width = (t.Right - t.Left)+3;
: ComboBox1->Visible = true;
: }
: //---------------------------------------------------------------------------
:
: Q&A 에서 찾은걸 응용해봤거든요..그냥 갔다가 붙여봤어요..사실 개념은 잘 몰겠구요.
:
: 자세한 설명좀 부탁드립니다..책을 뒤저 봤는데..이런 이벤트 처리에 대해서는 잘 안나오더라구요..
:
: 고수님들 오늘도 부탁드립니다..꾸벅
:
:
:
|