Files
Desktop_BLVStudio/BLV_Studio/UserControl1.vb
2025-12-11 10:06:44 +08:00

538 lines
21 KiB
VB.net
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Public Class UserControl1
Private Sub RicTxtBlod_btn_Click(sender As Object, e As EventArgs) Handles RicTxtBlod_btn.Click
ToolStripLabel1_Click(Nothing ,Nothing )
SetRictxtFontStyle(FontStyle.Bold)
End Sub
Public Sub SetRictxtFontStyle(flag As FontStyle)
Console.WriteLine($"Selectionstop={ProjectDescription_rictxt.SelectedText }")
If IsNothing(ProjectDescription_rictxt.SelectionFont) Then Return
Dim setval As FontStyle = ProjectDescription_rictxt.SelectionFont.Style
Select Case flag
Case FontStyle.Italic
If Not ProjectDescription_rictxt.SelectionFont.Italic Then
setval = setval Or FontStyle.Italic
Else
setval = setval And Not (FontStyle.Italic)
End If
Case FontStyle.Bold
If Not ProjectDescription_rictxt.SelectionFont.Italic Then
setval = setval Or FontStyle.Bold
Else
setval = setval And Not (FontStyle.Bold)
End If
Case FontStyle.Underline
If Not ProjectDescription_rictxt.SelectionFont.Underline Then
setval = setval Or FontStyle.Underline
Else
setval = setval And Not (FontStyle.Underline)
End If
Case FontStyle.Strikeout
If Not ProjectDescription_rictxt.SelectionFont.Strikeout Then
setval = setval Or FontStyle.Strikeout
Else
setval = setval And Not (FontStyle.Strikeout)
End If
End Select
Console.WriteLine($"setval={setval }")
ProjectDescription_rictxt.SelectionFont = New System.Drawing.Font(ProjectDescription_rictxt.SelectionFont.FontFamily, ProjectDescription_rictxt.SelectionFont.Size, setval) '//设置选中文本的字体
End Sub
Private Sub RicrTxtItalic_btn_Click(sender As Object, e As EventArgs) Handles RicrTxtItalic_btn.Click
ToolStripLabel1_Click(Nothing ,Nothing )
SetRictxtFontStyle(FontStyle.Italic)
End Sub
Private Sub RicTxtUnderline_btn_Click(sender As Object, e As EventArgs) Handles RicTxtUnderline_btn.Click
ToolStripLabel1_Click(Nothing ,Nothing )
SetRictxtFontStyle(FontStyle.Underline
End Sub
Private Sub RicTxtStrikeout_btn_Click(sender As Object, e As EventArgs) Handles RicTxtStrikeout_btn.Click
ToolStripLabel1_Click(Nothing ,Nothing )
SetRictxtFontStyle(FontStyle.Strikeout
End Sub
Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) Handles ToolStripButton5.Click
'对齐 ProjectDescription_rictxt.SelectionAlignment = HorizontalAlignment.
Dim Start As Integer = ProjectDescription_rictxt.SelectionStart
'ProjectDescription_rictxt.Select (,)
Console.WriteLine($"SelectionStart={Start}")
End Sub
Private Sub ProjectDescription_rictxt_SelectionChanged(sender As Object, e As EventArgs) Handles ProjectDescription_rictxt.SelectionChanged
End Sub
Private Sub RicTxtSetcolor_btn_DropDownOpening(sender As Object, e As EventArgs) Handles RicTxtSetcolor_btn.DropDownOpening
ColorCelect1.Visible = False
ColorCelect1.Visible = True
ColorCelect1.Location = New Point(235, 28)
ColorCelect1.Tag = RicTxtSetcolor_btn
'RicTxtSetcolor_btn.ButtonBounds .Left
End Sub
Private Sub RicTxtSetcolor_btn_ButtonClick(sender As Object, e As EventArgs) Handles RicTxtSetcolor_btn.ButtonClick
ProjectDescription_rictxt.SelectionColor = RicTxtSetcolor_btn.ForeColor
End Sub
Private Sub RicTxtSetcolor_btn_DropDownClosed(sender As Object, e As EventArgs) Handles RicTxtSetcolor_btn.DropDownClosed
RicTxtSetcolor_btn.ForeColor = ColorCelect1.SelectColor.BackColor
ColorCelect1.Visible = False
End Sub
Private Sub ToolStripSplitButton1_DropDownOpening(sender As Object, e As EventArgs) Handles ToolStripSplitButton1.DropDownOpening
ColorCelect1.Visible = False
ColorCelect1.Visible = True
ColorCelect1.Location = New Point(280, 28)
ColorCelect1.Tag = ToolStripSplitButton1
End Sub
Private Sub ToolStripSplitButton1_DropDownClosed(sender As Object, e As EventArgs) Handles ToolStripSplitButton1.DropDownClosed
ToolStripSplitButton1.ForeColor = ColorCelect1.SelectColor.BackColor
ColorCelect1.Visible = False
End Sub
Private Sub ToolStripSplitButton1_ButtonClick(sender As Object, e As EventArgs) Handles ToolStripSplitButton1.ButtonClick
ProjectDescription_rictxt.SelectionBackColor = ToolStripSplitButton1.ForeColor
End Sub
Private Sub ToolStripButton7_Click(sender As Object, e As EventArgs) Handles ToolStripButton7.Click
ToolStripLabel1_Click(Nothing ,Nothing )
'Dim link As New link_frm
'If IsNothing(ProjectDescription_rictxt.SelectionLength) OrElse ProjectDescription_rictxt.SelectionLength < 1 Then
'Else
' link.TextBox1.Text = ProjectDescription_rictxt.SelectedText
'End If
'If link.ShowDialog = DialogResult.OK Then
' If IsNothing(ProjectDescription_rictxt.SelectionLength) Then
' Else
' ' ProjectDescription_rictxt.a
' End If
'End If
End Sub
Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click
ToolStripLabel1_Click(Nothing ,Nothing )
' '获得要复制图片的完整路径
' string picPath = Application.StartupPath + "\\accept.png";
Dim filename As String = ""
Dim filepath As String = ""
Using openFileDialog As New OpenFileDialog
Dim tmpInitDir As String = Application.StartupPath
openFileDialog.InitialDirectory = tmpInitDir
openFileDialog.RestoreDirectory = True
openFileDialog.Title = "打开文件"
openFileDialog.Filter = $"配置文件(*.png)|*.png"
If openFileDialog.ShowDialog() = DialogResult.OK Then
filename = openFileDialog.SafeFileName
filepath = openFileDialog.FileName
Dim myImage As New Bitmap(filepath)
Dim data = New DataObject()
data.SetData(myImage)
Clipboard.SetDataObject(data, False)
'ProjectDescription_rictxt.SelectionStart = ProjectDescription_rictxt.Text.Length
ProjectDescription_rictxt.Paste()
End If
End Using
End Sub
Private Sub ToolStripSplitButton3_ButtonClick(sender As Object, e As EventArgs) Handles ToolStripSplitButton3.ButtonClick
ToolStripLabel1_Click(Nothing ,Nothing )
Dim tssb As ToolStripSplitButton = sender
Select Case tssb.Tag
Case 0
ProjectDescription_rictxt.SelectionAlignment = HorizontalAlignment.Left
Case 1
ProjectDescription_rictxt.SelectionAlignment = HorizontalAlignment.Right
Case 2
ProjectDescription_rictxt.SelectionAlignment = HorizontalAlignment.Right
End Select
End Sub
Private Sub ToolStripMenuItem5_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem6.Click, ToolStripMenuItem5.Click, ToolStripMenuItem2.Click
Dim tmi As ToolStripMenuItem = sender
ToolStripSplitButton3.Tag = tmi.Tag
ToolStripSplitButton3.DropDown.Close()
End Sub
Private Sub ToolStripComboBox1_DropDownClosed(sender As Object, e As EventArgs) Handles ToolStripComboBox1.DropDownClosed
Dim txtsize As Integer = 9
Select Case ToolStripComboBox1.SelectedIndex
Case 0
txtsize = 18
Case 1
txtsize = 16
Case 2
txtsize = 14
Case 3
txtsize = 12
Case 4
txtsize = 10
End Select
'Dim start As Integer = ProjectDescription_rictxt.SelectionStart
'Dim ricstop As Integer = start + ProjectDescription_rictxt.SelectionLength - 1
Dim index As Integer = 0
For Each rowstr In ProjectDescription_rictxt.Lines
If start > (index + rowstr.Length) Then
Console.WriteLine($"NOT行:1")
Else
If ricstop < (index) Then
Else
ProjectDescription_rictxt.Selectindex, rowstr.Length
Console.WriteLine($"index={index}, rowstr.Length={ rowstr.Length}")
ProjectDescription_rictxt.SelectionFont = New Font(ProjectDescription_rictxt.Font.Name, txtsize)
End If
End If
index = index + rowstr.Length + 1
Next
End Sub
Public start As Integer = 0
Public ricstop As Integer = 0
Private Sub ToolStripComboBox1_Click(sender As Object, e As EventArgs) Handles ToolStripComboBox1.Click
ToolStripLabel1_Click(Nothing ,Nothing )
start = ProjectDescription_rictxt.SelectionStart
ricstop = start + ProjectDescription_rictxt.SelectionLength - 1
Console.WriteLine($"start:{start},stop:{ricstop }")
End Sub
Private Sub ToolStripComboBox1_DropDown(sender As Object, e As EventArgs) Handles ToolStripComboBox1.DropDown
start = ProjectDescription_rictxt.SelectionStart
ricstop = start + ProjectDescription_rictxt.SelectionLength - 1
Console.WriteLine($"start:{start},stop:{ricstop }")
End Sub
Private Sub Panel8_MouseClick(sender As Object, e As MouseEventArgs) Handles Panel8.MouseClick
'If ColorCelect1.Jflag AndAlso ColorCelect1.LFlag Then
ColorCelect1.Visible = False
ColorCelect1.Jflag=False
ColorCelect1.LFlag=False
'End If
End Sub
Private Sub ColorCelect1_VisibleChanged(sender As Object, e As EventArgs) Handles ColorCelect1.VisibleChanged
Dim tssb As ToolStripSplitButton = ColorCelect1.Tag
If IsNothing (tssb) Then Return
tssb.ForeColor = ColorCelect1.SelectColor.BackColor
End Sub
Private Sub ProjectDescription_rictxt_MouseClick(sender As Object, e As MouseEventArgs) Handles ProjectDescription_rictxt.MouseClick
' If ColorCelect1.Jflag AndAlso ColorCelect1.LFlag Then
ColorCelect1.Visible = False
ColorCelect1.Jflag=False
ColorCelect1.LFlag=False
' End If
End Sub
Private Sub ToolStripLabel1_Click(sender As Object, e As EventArgs) Handles ToolStripLabel1.Click
'If ColorCelect1.Jflag AndAlso ColorCelect1.LFlag Then
ColorCelect1.Visible = False
ColorCelect1.Jflag=False
ColorCelect1.LFlag=False
'End If
End Sub
Private Sub ToolStripSplitButton3_DropDownOpening(sender As Object, e As EventArgs) Handles ToolStripSplitButton3.DropDownOpening
ColorCelect1.Visible = False
ColorCelect1.Jflag=False
ColorCelect1.LFlag=False
End Sub
' #Region "RicTxt字体处理"
' Private Sub RicTxtBlod_btn_Click(sender As Object, e As EventArgs) Handles RicTxtBlod_btn.Click
' '首先找到要查找字符串的起始位置
' SetRictxtFontStyle(FontStyle.Bold)
' End Sub
' Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles RicrTxtItalic_btn.Click
' SetRictxtFontStyle(FontStyle.Italic)
' End Sub
' Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles RicTxtUnderline_btn.Click
' SetRictxtFontStyle(FontStyle.Underline)
' End Sub
' Private Sub RicTxtStrikeout_btn_Click(sender As Object, e As EventArgs) Handles RicTxtStrikeout_btn.Click
' SetRictxtFontStyle(FontStyle.Strikeout)
' End Sub
' Public Sub SetRictxtFontStyle(flag As FontStyle)
' Dim setval As FontStyle = FontStyle.Regular
' Select Case flag
' Case FontStyle.Italic
' If Not ProjectDescription_rictxt.SelectionFont.Italic Then setval = FontStyle.Italic
' Case FontStyle.Bold
' If Not ProjectDescription_rictxt.SelectionFont.Italic Then setval = FontStyle.Bold
' Case FontStyle.Underline
' If Not ProjectDescription_rictxt.SelectionFont.Italic Then setval = FontStyle.Underline
' Case FontStyle.Strikeout
' If Not ProjectDescription_rictxt.SelectionFont.Italic Then setval = FontStyle.Strikeout
' End Select
' ProjectDescription_rictxt.SelectionFont = New System.Drawing.Font(ProjectDescription_rictxt.SelectionFont.FontFamily, ProjectDescription_rictxt.SelectionFont.Size, setval) '//设置选中文本的字体
' End Sub
' Private Sub Addlabel_btn_Click(sender As Object, e As EventArgs) Handles Addlabel_btn.Click
' Dim UcreateFrm As New UCreatelabel
' If UcreateFrm.ShowDialog = DialogResult.OK Then
' Dim lab As Label = UserCreateLabel(UcreateFrm.txt, UcreateFrm.txtcolor, Color.LightGray, Addlabel_btn.Location.X, Addlabel_btn.Location.Y, 12, Addlabel_btn.Height)
' ricLabel_Grb.Controls.Add(lab)
' ricLabelGrb_li.Insert(ricLabelGrb_li.Count - 2, lab)
' End If
' arrangementLabel()
' 'If Addlabel_btn.Location.X + lab.Width + Addlabel_btn.Width > ricLabel_Grb.Width Then
' ' Addlabel_btn.Location = New Point(0 + 3, Addlabel_btn.Location.Y + 1 + Addlabel_btn.Height)
' 'Else
' ' Addlabel_btn.Location = New Point(lab.Location.X + lab.Width + 3, Addlabel_btn.Location.Y)
' 'End If
' 'End If
' End Sub
' Public Sub arrangementLabel()
' Dim x As Integer = 2 '上一个开始位置
' Dim y As Integer = 0
' For i As Integer = 0 To ricLabelGrb_li.Count - 1
' Dim index As Control = ricLabelGrb_li.Item(i)
' If i < ricLabelGrb_li.Count - 2 Then
' If x + index.Width > ricLabel_Grb.Width Then
' y = y + index.Height + 1
' x = 2
' index.Location = New Point(2, y)
' x = 2 + index.Width + x
' Else
' index.Location = New Point(x, y)
' x = 2 + index.Width + x
' End If
' Else
' Dim index2 As Control = ricLabelGrb_li.Item(i + 1)
' If x + 160 > ricLabel_Grb.Width Then
' y = y + index.Height + 1
' x = 2
' Console.WriteLine($"h:")
' index.Location = New Point(2, y)
' x = 2 + index.Width + x
' index2.Location = New Point(x, y)
' Else
' index.Location = New Point(x, y)
' x = 2 + index.Width + x
' index2.Location = New Point(x, y)
' End If
' Exit Sub
' End If
' Next
' End Sub
' Public Function UserCreateLabel(txt As String, textcolor As Color, bar As Color, x As Integer, y As Integer, Optional txtsize As Integer = 12, Optional h As Integer = 0, Optional w As Integer = 0) As Label
' Dim lab As New Label
' lab.Text = txt
' lab.ForeColor = textcolor
' lab.BackColor = bar
' lab.TextAlign = ContentAlignment.MiddleCenter
' lab.Font = New Font(lab.Font.Name, txtsize)
' lab.Location = New Point(x, y)
' If h > 1 OrElse w > 1 Then
' lab.AutoSize = True
' lab.Height = h
' lab.Width = w
' End If
' Return lab
' End Function
' Private Sub dellabel_btn_Click(sender As Object, e As EventArgs) Handles dellabel_btn.Click
' If ricLabelGrb_li.Count > 2 Then
' Dim index As Control = ricLabelGrb_li.Item(ricLabelGrb_li.Count - 3)
' ricLabelGrb_li.RemoveAt(ricLabelGrb_li.Count - 3)
' ricLabel_Grb.Controls.Remove(index)
' Else
' Return
' End If
' arrangementLabel()
' End Sub
' Private Sub TabControl1_Click(sender As Object, e As EventArgs) Handles TabControl1.Click
' Select Case TabControl1.TabIndex
' Case 1
' Case 2
' Case 3
' Case 4
' Case 5
' initPojerManger()
' End Select
' End Sub
' Public Sub initPojerManger()
' PUserHolte_lab.Text = $"当前酒店:{_project.HotelName}"
' PUserVar_lab.Text = $"当前版本:{Application.ProductVersion }"
' PUserName_lab.Text = $"用户名:{Account}"
' PUserLimits_lab.Text = $"用户权限:{1}"
' PUserSection_lab.Text = $"所属部门:暂无"
' PUserPojerNum_lab.Text = $"用户项目数量:{10}"
' PUserPojerNum_lab.Text = $"团队成员数量:{20}"
' End Sub
' Public DbConnString2 As String = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Port=3307;Database=engineering_db;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;"
' Private Sub AddMember_btn_Click(sender As Object, e As EventArgs) Handles AddMember_btn.Click
' Dim addmem As New AddMember_frm
' addmem.AddUsercmb = GetRoonConfigHistoryVersion("tbl_engineerning_teammembers", "", DbConnString2)
' 'addmem.Limitscmb = GetRoonConfigHistoryVersion(tabname, "",DbConnString2)
' 'addmem.Pojercmb = GetRoonConfigHistoryVersion(tabname, "",DbConnString2)
' End Sub
' Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs)
' End Sub
' Private Sub ToolStripButton5_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton5.Click
' Dim Start As Integer = ProjectDescription_rictxt.SelectionStart
' Console.WriteLine($"SelectionStart={Start}")
' End Sub
' Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click
' Dim filename As String = ""
' Dim filepath As String = ""
' Using openFileDialog As New OpenFileDialog
' Dim tmpInitDir As String = Application.StartupPath
' openFileDialog.InitialDirectory = tmpInitDir
' openFileDialog.RestoreDirectory = True
' openFileDialog.Title = "打开文件"
' openFileDialog.Filter = $"配置文件(*.png)|*.png"
' If openFileDialog.ShowDialog() = DialogResult.OK Then
' filename = openFileDialog.SafeFileName
' filepath = openFileDialog.FileName
' Dim myImage As New Bitmap(filepath)
' Dim data = New DataObject()
' data.SetData(myImage)
' Clipboard.SetDataObject(data, False)
' 'ProjectDescription_rictxt.SelectionStart = ProjectDescription_rictxt.Text.Length
' ProjectDescription_rictxt.Paste()
' End If
' End Using
' End Sub
' Private Sub ToolStripComboBox1_DropDownClosed(sender As Object, e As EventArgs) Handles ToolStripComboBox1.DropDownClosed
' Dim txtsize As Integer = 9
' Select Case ToolStripComboBox1.SelectedIndex
' Case 0
' txtsize = 18
' Case 1
' txtsize = 16
' Case 2
' txtsize = 14
' Case 3
' txtsize = 12
' Case 4
' txtsize = 10
' End Select
' 'Dim start As Integer = ProjectDescription_rictxt.SelectionStart
' 'Dim ricstop As Integer = start + ProjectDescription_rictxt.SelectionLength - 1
' Dim index As Integer = 0
' Console.WriteLine($"start:{start},stop:{ricstop }")
' For Each rowstr In ProjectDescription_rictxt.Lines
' index = index + rowstr.Length
' Console.WriteLine($"index + rowstr.Length:{index + rowstr.Length},index:{index }")
' If start > (index + rowstr.Length) OrElse ricstop < (index) Then
' Continue For
' Else
' ProjectDescription_rictxt.Selectindex, rowstr.Length
' ProjectDescription_rictxt.SelectionFont = New Font(ProjectDescription_rictxt.Font.Name, txtsize)
' End If
' Next
' End Sub
' Public start As Integer = 0
' Public ricstop As Integer = 0
' Private Sub ToolStripComboBox1_DropDown(sender As Object, e As EventArgs) Handles ToolStripComboBox1.DropDown
' start = ProjectDescription_rictxt.SelectionStart
' ricstop = start + ProjectDescription_rictxt.SelectionLength - 1
' Console.WriteLine($"start:{start},stop:{ricstop }")
' End Sub
'#End Region
End Class