07-04-14, 05:38 PM
السلام عليكم
صورة
الكود
ارجو الدعاء لي بانهاء مشروعي
او قولو كما تقول امي (ربنا ينولك ما انتا قاصد )
صورة
الكود
كود :
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With Me.ListBox1
.DrawMode = DrawMode.OwnerDrawVariable
.ItemHeight = 45
.Font = New Font("Tahoma", 9)
.SelectionMode = SelectionMode.MultiSimple
End With
End Sub
Private Sub ListBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ListBox1.DrawItem
'- رسم مستطيل بلون الخلفية للرسم عليه للرسم عليه
e.Graphics.FillRectangle(New System.Drawing.SolidBrush(Me.ListBox1.BackColor), e.Bounds)
'- رسم المستطيل الملون
e.Graphics.DrawRectangle(New Pen(Me.Get_Color_Bordr(e.BackColor), 1), e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width - 5, e.Bounds.Height - 3)
'- النص الاول
e.Graphics.DrawString(ListBox1.Items(e.Index).ToString(), _
e.Font, Brushes.Black, e.Bounds.X + 5, e.Bounds.Y + 7, StringFormat.GenericDefault)
'- النص الثاني
e.Graphics.DrawString(ListBox1.Items(e.Index).ToString(), _
New Font(e.Font.Name, e.Font.Size - 1), Brushes.Gray, e.Bounds.X + 5, e.Bounds.Y + 24, StringFormat.GenericDefault)
'- رسم ايقونة حالة التحديد
e.Graphics.DrawImage(Me.Get_Img(e.BackColor), e.Bounds.X + e.Bounds.Width - 20, e.Bounds.Y + 7)
End Sub
Private Function Get_Img(clr As Color) As Image
If clr <> SystemColors.Window Then Return My.Resources.Chck_Yes
Return My.Resources.Chck_No
End Function
Private Function Get_Color_Bordr(clr As Color) As Color
If clr <> SystemColors.Window Then Return clr
Return SystemColors.Control
End Function
End Class
ارجو الدعاء لي بانهاء مشروعي
او قولو كما تقول امي (ربنا ينولك ما انتا قاصد )