Changeset 240


Ignore:
Timestamp:
May 9, 2007, 9:43:24 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Control周りの修正

Location:
Include/Classes/System/Windows/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Windows/Forms/Control.ab

    r223 r240  
    2828    End Sub
    2929
    30     Override Function AsyncState() As IObject
     30    Override Function AsyncState() As Object
    3131        Return Nothing
    3232    End Function
     
    3636    End Function
    3737
    38     Override Function CompletedSynchronously() As BOOL
     38    Override Function CompletedSynchronously() As Boolean
    3939        Return FALSE
    4040    End Function
    4141
    42     Override Function IsCompleted() As BOOL
    43         Return waitHandle.WaitOne(0, FALSE)
     42    Override Function IsCompleted() As Boolean
     43        Return waitHandle.WaitOne(0, False)
    4444    End Function
    4545
     
    6969    '---------------------------------------------------------------------------
    7070    ' Public Properties
    71 
    7271    Function AllowDrop() As Boolean
    7372    End Function
     
    9392    End Function
    9493
    95     Sub Text(ByRef t As String)
     94    Sub Text(t As String)
    9695        text = t
    9796        Dim e As EventArgs
     
    185184
    186185    Const Function Right() As Long
    187         Return Left + Width
     186        Dim b = Bounds
     187        Return b.Left + b.Width
    188188    End Function
    189189
    190190    Const Function Bottom() As Long
    191         Return Top + Height
     191        Dim b = Bounds
     192        Return b.Top + b.Height
    192193    End Function
    193194
     
    266267        This.text = text
    267268        bkColor = DefaultBackColor
    268 '       Debug
    269         CreateHandle()
    270269    End Sub
    271270
     
    279278
    280279    Virtual Sub ~Control()
    281         If wnd.IsWindow Then
    282             wnd.Destroy() ' 暫定
     280        If Not Object.ReferenceEquals(wnd, Nothing) Then
     281            If wnd.IsWindow Then
     282                wnd.Destroy() ' 暫定
     283            End If
    283284        End If
    284285    End Sub
     
    358359    End Sub
    359360
     361    Sub CreateControl()
     362        CreateHandle() '暫定
     363    End Sub
     364
    360365Protected
     366
    361367    '---------------------------------------------------------------------------
    362368    ' Protected Properties
     
    365371        Return createParams
    366372    End Function
    367 
    368373'   Virtual Function DefaultCursor() As Cursor
    369374
     
    377382
    378383'   Const Virtual Function Cursor() As Cursor
    379 '   Virtual Sub Cursor(ByRef c As Cursor)
     384'   Virtual Sub Cursor(c As Cursor)
    380385
    381386    '---------------------------------------------------------------------------
     
    385390        Dim gch = GCHandle.Alloc(This)
    386391        TlsSetValue(tlsIndex, GCHandle.ToIntPtr(gch) As VoidPtr)
    387         With createParams[0]
     392        With createParams
    388393            Dim hwndParent = 0 As HWND
    389394            If Not Object.ReferenceEquals(parent, Nothing) Then
    390395                hwndParent = parent.Handle
    391396            End If
    392             If CreateWindowEx(.ExStyle, atom As ULONG_PTR As PCSTR, text, .Style, _
     397            Dim pText As PCTSTR
     398            If String.IsNullOrEmpty(text) Then
     399                pText = "" As PCTSTR
     400            Else
     401                pText = ToTCStr(text)
     402            End If
     403
     404            If CreateWindowEx(.ExStyle, atom As ULONG_PTR As PCSTR, pText, .Style, _
    393405                CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, _
    394406                hwndParent, 0, hInstance, 0) = 0 Then
     
    437449                Case WM_CREATE
    438450                    OnHandleCreated(EventArgs.Empty)
     451                Case WM_DESTROY
     452                    OnHandleDestroyed(EventArgs.Empty)
    439453                Case Else
    440454                    DefWndProc(m)
     
    487501    Virtual Sub OnBackColorChanged(e As EventArgs) : End Sub
    488502    Virtual Sub OnHandleCreated(e As EventArgs) : End Sub
     503    Virtual Sub OnHandleDestroyed(e As EventArgs) : End Sub
    489504    Virtual Sub OnTextChanged(e As EventArgs)
    490505        wnd.SetText(ToTCStr(text))
     
    527542            .hbrBackground = 0
    528543            .lpszMenuName = 0
    529             .lpszClassName = WindowClassName
     544            .lpszClassName = ToTCStr(WindowClassName)
    530545            .hIconSm = 0
    531546        End With
     
    565580                ' あってはならない事態
    566581                Debug
    567                 ExitThread(0)
     582                ExitThread(-1)
    568583            End If
    569 '           Debug
    570584            rThis.wnd = New WindowHandle(hwnd)
    571585            SetWindowLongPtr(hwnd, GWLP_THIS, gchValue)
    572586        End If
    573         Dim m As Message
    574         m = Message.Create(hwnd, msg, wp, lp)
     587
     588        Dim m = Message.Create(hwnd, msg, wp, lp)
    575589        rThis.WndProc(m)
    576590        Return m.Result
     
    605619
    606620#endif '__SYSTEM_WINDOWS_FORMS_CONTROL_AB__
     621
  • Include/Classes/System/Windows/Forms/CreateParams.ab

    r77 r240  
    1313    X As Long
    1414    Y As Long
    15     Widht As Long
     15    Width As Long
    1616    Height As Long
    1717    Parent As HWND
  • Include/Classes/System/Windows/Forms/Message.ab

    r223 r240  
    7070
    7171    Static Function Create(hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As Message
    72         Dim m As Message
    73         With m
     72        Create = New Message
     73        With Create
    7474            .hwnd = hwnd
    7575            .msg = msg
     
    7777            .lp = lp
    7878        End With
    79         Return m
    8079    End Function
    8180
Note: See TracChangeset for help on using the changeset viewer.