VB工程 百例92 拍照窗體

2021-06-03 17:14:38 字數 1123 閱讀 2016

option explicit

private sub form_load()

dim wbitmap '定義變數

me.autoredraw = true'使窗體能夠自動重繪

wbitmap = createcompatiblebitmap(me.hdc, 0, 0) '建立乙個位圖,高度和寬度均為0

selectobject me.hdc, wbitmap '將建立的點陣圖放到裝置環境中

me.refresh'重繪窗體

end sub

option explicit

public declare function createcompatiblebitmap lib "gdi32" (byval hdc as long, byval nwidth as long, byval nheight as long) as long

public declare function selectobject lib "gdi32" (byval hdc as long, byval hobject as long) as long

'createcompatiblebitmap  函式功能:該函式建立與指定的裝置環境相關的裝置相容的點陣圖。

'函式原型:hbitmap createcompatiblebitmap(hdc hdc,int nwidth,int nheight);

'引數:   hdc: 裝置環境控制代碼。

'nwidth:指定點陣圖的寬度,單位為畫素。 nheight:指定點陣圖的高度,單位為畫素。

''selectobject  函式功能:該函式選擇一物件到指定的裝置上下文環境中,該新物件替換先前的相同型別的物件。

' 函式原型:hgdiobj selectobject(hdc hdc, hgdiobj hgdiobj);

'引數:hdc:裝置上下文環境的控制代碼。   hgdiobj:被選擇的物件的控制代碼,該指定物件必須由如下的函式建立。

'位圖:createbitmap, createbitmapindirect, createcompatible bitmap, createdibitmap, createdibsection

'(只有記憶體裝置上下文環境可選擇位圖,並且在同一時刻只能乙個裝置上下文環境選擇位圖)。

'

VB工程 百例74 窗體變色

option explicit private sub form mousedown button as integer,shift as integer,x as single,y as single if button 2 then 若單擊滑鼠右鍵 popupmenu mnuformcolor ...

2016百度之星複賽 1003 拍照 掃瞄線

有n條船平行於x軸,已知初始時刻的位置,向平行於x軸正向或反向走。所有船速度大小一致。現在海哥站在x軸上,要給船拍照,角度為朝向 y方向的固定90度,可以在任意時刻 任意位置拍,問何時拍下的完整的船數量最多。對於橫座標為 x,y 縱座標為z的船而言,海哥可以移動的區間為 y z,x z 且y z x...

VB工程 百例64游標位置

option explicit private sub command1 click txt1.text 歡迎來到廊坊師範學院 end sub private sub command2 click txt1.text end sub private sub command3 click endend...