3 个解决方案
#1
简单的就用一个 没有标题栏且只有一个下拉菜单的form就可以了!
实在不行了,可以自己画一个试试!
实在不行了,可以自己画一个试试!
#2
这是我做的弹出菜单的例子
你可以看看
void __fastcall TPrintContentEdit::StringGrid1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
int tCol,tRow;
StringGrid1->MouseToCell(X,Y,tCol,tRow);
if(tCol==0&&tRow>0)//点击在第一列上
{
int tTop=Y;//(StringGrid1->RowHeights[0]+1)*(tRow-StringGrid1->TopRow);
int tLeft=StringGrid1->ColWidths[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu3->Popup(tPoint.x,tPoint.y);
}
if(tCol>0&&!tRow)
{
int tLeft=X;
// for(int k=0;k<tCol;k++)
// tLeft+=StringGrid1->ColWidths[k]+1;
int tTop=StringGrid1->RowHeights[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu2->Popup(tPoint.x,tPoint.y);
}
}
你可以看看
void __fastcall TPrintContentEdit::StringGrid1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
int tCol,tRow;
StringGrid1->MouseToCell(X,Y,tCol,tRow);
if(tCol==0&&tRow>0)//点击在第一列上
{
int tTop=Y;//(StringGrid1->RowHeights[0]+1)*(tRow-StringGrid1->TopRow);
int tLeft=StringGrid1->ColWidths[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu3->Popup(tPoint.x,tPoint.y);
}
if(tCol>0&&!tRow)
{
int tLeft=X;
// for(int k=0;k<tCol;k++)
// tLeft+=StringGrid1->ColWidths[k]+1;
int tTop=StringGrid1->RowHeights[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu2->Popup(tPoint.x,tPoint.y);
}
}
#3
good
#1
简单的就用一个 没有标题栏且只有一个下拉菜单的form就可以了!
实在不行了,可以自己画一个试试!
实在不行了,可以自己画一个试试!
#2
这是我做的弹出菜单的例子
你可以看看
void __fastcall TPrintContentEdit::StringGrid1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
int tCol,tRow;
StringGrid1->MouseToCell(X,Y,tCol,tRow);
if(tCol==0&&tRow>0)//点击在第一列上
{
int tTop=Y;//(StringGrid1->RowHeights[0]+1)*(tRow-StringGrid1->TopRow);
int tLeft=StringGrid1->ColWidths[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu3->Popup(tPoint.x,tPoint.y);
}
if(tCol>0&&!tRow)
{
int tLeft=X;
// for(int k=0;k<tCol;k++)
// tLeft+=StringGrid1->ColWidths[k]+1;
int tTop=StringGrid1->RowHeights[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu2->Popup(tPoint.x,tPoint.y);
}
}
你可以看看
void __fastcall TPrintContentEdit::StringGrid1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
int tCol,tRow;
StringGrid1->MouseToCell(X,Y,tCol,tRow);
if(tCol==0&&tRow>0)//点击在第一列上
{
int tTop=Y;//(StringGrid1->RowHeights[0]+1)*(tRow-StringGrid1->TopRow);
int tLeft=StringGrid1->ColWidths[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu3->Popup(tPoint.x,tPoint.y);
}
if(tCol>0&&!tRow)
{
int tLeft=X;
// for(int k=0;k<tCol;k++)
// tLeft+=StringGrid1->ColWidths[k]+1;
int tTop=StringGrid1->RowHeights[0];
TPoint tPoint;
tPoint.x=tLeft;
tPoint.y=tTop;
tPoint=StringGrid1->ClientToScreen(tPoint);
PopupMenu2->Popup(tPoint.x,tPoint.y);
}
}
#3
good