منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[VB.NET] اكود متنوع لا الفورم - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم امثلة ومشاريع VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=188)
+--- الموضوع : [VB.NET] اكود متنوع لا الفورم (/showthread.php?tid=33647)



اكود متنوع لا الفورم - محمد ايمن - 04-03-20

PHP كود :
اظهار الفورم من جانب الشاشة الى وسطهاPublic Class Form1

    Private Sub Timer1_Tick
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles MyBase.Load

        Me
.Left Me.Width
        Timer1
.Enabled True
        Timer1
.Interval 10

    End Sub
End 
Class 
PHP كود :
اظهار الفورم بمنتصف الشاشة
Public Class Form1

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles 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 ObjectByVal e As System.Windows.Forms.FormClosingEventArgsHandles 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.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles 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 'تكبير حجم النموذج ليصبح بحجم الشاشة
DrawWidth = 4 '
اتغيير حجم نقطة الرسم
For 1 To 18000 'التحضير للتنفيذ
Down = Down + 1 ' 
سرعة الرسم
Across 
Across 1
PSet 
(Rnd AcrossRnd Down), QBColor(Rnd 15'رسم النقط
Next i ' 
اعد تنقيذ الرسم
End Sub
--------------------------------------------------------------------------------
لتجميل الفورم
كود PHP
:
Function 
Dist(x1y1x2y2) As Single
Dim A 
As SingleAs Single
= (x2 y1) * (x2 x1)
= (y2 y1) * (y2 y1)
Dist Sqr(B)
End Function
Sub MoveIt(ABt)
= (t) * B
End Sub

Private Sub Form_Click()
Cls
Dim t 
As Singlex1 As Singley1 As Single
Dim x2 
As Singley2 As Singlex3 As Single
Dim y3 
As Singlex4 As Singley4 As Single
Scale 
(-320200)-(320, -200)
0.05
x1 
= -320y1 200
x2 
320y2 200
x3 
320y3 = -200
x4 
= -320y4 = -200
Do Until Dist(x1y1x2y2) < 10
Line 
(x1y1)-(x2y2)
Line -(x3y3)
Line -(x4y4)
Line -(x1y1)
MoveIt x1x2t
MoveIt y1
y2t
MoveIt x2
x3t
MoveIt y2
y3t
MoveIt x3
x4t
MoveIt y3
y4t
MoveIt x4
x1t
MoveIt y4
y1t
Loop
End Sub
Private Sub Form_Resize()
Cls
Dim t 
As Singlex1 As Singley1 As Single
Dim x2 
As Singley2 As Singlex3 As Single
Dim y3 
As Singlex4 As Singley4 As Single
Scale 
(-320200)-(320, -200)
0.05
x1 
= -320y1 200
x2 
320y2 200
x3 
320y3 = -200
x4 
= -320y4 = -200
Do Until Dist(x1y1x2y2) < 10
Line 
(x1y1)-(x2y2)
Line -(x3y3)
Line -(x4y4)
Line -(x1y1)
MoveIt x1x2t
MoveIt y1
y2t
MoveIt x2
x3t
MoveIt y2
y3t
MoveIt x3
x4t
MoveIt y3
y4t
MoveIt x4
x1t
MoveIt y4
y1t
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 _
        
(00Me.WidthMe.Height)
 
       gPath.AddRectangle(r)
 
       Dim lb As LinearGradientBrush _
        New LinearGradientBrush _
        
(rColor.WhiteColor.Blue_
        LinearGradientMode
.Vertical)
 
       g.FillPath(lbgPath)
 
   End Sub

End 
Class 
PHP كود :
جعل خلفية الفورم متدرجة
Public Class Form1

    Private Sub Form1_Paint
(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgsHandles Me.Paint

        Dim rec 
As Rectangle = New Rectangle _
        
(00Me.WidthMe.Height)
 
       Dim myBrush As Brush = New Drawing.Drawing2D_
        LinearGradientBrush
(recColor.AquaColor.Yellow_
        Drawing
.Drawing2D.LinearGradientMode.ForwardDiagonal)
 
       e.Graphics.FillRectangle(myBrushrec)

 
   End Sub
End 
Class 
PHP كود :
كود  لجعل الفورم على شكل دائرة

Imports System
.Drawing.Drawing2D

Public Class Form1

    Private Sub Form1_Paint
(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgsHandles 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
.RoyalBlueColor.MidnightBlue_
        LinearGradientMode
.BackwardDiagonal)
 
       Dim sb As SolidBrush
        sb 
= New SolidBrush(Color.Black)
 
       e.Graphics.FillEllipse(lBrushMe.ClientRectangle)

 
   End Sub
End 
Class 
PHP كود :
اظهار الفورم على شكل نصف دائرة
Public Class Form1

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load

        Dim path 
As New Drawing2D.GraphicsPath
        path
.AddEllipse(15150250250)
 
       Me.Region = New Region(path)

 
   End Sub
End 
Class 
PHP كود :
اظهار الفورم بشكل بيضوي
Public Class Form1

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load

        Dim path 
As New Drawing2D.GraphicsPath
        path
.AddEllipse(25100250125)
 
       Me.Region = New Region(path)


 
   End Sub
End 
Class 
PHP كود :
كود جعل الفورم على شكل مثلث
Public Class Form1

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load

        Me
.Size = New System.Drawing.Size(500500)
 
       Dim path As New Drawing2D.GraphicsPath
        path
.AddLine(00216320)
 
       path.AddLine(2163204080)
 
       path.AddLine(408000)
 
       Me.Region = New Region(path)

 
   End Sub
End 
Class 
PHP كود :
جعل الفورم تقوم بعملية وميض
Public Class Form1

    Private 
Declare Function FlashWindow Lib _
    
"user32" (ByVal hwnd As IntegerByVal _
    bInvert 
As Integer) As Integer
    Private 
Const Invert As Integer 1

    Private Sub Timer1_Tick
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Timer1.Tick

        FlashWindow
(Me.Handle.ToInt32Invert)

 
   End Sub

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles 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.ObjectByVal e As System.EventArgsHandles MyBase.Load

        Me
.Size = New System.Drawing.Size(9999)


 
   End Sub
End 
Class