04-03-20, 04:52 AM
PHP كود :
اظهار الفورم من جانب الشاشة الى وسطهاPublic Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Left = Me.Left + 3
If Me.Left > 300 Then Timer1.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Left = 0 - Me.Width
Timer1.Enabled = True
Timer1.Interval = 10
End Sub
End Class
PHP كود :
اظهار الفورم بمنتصف الشاشة
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rectS As Rectangle = Screen.PrimaryScreen.Bounds
Me.Location = New _
Point(CInt((rectS.Width - Me.Width) / 2), _
CInt((rectS.Height - Me.Height) / 2))
End Sub
End Class
PHP كود :
اغلاق الفورم بشكل مميز
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
For Fade = 1.1 To 0.0 Step -0.1
Me.Opacity = Fade
Me.Refresh()
Threading.Thread.Sleep(100)
Next
End Sub
End Class
PHP كود :
جعل الفورم دائما بالمقدمة
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TopMost = True
End Sub
End Class
PHP كود :
تحريك عنون الفورم تحتج تايمر+امسح كل ال اكود وحط ال اكود
Public Class Form1
Dim g As Graphics = Me.CreateGraphics()
Dim header As String
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Text = " " & Me.Text
' Threading.Thread.Sleep(100)
If g.MeasureString(Me.Text, Me.Font).Width >= Me.Width Then
Me.Text = header
End If
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
header = Me.Text
Timer1.Start()
End Sub
End Class
PHP كود :
لتجميل الفورم
ضع هذا الكود في الفورم
كود PHP:
Private Sub Form_Unload(Cancel As Integer)
WindowState = 2 'تكبير حجم النموذج ليصبح بحجم الشاشة
DrawWidth = 4 'اتغيير حجم نقطة الرسم
For i = 1 To 18000 'التحضير للتنفيذ
Down = Down + 1 ' سرعة الرسم
Across = Across + 1
PSet (Rnd * Across, Rnd * Down), QBColor(Rnd * 15) 'رسم النقط
Next i ' اعد تنقيذ الرسم
End Sub
--------------------------------------------------------------------------------
لتجميل الفورم
كود PHP:
Function Dist(x1, y1, x2, y2) As Single
Dim A As Single, B As Single
A = (x2 - y1) * (x2 - x1)
B = (y2 - y1) * (y2 - y1)
Dist = Sqr(A + B)
End Function
Sub MoveIt(A, B, t)
A = (1 - t) * A + t * B
End Sub
Private Sub Form_Click()
Cls
Dim t As Single, x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single, x3 As Single
Dim y3 As Single, x4 As Single, y4 As Single
Scale (-320, 200)-(320, -200)
t = 0.05
x1 = -320: y1 = 200
x2 = 320: y2 = 200
x3 = 320: y3 = -200
x4 = -320: y4 = -200
Do Until Dist(x1, y1, x2, y2) < 10
Line (x1, y1)-(x2, y2)
Line -(x3, y3)
Line -(x4, y4)
Line -(x1, y1)
MoveIt x1, x2, t
MoveIt y1, y2, t
MoveIt x2, x3, t
MoveIt y2, y3, t
MoveIt x3, x4, t
MoveIt y3, y4, t
MoveIt x4, x1, t
MoveIt y4, y1, t
Loop
End Sub
Private Sub Form_Resize()
Cls
Dim t As Single, x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single, x3 As Single
Dim y3 As Single, x4 As Single, y4 As Single
Scale (-320, 200)-(320, -200)
t = 0.05
x1 = -320: y1 = 200
x2 = 320: y2 = 200
x3 = 320: y3 = -200
x4 = -320: y4 = -200
Do Until Dist(x1, y1, x2, y2) < 10
Line (x1, y1)-(x2, y2)
Line -(x3, y3)
Line -(x4, y4)
Line -(x1, y1)
MoveIt x1, x2, t
MoveIt y1, y2, t
MoveIt x2, x3, t
MoveIt y2, y3, t
MoveIt x3, x4, t
MoveIt y3, y4, t
MoveIt x4, x1, t
MoveIt y4, y1, t
Loop
End Sub
PHP كود :
وضع لون متدرج لخلفية الفورم
Imports System.Drawing.Drawing2D
Public Class Form1
Protected Overrides Sub OnPaint _
(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim g As Graphics = e.Graphics
g.SmoothingMode = SmoothingMode.HighQuality
Dim gPath As GraphicsPath = New GraphicsPath
Dim r As Rectangle = New Rectangle _
(0, 0, Me.Width, Me.Height)
gPath.AddRectangle(r)
Dim lb As LinearGradientBrush = _
New LinearGradientBrush _
(r, Color.White, Color.Blue, _
LinearGradientMode.Vertical)
g.FillPath(lb, gPath)
End Sub
End Class
PHP كود :
جعل خلفية الفورم متدرجة
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim rec As Rectangle = New Rectangle _
(0, 0, Me.Width, Me.Height)
Dim myBrush As Brush = New Drawing.Drawing2D. _
LinearGradientBrush(rec, Color.Aqua, Color.Yellow, _
Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
e.Graphics.FillRectangle(myBrush, rec)
End Sub
End Class
PHP كود :
كود لجعل الفورم على شكل دائرة
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.TextRenderingHint = _
Drawing.Text.TextRenderingHint.ClearTypeGridFit
e.Graphics.SmoothingMode = SmoothingMode.Default
Me.TransparencyKey = Color.Black
e.Graphics.FillRectangle(Brushes.Black, _
Me.ClientRectangle)
Dim lBrush As LinearGradientBrush = New _
LinearGradientBrush(Me.ClientRectangle, _
Color.RoyalBlue, Color.MidnightBlue, _
LinearGradientMode.BackwardDiagonal)
Dim sb As SolidBrush
sb = New SolidBrush(Color.Black)
e.Graphics.FillEllipse(lBrush, Me.ClientRectangle)
End Sub
End Class
PHP كود :
اظهار الفورم على شكل نصف دائرة
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim path As New Drawing2D.GraphicsPath
path.AddEllipse(15, 150, 250, 250)
Me.Region = New Region(path)
End Sub
End Class
PHP كود :
اظهار الفورم بشكل بيضوي
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim path As New Drawing2D.GraphicsPath
path.AddEllipse(25, 100, 250, 125)
Me.Region = New Region(path)
End Sub
End Class
PHP كود :
كود جعل الفورم على شكل مثلث
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Size = New System.Drawing.Size(500, 500)
Dim path As New Drawing2D.GraphicsPath
path.AddLine(0, 0, 216, 320)
path.AddLine(216, 320, 408, 0)
path.AddLine(408, 0, 0, 0)
Me.Region = New Region(path)
End Sub
End Class
PHP كود :
جعل الفورم تقوم بعملية وميض
Public Class Form1
Private Declare Function FlashWindow Lib _
"user32" (ByVal hwnd As Integer, ByVal _
bInvert As Integer) As Integer
Private Const Invert As Integer = 1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
FlashWindow(Me.Handle.ToInt32, Invert)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
End Class
PHP كود :
جعل الفورم تقوم بعملية وميض بأستخدام API
Public Class Form1
Public Structure FLASHWINFO
Public cbSize As Int32
Public hwnd As IntPtr
Public dwFlags As Int32
Public uCount As Int32
Public dwTimeout As Int32
End Structure
Private Declare Function FlashWindowEx _
Lib "user32.dll" (ByRef pfwi As _
FLASHWINFO) As Int32
Private Const FLASHW_CAPTION As Int32 = &H1
Private Const FLASHW_TRAY As Int32 = &H2
Private Const FLASHW_ALL As Int32 = _
(FLASHW_CAPTION Or FLASHW_TRAY)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim flash As New FLASHWINFO
flash.cbSize = System.Runtime. _
InteropServices.Marshal.SizeOf(flash)
flash.hwnd = MyBase.Handle
flash.dwFlags = FLASHW_ALL
flash.uCount = 5
flash.dwTimeout = 1000
FlashWindowEx(flash)
End Sub
End Class
PHP كود :
تحميل صورة بخلفية الفورم
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackgroundImage = New Bitmap("mypicture.bmp")
'Me.BackgroundImageLayout = ImageLayout.Stretch
'Me.BackgroundImageLayout = ImageLayout.Center
'Me.BackgroundImageLayout = ImageLayout.Tile
End Sub
End Class
PHP كود :
تحميل صورة بخلفية الفورم عن طريق مربع حوار
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Me.OpenFileDialog1.ShowDialog()
Me.BackgroundImage = Image.FromFile _
(Me.OpenFileDialog1.FileName)
Catch ex As Exception
MsgBox("من فضلك اختر صورة")
End Try
End Sub
End Class
PHP كود :
التحكم في حجم الفورم
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Size = New System.Drawing.Size(99, 99)
End Sub
End Class
