اذهب الي المحتوي
أوفيسنا

ComboBox Center Text - وضع النص في الوسط في اداة الكومبوبوكس


SEMO.Pa3x

الردود الموصى بها

Public Class CenteredComboBox
  Inherits ComboBox
  Sub New()
    Me.DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
    Me.DropDownStyle = ComboBoxStyle.DropDownList
  End Sub

  Private Sub CenteredComboBox_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
    e.DrawBackground()
    Dim txt As String = ""
    If e.Index >= 0 Then txt = Me.Items(e.Index).ToString
    TextRenderer.DrawText(e.Graphics, txt, e.Font, e.Bounds, e.ForeColor, TextFormatFlags.HorizontalCenter)
    e.DrawFocusRectangle()
  End Sub
End Class

 

ضع الاكواد في كلاس واعمل كومبايل، وستظهر لك اداة كومبوبوكس جديدة قم بإستخدامها وستجد ان النص اصبح في الوسط

بالتوفيق للجميع.

 

 

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • اضف...

Important Information