(*´д`*)ハウァッ… VB初心者質問スレ Part16
■ このスレッドは過去ログ倉庫に格納されています
0111897
NGNG’プログラム本体
Private Sub Command1_Click()
uctUDText1.Font = "Arial Black"
End Sub
’ユーザーコントロール
Private pFont As Font 'フォント
Private Sub UserControl_Initialize()
Set pFont = Text1.Font
Text1.Text = 10
End Sub
'プロパティの値を読みこみ
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Set pFont = PropBag.ReadProperty("Font", pFont)
Set Text1.Font = pFont
End Sub
'プロパティの値を保持
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Font", pFont
End Sub
Public Property Get Font() As Font
Set Font = pFont
End Property
Public Property Set Font(mnewFont As Font)
Set pFont = mnewFont
Set Text1.Font = mnewFont
PropertyChanged "Font"
End Property
これだとばっちりです。
これはTextコントロール上に文字を表示していますが、そうじゃなくて自分で文字列を描画します。
具体的にはText1.textがUserControl.Paintになるかんじです
■ このスレッドは過去ログ倉庫に格納されています