久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

IWindowsFormsEditorService 接口的VB.NET例子

 家住天地 2011-03-28

IWindowsFormsEditorService 接口的VB.NET例子

[日期:2007-12-05]   來(lái)源:互聯(lián)網(wǎng)整理  作者:佚名   [字體: ]
    新聞簡(jiǎn)介:下面的示例提供一個(gè)示例 UITypeEditor,,它使用 IWindowsFormsEditorService 顯示用于用戶輸入的 Form,。
Imports System Imports System.ComponentModel Imports System.ComponentModel.Design Imports System.Drawing Imports System.Drawing.Design Imports S
        關(guān) 鍵 詞:   windows 

下面的示例提供一個(gè)示例 UITypeEditor,,它使用 IWindowsFormsEditorService 顯示用于用戶輸入的 Form,。

Imports System
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Drawing.Design
Imports System.Windows.Forms
Imports System.Windows.Forms.Design
' Example UITypeEditor that uses the IWindowsFormsEditorService
' to display a Form.
 Public Class TestDialogEditor
Inherits System.Drawing.Design.UITypeEditor
Public Sub New()
End Sub
Public Overloads Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
' Indicates that this editor can display a Form-based interface.
Return UITypeEditorEditStyle.Modal
End Function
Public Overloads Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object
' Attempts to obtain an IWindowsFormsEditorService.
Dim edSvc As IWindowsFormsEditorService = CType(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)
If edSvc Is Nothing Then
Return Nothing
End If
' Displays a StringInputDialog Form to get a user-adjustable
' string value.
Dim form As New StringInputDialog(CStr(value))
If edSvc.ShowDialog(form) = DialogResult.OK Then
Return form.inputTextBox.Text
End If
' If OK was not pressed, return the original value
Return value
End Function
End Class
' Example Form for entering a string.
Friend Class StringInputDialog
Inherits System.Windows.Forms.Form
Private ok_button As System.Windows.Forms.Button
Private cancel_button As System.Windows.Forms.Button
Public inputTextBox As System.Windows.Forms.TextBox
Public Sub New(ByVal [text] As String)
InitializeComponent()
inputTextBox.Text = [text]
End Sub
Private Sub InitializeComponent()
Me.ok_button = New System.Windows.Forms.Button()
Me.cancel_button = New System.Windows.Forms.Button()
Me.inputTextBox = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
Me.ok_button.Anchor = System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right
Me.ok_button.Location = New System.Drawing.Point(180, 43)
Me.ok_button.Name = "ok_button"
Me.ok_button.TabIndex = 1
Me.ok_button.Text = "OK"
Me.ok_button.DialogResult = System.Windows.Forms.DialogResult.OK
Me.cancel_button.Anchor = System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right
Me.cancel_button.Location = New System.Drawing.Point(260, 43)
Me.cancel_button.Name = "cancel_button"
Me.cancel_button.TabIndex = 2
Me.cancel_button.Text = "Cancel"
Me.cancel_button.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.inputTextBox.Location = New System.Drawing.Point(6, 9)
Me.inputTextBox.Name = "inputTextBox"
Me.inputTextBox.Size = New System.Drawing.Size(327, 20)
Me.inputTextBox.TabIndex = 0
Me.inputTextBox.Text = ""
Me.inputTextBox.Anchor = System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right
Me.ClientSize = New System.Drawing.Size(342, 73)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.inputTextBox, Me.cancel_button, Me.ok_button})
Me.MinimumSize = New System.Drawing.Size(350, 100)
Me.Name = "StringInputDialog"
Me.Text = "String Input Dialog"
Me.ResumeLayout(False)
End Sub
End Class
' Provides an example control that displays instructions in design mode,
' with which the example UITypeEditor is associated.
Public Class WinFormsEdServiceDialogExampleControl
Inherits UserControl
 _
Public Property TestDialogString() As String
Get
Return localDialogTestString
End Get
Set(ByVal Value As String)
localDialogTestString = Value
End Set
End Property
Private localDialogTestString As String
Public Sub New()
localDialogTestString = "Test String"
Me.Size = New Size(210, 74)
Me.BackColor = Color.Beige
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
If Me.DesignMode Then
e.Graphics.DrawString("Use the Properties window to show", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 5)
e.Graphics.DrawString("a Form dialog box, using the", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 17)
e.Graphics.DrawString("IWindowsFormsEditorService, for", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 29)
e.Graphics.DrawString("configuring this control's", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 41)
e.Graphics.DrawString("TestDialogString property.", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 53)
Else
e.Graphics.DrawString("This example requires design mode.", New Font("Arial", 8), New SolidBrush(Color.Black), 5, 5)
End If
End Sub
End Class

If you believe an article violates your rights or the rights of others, please contact us.

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多