Click here to Skip to main content
15,889,724 members

miwuawen - Professional Profile



Summary

    Blog RSS
134
Authority
3
Debator
3
Enquirer
163
Organiser
459
Participant
0
Author
0
Editor
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
General[Winform] mouse to drag the dashed box, reduce the window drawing Pin
miwuawen3-Jun-12 4:03
miwuawen3-Jun-12 4:03 
XML
Imports System.Runtime.InteropServices

Public Class Form1

    '先引入API函数ReleaseCapture、SendMessage
    <DllImport("user32.dll")> _
    Public Shared Function ReleaseCapture() As Boolean
    End Function
    <DllImport("user32.dll")> _
    Public Shared Function SendMessage(ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Boolean
    End Function
    Private Const WM_SYSCOMMAND As Integer = &H112
    '点击窗口左上角那个图标时的系统信息
    Private Const WM_MOVING As Integer = &H216
    '鼠标移动消息
    Private Const SC_MOVE As Integer = &HF010
    '移动信息
    Dim HTCAPTION As IntPtr = New IntPtr(&H2)
    '表示鼠标在窗口标题栏时的系统信息
    Private Const WM_NCHITTEST As Integer = &H84
    '鼠标在窗体客户区(除了标题栏和边框以外的部分)时发送的消息
    Dim HTCLIENT As IntPtr = New IntPtr(&H1)
    '表示鼠标在窗口客户区的系统消息
    Private Const SC_MAXIMIZE As Integer = &HF030
    '最大化信息
    Private Const SC_MINIMIZE As Integer = &HF020
    '最小化信息

    '再override 一下WindProc函数
    Protected Overrides Sub WndProc(ByRef m As Message)
        Select Case m.Msg
            Case WM_MOVING
                '如果鼠标移
                MyBase.WndProc(m)
                '调用基类的窗口过程——WndProc方法处理这个消息
                If m.Result = DirectCast(HTCLIENT, IntPtr) Then
                    '如果返回的是HTCLIENT
                    m.Result = DirectCast(HTCAPTION, IntPtr)
                    '把它改为HTCAPTION
                    '直接返回退出方法
                    Return
                End If
                Exit Select
        End Select
        MyBase.WndProc(m)
        '如果不是鼠标移动或单击消息就调用基类的窗口过程进行处理
    End Sub

    '再override一下OnMouseMove函数
    Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
        If e.Button = MouseButtons.Left Then
            ReleaseCapture()
            SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
        End If
        MyBase.OnMouseMove(e)
    End Sub

    '实现窗体类似于QQ最小化的动画效果
    Public Const IDANI_OPEN As System.Int32 = 1
    Public Const IDANI_CAPTION As System.Int32 = 3

    <System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)> _
    Private Structure RECT
        Public Sub New(ByVal rectangle As System.Drawing.Rectangle)
            Left = rectangle.Left
            Top = rectangle.Top
            Right = rectangle.Right
            Bottom = rectangle.Bottom
        End Sub
        Public Sub New(ByVal location As System.Drawing.Point, ByVal size As System.Drawing.Size)
            Left = location.X
            Top = location.Y
            Right = location.X + size.Width
            Bottom = location.Y + size.Height
        End Sub
        Public Left As System.Int32
        Public Top As System.Int32
        Public Right As System.Int32
        Public Bottom As System.Int32
    End Structure

    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Private Shared Function DrawAnimatedRects(ByVal hwnd As System.IntPtr, ByVal idAni As Integer, <System.Runtime.InteropServices.In()> ByRef lprcFrom As RECT, <System.Runtime.InteropServices.In()> ByRef lprcTo As RECT) As Boolean
    End Function

    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As System.IntPtr
    End Function

    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function FindWindowEx(ByVal hwndParent As System.IntPtr, ByVal hwndChildAfter As System.IntPtr, ByVal lpszClass As String, ByVal lpszWindow As String) As System.IntPtr
    End Function

    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Private Shared Function GetWindowRect(ByVal hWnd As System.IntPtr, ByRef lpRect As RECT) As Boolean
    End Function

    ''' <summary>
    ''' 动画隐藏/显示窗口
    ''' </summary>
    ''' <param name="form">form窗口</param>
    ''' <param name="show">true显示、false隐藏</param>
    Public Shared Sub ShowHideAnimated(ByVal form As System.Windows.Forms.Form, ByVal show As System.Boolean)
        Dim from As New RECT(form.Location, form.Size)
        Dim [to] As RECT
        Dim hWnd As System.IntPtr = FindWindowEx(FindWindow("Shell_TrayWnd", Nothing), System.IntPtr.Zero, "TrayNotifyWnd", Nothing)

        If hWnd <> System.IntPtr.Zero Then
            GetWindowRect(hWnd, [to])
        Else
            [to].Left = System.Windows.Forms.SystemInformation.VirtualScreen.Right - form.Width
            [to].Top = System.Windows.Forms.SystemInformation.VirtualScreen.Bottom - System.Windows.Forms.SystemInformation.CaptionHeight - (System.Windows.Forms.SystemInformation.FrameBorderSize.Height * 2)
            [to].Right = System.Windows.Forms.SystemInformation.VirtualScreen.Right
            [to].Bottom = System.Windows.Forms.SystemInformation.VirtualScreen.Bottom
        End If

        If show Then
            DrawAnimatedRects(form.Handle, IDANI_CAPTION, [to], from)
            form.Show()
        Else
            form.Hide()
            DrawAnimatedRects(form.Handle, IDANI_CAPTION, from, [to])
        End If
    End Sub

    '外加让textbox内容改变后自动滚动到最底端:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.AppendText(DateTime.Now.ToString() & "/r/n")
        TextBox1.SelectionStart = TextBox1.Text.Length
        'textBox1.SelectionLength = 0;
        TextBox1.ScrollToCaret()
    End Sub
End Class

Generalvb.net Rounded form that can change the background picture Pin
miwuawen28-May-12 23:14
miwuawen28-May-12 23:14 
Generalform of fade-over Pin
miwuawen28-May-12 23:07
miwuawen28-May-12 23:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.