如何知道鼠标点击的statusbar的位置
2009-11-07 17:11
260 查看
procedure TForm2.StatusBar1Click(Sender: TObject);
var
mpt: TPoint;
x: integer;
j: integer;
panel: integer;
begin
if (StatusBar1.SimplePanel) OR (StatusBar1.Panels.Count = 0) then
begin
Memo1.Lines.Add('Clicked on a StatusBar, no Panels');
Exit;
end;
mpt := Mouse.CursorPos;
mpt := StatusBar1.ScreenToClient(mpt);
panel := -1;
x := 0;
for j := 0 to StatusBar1.Panels.Count - 1 do
begin
x := x + StatusBar1.Panels[j].Width;
if mpt.x < x then
begin
panel := j;
Break;
end;
end;
if panel = -1 then
panel := -1 + StatusBar1.Panels.Count;
Memo1.Lines.Add(Format('Clicked on StatusPanel %d', [panel]));
end;
var
mpt: TPoint;
x: integer;
j: integer;
panel: integer;
begin
if (StatusBar1.SimplePanel) OR (StatusBar1.Panels.Count = 0) then
begin
Memo1.Lines.Add('Clicked on a StatusBar, no Panels');
Exit;
end;
mpt := Mouse.CursorPos;
mpt := StatusBar1.ScreenToClient(mpt);
panel := -1;
x := 0;
for j := 0 to StatusBar1.Panels.Count - 1 do
begin
x := x + StatusBar1.Panels[j].Width;
if mpt.x < x then
begin
panel := j;
Break;
end;
end;
if panel = -1 then
panel := -1 + StatusBar1.Panels.Count;
Memo1.Lines.Add(Format('Clicked on StatusPanel %d', [panel]));
end;
相关文章推荐
- 现在有动态生成table若干行,每行里会有一个button.当鼠标点击其中一个button时.如何让程序知道是点在第几行的button上
- Unity中物体如何移动到鼠标点击位置
- 如何让层在鼠标在层外的位置点击时隐藏
- trackBar控件如何使滑块的位置为鼠标点击的位置
- VB.Net WebBrowser如何取得鼠标点击位置的标签
- Ext的GridPanel中,如何知道你鼠标点击了哪一行
- 如何用opencv (c++)捕捉鼠标点击位置
- 鼠标在slide控件的任意位置上点击,滑块滑动到该位置是如何实现的,有什么属性吗?
- DevExpress PopMenu 如何在鼠标点击的位置显示右键菜单
- 让图片直线移动到鼠标点击位置,类似游戏里的人物走动!
- win10鼠标点击文件后的颜色消失了,如何恢复?
- 如何使用SendMessage函数实现模拟鼠标点击按钮事件?
- js获取鼠标点击事件的相对位置
- OpenGL中如何实现通过鼠标点击选取对象(正交投影)
- 如何知道某个对象在 Virtual SAN 中的位置?
- 知道你的手机是如何确定你的位置的吗
- Android如何判断当前点击位置是否在圆的内部
- FB4 AS3 如何获取advancedDataGrid中鼠标点击checkbox列的行号
- swift 有一排按钮,点击按钮时,被点击的按钮如何向中间的位置移动
- 如何获得 Qt窗口部件在主窗口中的位置--确定鼠标是否在某一控件上与在控件上的位置