if(StringGrid1->Cursor == crHSplit) {...}
void __fastcall TForm1::StringGrid1MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
Label1->Caption = CursorToString(StringGrid1->Cursor);
Label2->Caption = CursorToString(Screen->Cursor);
}
//---------------------------------------------------------------------------
private:
int cr_HSplit, cr_VSplit;
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Screen->Cursor = crHSplit;
cr_HSplit = (TCursor)GetCursor();
Screen->Cursor = crVSplit;
cr_VSplit = (TCursor)GetCursor();
Screen->Cursor = crDefault;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
if((TCursor)GetCursor() == cr_HSplit || (TCursor)GetCursor() == cr_VSplit)
Label1->Caption = "linia";
else
Label1->Caption = "komórka";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
#define COL_DOLICZ 1
int width;
width = 0;
for(int i = 0; i < StringGrid1->ColCount; i++)
if(i != COL_DOLICZ)
width += StringGrid1->ColWidths[i];
StringGrid1->ColWidths[COL_DOLICZ] = StringGrid1->Width - width;
}
Powrót do Ogólne problemy z programowaniem
Użytkownicy przeglądający ten dział: Brak zalogowanych użytkowników i 39 gości