Changeset 303 for trunk/Include/Classes/System/Windows/Forms/Control.ab
- Timestamp:
- Aug 24, 2007, 11:14:46 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Windows/Forms/Control.ab
r285 r303 4 4 #define __SYSTEM_WINDOWS_FORMS_CONTROL_AB__ 5 5 6 #require <windows/WindowHandle.sbp>7 6 #require <Classes/System/Windows/Forms/misc.ab> 8 7 #require <Classes/System/Windows/Forms/CreateParams.ab> … … 17 16 #require <Classes/System/Drawing/Rectangle.ab> 18 17 #require <Classes/System/Runtime/InteropServices/GCHandle.ab> 18 #require <Classes/ActiveBasic/Windows/WindowHandle.sbp> 19 19 #require <Classes/ActiveBasic/Strings/Strings.ab> 20 20 … … 44 44 45 45 Override Function CompletedSynchronously() As Boolean 46 Return F ALSE46 Return False 47 47 End Function 48 48 … … 74 74 75 75 Class Control 76 76 77 ' Inherits IWin32Window 77 78 Public … … 80 81 Function AllowDrop() As Boolean 81 82 End Function 83 84 'Anchor 85 'AutoScrollOffset 86 'AutoSize 87 'BackColor下 88 'BackgroundImage 89 'BackgroundImageLayout 90 '-BindingContext 91 'Bottom 下 92 'Bounds 下 93 'CanFocus 94 'CanSelect 95 'Capture 96 '-CausesValidation 97 'CheckForIllegalCrossThreadCalls 82 98 83 99 /*Override*/ Function Handle() As HWND … … 201 217 Return b.Top + b.Height 202 218 End Function 203 219 /* 204 220 Const Function PointToScreen(p As Point) As Point 205 221 PointToScreen = New Point 206 ret.X = p.X207 ret.Y = p.Y208 wnd.ClientToScreen(ByVal VarPtr(PointToScreen) As *POINTAPI)222 PointToScreen.X = p.X 223 PointToScreen.Y = p.Y 224 wnd.ClientToScreen(ByVal ObjPtr(PointToScreen) As *POINTAPI) 209 225 End Function 210 226 211 227 Const Function PointToClient(p As Point) As Point 212 228 PointToScreen = New Point 213 ret.X = p.X214 ret.Y = p.Y215 wnd.ScreenToClient(ByVal VarPtr(PointToScreen) As *POINTAPI)216 End Function 217 229 PointToClient.X = p.X 230 PointToClient.Y = p.Y 231 wnd.ScreenToClient(ByVal ObjPtr(PointToClient) As *POINTAPI) 232 End Function 233 */ 218 234 Const Function RectangleToScreen(r As Rectangle) As Rectangle 219 235 Dim rc = r.ToRECT … … 223 239 224 240 Const Function RectangleToClient(r As Rectangle) As Rectangle 225 Dim rc As RECT 226 rc = r.ToRECT() 241 Dim rc = r.ToRECT() 227 242 wnd.ScreenToClient(rc) 228 243 Return New Rectangle(rc) … … 230 245 231 246 Const Function InvokeRequired() As Boolean 232 Return wnd.ThreadI D<> GetCurrentThreadId()247 Return wnd.ThreadId <> GetCurrentThreadId() 233 248 End Function 234 249 … … 239 254 Virtual Sub BackColor(c As Color) 240 255 c = bkColor 241 Dim e As EventArgs 242 OnBackColorChanged(e) 256 OnBackColorChanged(New EventArgs) 243 257 End Sub 244 258 … … 248 262 249 263 Const Function IsHandleCreated() As Boolean 250 Return wnd.HWnd <> 0 264 Return wnd.HWnd <> 0 Or IsWindow(wnd.HWnd) <> FALSE 251 265 End Function 252 266 … … 259 273 260 274 Sub Control() 275 Debug 261 276 Dim sz = DefaultSize() 262 277 Control("", 100, 100, sz.Width, sz.Height) … … 279 294 280 295 Sub Control(parent As Control, text As String, left As Long, top As Long, width As Long, height As Long) 281 This.parent = VarPtr(parent)296 This.parent = parent 282 297 Control(text, left, top, width, height) 283 298 End Sub … … 296 311 '--------------------------------------------------------------------------- 297 312 ' Public Methods 298 313 /* 299 314 ' 同期関数呼出、Controlが作成されたスレッドで関数を実行する。 300 315 ' 関数は同期的に呼び出されるので、関数が終わるまでInvokeは制御を戻さない。 … … 317 332 Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(asyncInvokeData) 318 333 wnd.PostMessage(WM_CONTROL_BEGININVOKE, 0, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch)) 319 Return pAsyncResult334 Return asyncResult 320 335 End Function 321 336 … … 327 342 Return arInvoke.Result 328 343 End Function 329 344 */ 330 345 ' 与えられたウィンドウハンドルがControl(若しくはその派生クラス)の 331 346 ' インスタンスに対応するものであった場合、 … … 360 375 361 376 Sub Show() 377 Debug 362 378 wnd.Show(SW_SHOW) 363 379 End Sub … … 396 412 Virtual Sub CreateHandle() 397 413 Dim createParams = CreateParams() 398 Dim gch = GCHandle.Alloc(This)399 TlsSetValue(tlsIndex, GCHandle.ToIntPtr(gch) As VoidPtr)414 Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(This) 415 TlsSetValue(tlsIndex, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch) As VoidPtr) 400 416 With createParams 401 417 Dim hwndParent = 0 As HWND … … 516 532 Private 517 533 ' Member variables 518 wnd As WindowHandle534 wnd As ActiveBasic.Windows.WindowHandle 519 535 text As String 520 536 parent As Control … … 590 606 ExitThread(-1) 591 607 End If 592 rThis.wnd = New WindowHandle(hwnd)608 rThis.wnd = New ActiveBasic.Windows.WindowHandle(hwnd) 593 609 SetWindowLongPtr(hwnd, GWLP_THIS, gchValue) 594 610 End If
Note:
See TracChangeset
for help on using the changeset viewer.