procedure Tfrmmain.ProgressBar1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin 这里体怎么写啊? //大概这样吧 with progressbar1 do begin position := (max-min)*(x/clientwidth)+min; end; end;
procedure TForm1.ProgressBar1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin with progressbar1 do begin position := round((max-min)*x/clientwidth)+min; end; end;
procedure TForm1.Button1Click(Sender: TObject); var P : Tpoint; begin P.X := 0; P.Y := Button1.Height; P := Button1.ClientToScreen(p); PopupMenu1.Popup(P.X,P.Y); //上面的语句是在Button的左下角弹出,此处还需要判断P点的位置是否处于屏幕的下部,以至于要向上弹出。然后改变一下P的参数 P.X := 0; P.Y := 0; P := Button1.ClientToScreen(p); PopupMenu1.Popup(P.X,P.Y); //将在左上角弹出
var cursorPos:TPoint;
begin
GetCursorPos(cursorPos);
PopupMenu1.Popup(cursorPos.X, cursorPos.Y);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
end;
弹出自己的popupmenu直接用popupmenu.popup(..)方法
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
这里体怎么写啊?
end;
procedure TForm1.Button1Click(Sender: TObject);
var
vPoint: TPoint;
begin
vPoint := Button1.Parent.ClientToScreen(Button1.BoundsRect.TopLeft);
vPoint.Y := vPoint.Y - PopupMenu1.Items.Count * 18 - 6 - 1;
PopupMenu1.Popup(vPoint.X, vPoint.Y);
end;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
这里体怎么写啊?
//大概这样吧
with progressbar1 do
begin
position := (max-min)*(x/clientwidth)+min;
end;
end;
Shift: TShiftState; X, Y: Integer);
begin
with progressbar1 do
begin
position := round((max-min)*x/clientwidth)+min;
end;
end;
var
P : Tpoint;
begin
P.X := 0;
P.Y := Button1.Height;
P := Button1.ClientToScreen(p);
PopupMenu1.Popup(P.X,P.Y);
//上面的语句是在Button的左下角弹出,此处还需要判断P点的位置是否处于屏幕的下部,以至于要向上弹出。然后改变一下P的参数
P.X := 0;
P.Y := 0;
P := Button1.ClientToScreen(p);
PopupMenu1.Popup(P.X,P.Y);
//将在左上角弹出
end;