5000做网站,wordpress表单信息在哪里,自适应网站开发教程,html5网站开发语言的有点1.思路
1.1 样式
样式为常驻前台的一个小窗口#xff0c;小窗口上有三到四个按钮#xff0c;为一级功能#xff0c;是当前工作内容的常用功能窗口#xff0c;有十个二级窗口#xff0c;为选中窗口时的扩展选项#xff0c;有若干后台功能#xff0c;可选中至前台
可最…1.思路
1.1 样式
样式为常驻前台的一个小窗口小窗口上有三到四个按钮为一级功能是当前工作内容的常用功能窗口有十个二级窗口为选中窗口时的扩展选项有若干后台功能可选中至前台
可最小化至窗口栏最小化按钮在窗口底部
窗口为无边框
1.2具体功能
1.设置代办
复制一段文本后添加代办
2.复制填表
2.功能细节
1.窗口名称Me.Text 工作助手
2.常驻前台Me.TopMost True
3.无边框Me.FormBorderStyle FormBorderStyle.None
4.窗体圆角
引用Imports System.Drawing.Drawing2D Call 窗体圆角(Me, 20)Sub 窗体圆角(form As Form, rgnRadius As Integer)Dim bs As GraphicsPath New GraphicsPathbs.AddLine(rgnRadius, 0, Me.Width - rgnRadius * 2, 0)bs.AddArc(Me.Width - rgnRadius * 2, 0, rgnRadius * 2, rgnRadius * 2, 270, 90)bs.AddLine(Me.Width, rgnRadius, Me.Width, Me.Height - rgnRadius * 2)bs.AddArc(Me.Width - rgnRadius * 2, Me.Height - rgnRadius * 2, rgnRadius * 2, rgnRadius * 2, 0, 90)bs.AddLine(Me.Width - rgnRadius * 2, Me.Height, rgnRadius, Me.Height)bs.AddArc(0, Me.Height - rgnRadius * 2, rgnRadius * 2, rgnRadius * 2, 90, 90)bs.AddLine(0, Me.Height - rgnRadius * 2, 0, rgnRadius * 2)bs.AddArc(0, 0, rgnRadius * 2, rgnRadius * 2, 180, 90)bs.CloseFigure()Me.Region New Region(bs)End Sub
可是用画图法制作的窗体圆角有很明显的锯齿不符合商业化需求 使用双缓冲默认情况下标准Windows 窗体控件是双缓冲的。可以通过两种方法对窗体和所创作的控件启用默认双缓冲。一种方法是将DoubleBuffered属性设置为true另一种方法是通过调用SetStyle方法将OptimizedDoubleBuffer标志设置为true。两种方法都将为窗体或控件启用默认双缓冲并提供无闪烁的图形呈现。建议仅对已为其编写所有呈现代码的自定义控件调用SetStyle方法。 Public Sub New() InitializeComponent() SetStyle(ControlStyles.UserPaint, True) SetStyle(ControlStyles.AllPaintingInWmPaint, True) SetStyle(ControlStyles.OptimizedDoubleBuffer, True) End Sub 最后尝试了双重绘但是又出现黑角
Imports System.Drawing.Drawing2D
Imports System.Runtime.InteropServicesPublic Class Form1Public Sub New() 此调用是设计器所必需的。InitializeComponent()SetStyle(ControlStyles.UserPaint, True)SetStyle(ControlStyles.AllPaintingInWmPaint, True)SetStyle(ControlStyles.OptimizedDoubleBuffer, True)Me.Text 工作助手Me.TopMost TrueMe.FormBorderStyle FormBorderStyle.NoneCall 窗体圆角(Me, 20)End SubProtected Overrides Sub OnPaintBackground(e As PaintEventArgs) 不调用基类的OnPaintBackground避免背景被画出End SubProtected Overrides Sub OnPaint(e As PaintEventArgs)Dim g As Graphics e.Graphicsg.SmoothingMode Drawing2D.SmoothingMode.AntiAliasg.CompositingQuality Drawing2D.CompositingQuality.HighQualityg.InterpolationMode Drawing2D.InterpolationMode.HighQualityBicubic绘制圆角矩形Dim rect As New Rectangle(0, 0, Me.Width, Me.Height)Dim path As New Drawing2D.GraphicsPath()Dim ar As Integerar 50path.AddArc(rect.X, rect.Y, ar, ar, 180, 90)path.AddArc(rect.X rect.Width - ar, rect.Y, ar, ar, 270, 90)path.AddArc(rect.X rect.Width - ar, rect.Y rect.Height - ar, ar, ar, 0, 90)path.AddArc(rect.X, rect.Y rect.Height - ar, ar, ar, 90, 90)path.CloseFigure()g.FillPath(Brushes.White, path)MyBase.OnPaint(e)End SubSub 窗体圆角(form As Form, rgnRadius As Integer)Dim bs As GraphicsPath New GraphicsPathbs.AddLine(rgnRadius, 0, Me.Width - rgnRadius * 2, 0)bs.AddArc(Me.Width - rgnRadius * 2, 0, rgnRadius * 2, rgnRadius * 2, 270, 90)bs.AddLine(Me.Width, rgnRadius, Me.Width, Me.Height - rgnRadius * 2)bs.AddArc(Me.Width - rgnRadius * 2, Me.Height - rgnRadius * 2, rgnRadius * 2, rgnRadius * 2, 0, 90)bs.AddLine(Me.Width - rgnRadius * 2, Me.Height, rgnRadius, Me.Height)bs.AddArc(0, Me.Height - rgnRadius * 2, rgnRadius * 2, rgnRadius * 2, 90, 90)bs.AddLine(0, Me.Height - rgnRadius * 2, 0, rgnRadius * 2)bs.AddArc(0, 0, rgnRadius * 2, rgnRadius * 2, 180, 90)bs.CloseFigure()Me.Region New Region(bs)End SubEnd Class
最后尝试了使用WPF窗体完美解决圆角问题
Window x:ClassMainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:工作助手WPFmc:IgnorabledTitleMainWindow Height300 Width200WindowStyleNoneResizeModeNoResizeAllowsTransparencyTrueBackgroundTransparentGrid SnapsToDevicePixelsTrueBorder BackgroundWhite BorderThickness1 CornerRadius10Button ContentButton Margin49,57,49,204//Border/Grid
/Window 5.设置icon 6.设置窗口初始位置右下角 Dim screenWidth As Integer SystemParameters.PrimaryScreenWidthDim screenHeight As Integer SystemParameters.PrimaryScreenHeightDim workHeight As Integer SystemParameters.WorkArea.HeightMsgBox(-- screenWidth -- screenHeight -- workHeight)Me.Left screenWidth - Me.WidthMe.Top workHeight - Me.Height
7.设置类似qq的吸附效果这里附上完整代码
Imports System.Timers.Timer
Imports System.Windows.FormsClass MainWindowInherits WindowPublic Sub New()InitializeComponent() 设置窗口的初始位置贴紧任务栏Me.WindowStartupLocation WindowStartupLocation.CenterScreen 显示在屏幕中心Me.WindowStartupLocation WindowStartupLocation.Manual 在指定位置显示Dim screenWidth As Integer SystemParameters.PrimaryScreenWidthDim screenHeight As Integer SystemParameters.PrimaryScreenHeightDim workHeight As Integer SystemParameters.WorkArea.HeightMsgBox(-- screenWidth -- screenHeight -- workHeight)Me.Left screenWidth - Me.WidthMe.Top workHeight - Me.HeightEnd Sub Protected Overrides Sub OnMouseLeftButtonDown(ByVal e As MouseButtonEventArgs) 拖动窗体MyBase.OnMouseLeftButtonDown(e)Me.DragMove()End SubPrivate hh As Boolean FalsePrivate tt As Boolean FalsePrivate timer As New TimerPrivate Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loadedtimer.Enabled TrueAddHandler timer.Tick, AddressOf timertickEnd SubPrivate Sub timertick()If hh True ThenIf System.Windows.Forms.Cursor.Position.X clien()(0) - 5 And (System.Windows.Forms.Cursor.Position.Y Me.Top And System.Windows.Forms.Cursor.Position.Y Me.Top Me.Height) ThenMe.Left clien()(0) - Me.WidthEnd IfEnd IfIf tt True ThenIf System.Windows.Forms.Cursor.Position.Y 1 And (System.Windows.Forms.Cursor.Position.X Me.Left And System.Windows.Forms.Cursor.Position.X Me.Left Me.Width) ThenMe.Top 1End IfEnd IfEnd SubPrivate Sub MainWindow_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles Me.MouseEnterIf hh True ThenMe.Left clien()(0) - Me.Widthhh FalseEnd IfIf tt True ThenMe.Top 1tt FalseEnd IfEnd SubFunction clien()Return {System.Windows.Forms.Screen.FromPoint(New System.Drawing.Point).Bounds.Width, System.Windows.Forms.Screen.FromPoint(New System.Drawing.Point).Bounds.Height}End FunctionPrivate Sub MainWindow_MouseLeave(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles Me.MouseLeaveIf Me.Top 1 And Me.Left Me.Width clien()(0) ThenMe.Top -Me.Height 5Me.Left clien()(0) - Me.Widthtt TrueElsehidden()shhtop()End IfEnd SubSub hidden()If Me.Left Me.Width clien()(0) ThenMe.Left clien()(0) - 5hh TrueEnd IfEnd SubSub shhtop()If Me.Top 1 ThenMe.Top -Me.Height 5tt TrueEnd IfEnd SubSub btn_upload_Click()End SubSub btn_close_Click()End Sub
End Class
问题一其中System.Windows.Forms引用不到
解决方案
UseWindowsFormstrue/UseWindowsForms
放置的位置是【项目名】.csproj文件在Visual Studio 2022 里双击项目名可以打开这个文件。 PropertyGroupOutputTypeWinExe/OutputTypeTargetFrameworknet6.0-windows/TargetFrameworkNullableenable/NullableUseWPFtrue/UseWPFAssemblyVersion1.0.1/AssemblyVersionFileVersion1.0.1.0/FileVersionUseWindowsFormstrue/UseWindowsForms/PropertyGroup 问题二当鼠标停在屏幕顶部时窗口会不停闪烁因为窗口没有完全隐藏鼠标反复进出窗口所以将-Me.Height 0做成临界值使窗口不再闪烁
问题三由于电脑有缩放导致对鼠标的位置判断有问题有偏移所以要先获取电脑缩放比
(System.Windows.Forms.Cursor.Position.X / 1.25 Me.Left And System.Windows.Forms.Cursor.Position.X / 1.25 Me.Left Me.Width)
我的电脑缩放比试125%所以这里要除以1.25
8.调试Debug.WriteLine(hello)
3.打包exe
3.1.vs能生成exe但是debug中的其他文件也要拷贝给客户才能运行就是要复制一个文件包对于小程序不方便。以下方法可以通过rar压缩软件制作exe文件但是如果进行了最后一步给压缩包自定义图标在其他电脑上运行会报毒但是不改图标程序又是压缩包的图标不够专业。所以本人不想使用此方式。
https://www.cnblogs.com/cmblogs/p/9782855.html
3.2打包成独立的exe依据以下博客
VS 程序打包成一个独立的exe - Enigma Virtual Box-CSDN博客
3.3.vs2022生成单exe文件和不需安装.NET DESKTOP runtime 运行的方法
部署模式选独立文件发布模式勾选生成单个文件整个打包不需要电脑安装.net。
如果用依赖框架的形式安装点击程序运行时会自动跳转安装也挺快的。 3.4之前能正常运行重新打开后InitializeComponent()报错解决办法删除项目目录中obj文件夹重新打开项目。
继续写的话就太长留在下一节了。
最后附一下当前的成效吧能自动吸附隐藏在上边框。