التنبيهات التالية ظهرت :
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 864 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 864 errorHandler->error



تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مثال كامل لزر بالصور الخاصه به
#1
كاتب الموضوع : AhmedEssawy


كود :
' ----------------------------------------
' Required Imports :
'
' System
' Microsoft.VisualBasic
' System.Windows.Forms
' System.Drawing
' ----------------------------------------

Public Class PictureButtonDemo
Inherits System.Windows.Forms.Form

Friend WithEvents PictureButton1 As New PictureButton

Public Sub New()

' Display the OK close button.
Me.MinimizeBox = False

Me.Text = "Picture Button Demo"

' Create an instance of the PictureButton custom control.
With PictureButton1
.Parent = Me
.Bounds = New Rectangle(10, 30, 150, 30)
.ForeColor = Color.White
.BackgroundImageValue = MakeBitmap(Color.Blue, PictureButton1.Width, PictureButton1.Height)
.PressedImageValue = MakeBitmap(Color.LightBlue, PictureButton1.Width, PictureButton1.Height)
.Text = "Click Me"
End With
End Sub

' Clean up any resources being used.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub

' Create a bitmap object, fill it with the specified color.
' To make it look like a custom image, draw an ellipse in it.
Function MakeBitmap(ByVal ButtonColor As Color, ByVal width As Integer, ByVal height As Integer) As Bitmap
Dim bmp As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(ButtonColor), 0, 0, bmp.Width, bmp.Height)
g.DrawEllipse(New Pen(Color.LightGray), 3, 3, width - 6, height - 6)
g.Dispose()

Return bmp
End Function

Shared Sub Main()
Application.Run(New PictureButtonDemo)
End Sub

' Because PictureButton inherits from Control,
' you can use the default Click event.
Private Sub PictureButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PictureButton1.Click
'Add code here to respond to button click.
End Sub

End Class

'Button with an image custom control.
Public Class PictureButton
Inherits Control

Private backgroundImg As Image
Private pressedImg As Image
Private pressed As Boolean = False

' Property for the background image to be drawn behind the button text.
Public Property BackgroundImageValue() As Image
Get
Return Me.backgroundImg
End Get
Set(ByVal Value As Image)
Me.backgroundImg = Value
End Set
End Property

' Property for the background image to be drawn behind the button text when
' the button is pressed.
Public Property PressedImageValue() As Image
Get
Return Me.pressedImg
End Get
Set(ByVal Value As Image)
Me.pressedImg = Value
End Set
End Property

' Ivalidate form to cause repaint.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
Me.pressed = True
Me.Invalidate()
MyBase.OnMouseDown(e)
End Sub

' When the mouse is released, reset the "pressed" flag
' and invalidate to redraw the button in the un-pressed state.
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
Me.pressed = False
Me.Invalidate()
MyBase.OnMouseUp(e)
End Sub

' Override the OnPaint method so we can draw the background image and the text.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

If Me.pressed AndAlso (Me.pressedImg IsNot Nothing) Then
e.Graphics.DrawImage(Me.pressedImg, 0, 0)
Else
e.Graphics.DrawImage(Me.backgroundImg, 0, 0)
End If

' Draw the text if there is any.
If Me.Text.Length > 0 Then
Dim size As SizeF = e.Graphics.MeasureString(Me.Text, Me.Font)

' Center the text inside the client area of the PictureButton.
e.Graphics.DrawString(Me.Text, Me.Font, New SolidBrush(Me.ForeColor), (Me.ClientSize.Width - size.Width) / 2, (Me.ClientSize.Height - size.Height) / 2)
End If

' Draw a border around the outside of the
' control to look like Pocket PC buttons.
e.Graphics.DrawRectangle(New Pen(Color.Black), 0, 0, Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)

MyBase.OnPaint(e)
End Sub
End Class
}}}
تم الشكر بواسطة:


الردود في هذا الموضوع
مثال كامل لزر بالصور الخاصه به - بواسطة Raggi Tech - 17-10-12, 05:44 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  شرح كيفية برمجة( مثال نسخ الملفات من مكان انت تحدده الى مكان انت تحدده بامتداد انت تحدده) سعود 5 8,114 04-09-19, 04:32 AM
آخر رد: سعود
  مثال بسيط لتغيير طريقة استخدام اداة العنان Label مع الشرح RaggiTech 0 3,048 20-10-12, 11:50 AM
آخر رد: RaggiTech
  مثال لادارة صلاحيات كل مستخدم لوحده RaggiTech 0 3,452 17-10-12, 10:05 PM
آخر رد: RaggiTech
  مثال تحريك الفورم من غير اطار RaggiTech 0 2,712 17-10-12, 10:00 PM
آخر رد: RaggiTech
  مثال يشمل عملية الحذف والتعديل والاضافة على قاعدة البيانات RaggiTech 0 4,389 17-10-12, 09:23 PM
آخر رد: RaggiTech
  مثال للحفاظ على تنسيق الاداوت اثناء تكبير الفورم في الفيجول دوت نت 2008 RaggiTech 0 3,511 17-10-12, 08:40 PM
آخر رد: RaggiTech
  مثال للبحث عن الملفات المخفية والغير مخفية داخل الكمبيوتر في الفيجول دوت نت 2008 RaggiTech 0 2,494 17-10-12, 08:38 PM
آخر رد: RaggiTech
  مثال - ربط جدولين في قاعدة بيانات اكسس من خلال فيجول دوت نت 2008 RaggiTech 0 7,102 17-10-12, 08:36 PM
آخر رد: RaggiTech
  مثال - تحويل التاريخ من ميلادي الى هجري وبالعكس في الفيجول دوت نت 2008 RaggiTech 0 4,716 17-10-12, 08:34 PM
آخر رد: RaggiTech
  مثال لجملة update باستخدام متغير يحمل عبارة sql RaggiTech 0 2,110 17-10-12, 07:20 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم