執行時改變控制項大小執行時移動控制項MINICAR版

2021-04-13 07:07:38 字數 1619 閱讀 4365

執行時改變控制項大小執行時移動控制項minicar版

vs2005.net編寫,網上找了找,見別人寫得挺複雜,自己寫了乙個. 附件居然不能上傳.就把**發到下面吧,

有個奇怪現象就是,vb6中新建工建,拖個picturebox框出來,拷入以下**即可,但vb.net中是不行的.如mousemove事件你必須新建工程,拖個picturebox控制項出來,雙擊picturebox,再找到mousemove事件,再在**中新增有效**,個中何解,我也不知,知道的告訴我一聲,qq182226947,[email protected]

public class form1

dim sx

dim sy

dim sizeadj as boolean

private sub picturebox1_mousedown(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles picturebox1.mousedown

sx = e.x

sy = e.y

end sub

private sub picturebox1_mousemove(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles picturebox1.mousemove

if (e.x > picturebox1.width - 8 and e.y > picturebox1.height - 8) or sizeadj = true then

picturebox1.cursor = cursors.sizenwse

if e.button = windows.forms.mousebuttons.left then

sizeadj = true

picturebox1.width = sx + (e.x - sx)

picturebox1.height = sy + (e.y - sy)

end if

else

if e.button = windows.forms.mousebuttons.left then

picturebox1.left = picturebox1.left + (e.x - sx)

picturebox1.top = picturebox1.top + (e.y - sy)

end if

picturebox1.cursor = cursors.default

end if

end sub

private sub picturebox1_click(byval sender as system.object, byval e as system.eventargs) handles picturebox1.click

end sub

private sub picturebox1_mouseup(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles picturebox1.mouseup

sizeadj = false

end sub

end class

在執行時改變控制項的大小

游標在控制項不同位置時的樣式 由於拐角這點手動精確實在困難 所以用範圍 範圍 3 這樣很容易就找到這一點了 procedure ctrlmousemove ctrl twincontrol shift tshiftstate x,y integer begin with ctrl do begin ...

delphi 程式執行時移動控制項

程式在執行時使用者需要對一些控制項進行重新移動布局,下次進入介面時顯示布局後的 方法1 每移動控制項時就把位置寫入ini檔案中 只需在控制項的onmousedown事件寫如下 procedure tfmain.speedbutton4mousedown sender tobject button t...

Silk 執行時 控制項 屬性

1.如果乙個silk的識別物件是在執行時載入的某個屬性且無法事先定義,可以用動態tag識別來作一定的操作。e.g.我這裡的error dialog裡的error message是根據具體的頁面字段報錯,所以我無法事先宣告此lable物件的tag值。2.我們首先用scripted.來重新識別物件。3....