dotnet interop:
Trying to make a panel appear as a form with caption, icon,
minimize, maximize, and close buttons (for replicating a
WinForms designer).
Trouble is, I would like to replace the icon and caption using
properties after the control has been created.
I believe the solution involves the WM_SETICON message,
but the details escape me at the moment. Or is there a more
"managed" way of doing it?
Initial work in code snippet below.
Anyone have an idea?
TIA,
Joergen Bech
---snip---
Option Explicit On
Option Strict On
Imports System.Windows.Forms
Imports Geac.Runtime.Shared
Imports System.Drawing
Public Class FormPanel
Inherits System.Windows.Forms.Panel
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent()
call
Me.BackColor = Color.FromKnownColor(KnownColor.Control)
End Sub
'UserControl overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub
#End Region
Protected Overrides ReadOnly Property CreateParams() As
CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.Caption = "This is a test"
cp.Style = Win32API.WindowStyle.WS_OVERLAPPEDWINDOW
cp.Style = cp.Style Or
Win32API.WindowStyle.WS_CLIPSIBLINGS
cp.Style = cp.Style Or
Win32API.WindowStyle.WS_CLIPCHILDREN
cp.Style = cp.Style Or Win32API.WindowStyle.WS_VISIBLE
cp.Style = cp.Style Or Win32API.WindowStyle.WS_CHILD
cp.ExStyle =
Win32API.WindowStyleEx.WS_EX_CONTROLPARENT
cp.ClassStyle = 0
Return cp
End Get
End Property
End Class