[VB.NET 2003]
同じようなフォームをいくつものアプリで使い回ししているので
Formを継承したユーザーコントロールを作ろうと思っています。
下記コードなのですが、使う側のプロジェクトでデザイナで開くと
プロパティページの Location=(0,0) Size=(xxx,xxx) となっています
デザイナで開いたときも初期化コードに書いたように
Me.Location = New Point(25, 35)
Me.ClientSize = New Size(920, 680)
Me.FormBorderStyle = FormBorderStyle.FixedDialog
とし、サイズ変更もできなくしたいのですが、どういった方法があるの
でしょうか?
--------------------------------------------------------------------
Imports System.Drawing
Imports System.Windows.Forms
Public Class FormEx
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
'--- 初期化
Me.KeyPreview = True
Me.MaximizeBox = False
Me.StartPosition = Windows.Forms.FormStartPosition.Manual
Me.Location = New Point(25, 35)
Me.ClientSize = New Size(920, 680)
Me.FormBorderStyle = FormBorderStyle.FixedDialog
Me.Font = New Font("MS ゴシック", 11)
End Sub
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
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container
End Sub
-------------------------------------------------------------------
> 同じようなフォームをいくつものアプリで使い回ししているので
> Formを継承したユーザーコントロールを作ろうと思っています。
この方法はやめたほうがいいです。
やるのであれば、UserControl をフォームのように使い、
フォームに UserControl を貼り付けてください。
そういう方法もあるんですね
試してみます
ありがとうございました
ツイート | ![]() |