Foxtable(狐表)用户栏目专家坐堂 → [求助]请问这个代码在全局代码中应该怎么修改呢


  共有2064人关注过本帖树形打印复制链接

主题:[求助]请问这个代码在全局代码中应该怎么修改呢

帅哥哟,离线,有人找我吗?
81538475
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
[求助]请问这个代码在全局代码中应该怎么修改呢  发帖心情 Post By:2024/1/3 23:32:00 [显示全部帖子]

Private Sub OpacityTimer_Tick(sender As Object, e As EventArgs) Handles opacityTimer.Tick
        Me.Opacity -= opacityStep

        If Me.Opacity <= 0.0 Then
            opacityTimer.Stop()
            Me.Close()
        End If
    End Sub

 回到顶部
帅哥哟,离线,有人找我吗?
81538475
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
  发帖心情 Post By:2024/1/4 9:18:00 [显示全部帖子]

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

Public Class MainForm
    Inherits Form

    Private WithEvents opacityTimer As Timer
    Private opacityStep As Double = 0.1
    Private fadeInterval As Integer = 100

    Public Sub New()
        Me.Text = "绘制SP图案"
        Me.Size = New Size(500, 300)
        Me.FormBorderStyle = FormBorderStyle.None ' 禁用窗口边框

        Dim path As New GraphicsPath()
        Dim radius As Integer = 50 ' 增加圆角的半径
        Dim rect As New Rectangle(0, 0, Me.Width, Me.Height)

        path.AddArc(rect.X, rect.Y, radius, radius, 180, 90) ' 左上角
        path.AddArc(rect.Width - radius, rect.Y, radius, radius, 270, 90) ' 右上角
        path.AddArc(rect.Width - radius, rect.Height - radius, radius, radius, 0, 90) ' 右下角
        path.AddArc(rect.X, rect.Height - radius, radius, radius, 90, 90) ' 左下角
        path.CloseFigure()

        Me.Region = New Region(path)

        opacityTimer = New Timer()
        opacityTimer.Interval = fadeInterval
        opacityTimer.Start()
    End Sub

    Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
        Dim graphics = e.Graphics
        graphics.SmoothingMode = SmoothingMode.AntiAlias ' 启用抗锯齿
        graphics.Clear(Color.White) ' 设置窗口背景颜色
    End Sub

    Private Sub OpacityTimer_Tick(sender As Object, e As EventArgs) Handles opacityTimer.Tick
        Me.Opacity -= opacityStep

        If Me.Opacity <= 0.0 Then
            opacityTimer.Stop()
            Me.Close()
        End If
    End Sub

    Public Shared Sub Main()
        Application.Run(New MainForm())
    End Sub
End Class

 回到顶部
帅哥哟,离线,有人找我吗?
81538475
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
  发帖心情 Post By:2024/1/4 10:49:00 [显示全部帖子]

 贴上去提示这个了图片点击可在新窗口打开查看
[此贴子已经被作者于2024/1/4 10:49:06编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
81538475
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
  发帖心情 Post By:2024/1/4 11:00:00 [显示全部帖子]

Public Class MainForm
   ’ Inherits Form

    Private WithEvents opacityTimer As Timer
    Private opacityStep As Double = 0.1
    Private fadeInterval As Integer = 100

    Public Sub New()
        Me.Text = "绘制SP图案"
        Me.Size = New Size(500, 300)
        Me.FormBorderStyle = FormBorderStyle.None ' 禁用窗口边框

        Dim path As New GraphicsPath()
        Dim radius As Integer = 50 ' 增加圆角的半径
        Dim rect As New Rectangle(0, 0, Me.Width, Me.Height)

        path.AddArc(rect.X, rect.Y, radius, radius, 180, 90) ' 左上角
        path.AddArc(rect.Width - radius, rect.Y, radius, radius, 270, 90) ' 右上角
        path.AddArc(rect.Width - radius, rect.Height - radius, radius, radius, 0, 90) ' 右下角
        path.AddArc(rect.X, rect.Height - radius, radius, radius, 90, 90) ' 左下角
        path.CloseFigure()

        Me.Region = New Region(path)

        opacityTimer = New Timer()
        opacityTimer.Interval = fadeInterval
        opacityTimer.Start()
    End Sub

    Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
        Dim graphics = e.Graphics
        graphics.SmoothingMode = SmoothingMode.AntiAlias ' 启用抗锯齿
        graphics.Clear(Color.White) ' 设置窗口背景颜色
    End Sub

    Private Sub OpacityTimer_Tick(sender As Object, e As EventArgs) Handles opacityTimer.Tick
        Me.Opacity -= opacityStep

        If Me.Opacity <= 0.0 Then
            opacityTimer.Stop()
            Me.Close()
        End If
    End Sub

    Public Shared Sub Main()
        Application.Run(New MainForm())
    End Sub
End Class

 回到顶部
帅哥哟,离线,有人找我吗?
81538475
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
  发帖心情 Post By:2024/1/4 11:23:00 [显示全部帖子]

好了,可以了。在弱弱的问一句,这个应该怎么调用呀图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
81538475
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1302 积分:10502 威望:0 精华:1 注册:2018/1/20 12:40:00
  发帖心情 Post By:2024/1/4 13:26:00 [显示全部帖子]

老大在帮忙看看,调用打开窗口是 怎么写代码呀

 回到顶部