솔루션에 fp5,fp13 포함
This commit is contained in:
588
Epole.fp5/preview.vb
Normal file
588
Epole.fp5/preview.vb
Normal file
@@ -0,0 +1,588 @@
|
||||
Imports System.Drawing
|
||||
Imports System.Drawing.Printing
|
||||
Imports System.Math
|
||||
Imports System.IO.Ports
|
||||
Public Class lb_left
|
||||
|
||||
Private Const Pi = 3.14159265358979
|
||||
Private Structure LOGFONT
|
||||
Dim lfHeight As Long
|
||||
Dim lfWidth As Long
|
||||
Dim lfEscapement As Long
|
||||
Dim lfOrientation As Long
|
||||
Dim lfWeight As Long
|
||||
Dim lfItalic As Byte
|
||||
Dim lfUnderline As Byte
|
||||
Dim lfStrikeOut As Byte
|
||||
Dim lfCharSet As Byte
|
||||
Dim lfOutPrecision As Byte
|
||||
Dim lfClipPrecision As Byte
|
||||
Dim lfQuality As Byte
|
||||
Dim lfPitchAndFamily As Byte
|
||||
Dim lfFacename As String
|
||||
End Structure
|
||||
|
||||
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (ByVal lpLogFont As LOGFONT) As Long
|
||||
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
|
||||
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
|
||||
|
||||
|
||||
Private WithEvents pDoc As New PrintDocument()
|
||||
Dim SelCon As New ArrayList
|
||||
Dim onlyOne As Label
|
||||
|
||||
|
||||
|
||||
Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
|
||||
Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
|
||||
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
|
||||
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Integer) As Integer
|
||||
Public Shared QHD As IntPtr
|
||||
Public Const SRCCOPY As Integer = &HCC0020
|
||||
Public Shared hSDC, hMDC As Integer
|
||||
Public BMP As Bitmap
|
||||
Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
|
||||
Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Integer, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As Integer) As Integer
|
||||
Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
|
||||
Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
|
||||
Public Declare Function GetDesktopWindow Lib "user32" () As Integer
|
||||
Public Declare Function GetForegroundWindow Lib "user32" () As Integer
|
||||
|
||||
|
||||
Private Sub pDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pDoc.PrintPage
|
||||
|
||||
|
||||
'Static StartChar As Int32 '인쇄를 시작할 문자의 위치번호
|
||||
Dim PrintFont As New Font("굴림", 10)
|
||||
Dim Po As PointF, PrintArea As SizeF, PrintRect As RectangleF
|
||||
|
||||
'인쇄할 종이의 영역설정
|
||||
With pDoc.DefaultPageSettings
|
||||
PrintArea.Height = .PaperSize.Height - .Margins.Top - .Margins.Bottom
|
||||
PrintArea.Width = .PaperSize.Width - .Margins.Left - .Margins.Right
|
||||
Po.X = .Margins.Left
|
||||
Po.Y = .Margins.Top
|
||||
End With
|
||||
|
||||
'종이를 길게 눞혀 인쇄할 때 폭과 높이를 수정
|
||||
If pDoc.DefaultPageSettings.Landscape Then
|
||||
Dim Temp As Int32
|
||||
Temp = PrintArea.Height
|
||||
PrintArea.Height = PrintArea.Width
|
||||
PrintArea.Width = Temp
|
||||
End If
|
||||
|
||||
'인쇄할 조건들을 설정
|
||||
Dim Lines As Int32 = CInt(PrintArea.Height / PrintFont.Height)
|
||||
PrintArea.Height = Lines * PrintFont.Height
|
||||
PrintRect = New RectangleF(Po, PrintArea)
|
||||
Dim fmt As New StringFormat(StringFormatFlags.LineLimit)
|
||||
'Dim RemainedText As String = Mid(TextBox1.Text, StartChar + 1)
|
||||
|
||||
'Dim LinesFilled, CharsFitted As Int32
|
||||
'e.Graphics.MeasureString(RemainedText, PrintFont, PrintArea, fmt, CharsFitted, LinesFilled)
|
||||
'위 프로시져의 결과로 CharsFitted, LinesFilled 값이 얻어진다. (ByRef변수)
|
||||
|
||||
'인쇄
|
||||
'e.Graphics.DrawString(RemainedText, PrintFont, Brushes.Black, PrintRect, fmt)
|
||||
e.Graphics.DrawImage(Me.PictureBox2.Image, 0, 0)
|
||||
|
||||
Dim Tobj As Label
|
||||
For Each obj As Control In Me.Panel1.Controls
|
||||
If obj.GetType.Name.ToUpper = "LABEL" Then
|
||||
Tobj = CType(obj, Label)
|
||||
e.Graphics.DrawString(Tobj.Text, PrintFont, Brushes.Black, Tobj.Left, Tobj.Top)
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
'StartChar += CharsFitted
|
||||
|
||||
'인쇄할 부분이 남았으면 페이지 이동
|
||||
'If StartChar < TextBox1.Text.Length Then e.HasMorePages = True : Exit Sub
|
||||
'e.HasMorePages = False : StartChar = 0 'StartChar는 Static으로 선언하였으므로 꼭 초기화 해주어야
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
|
||||
|
||||
|
||||
|
||||
Dim RECT As New Rectangle(22, 24, 310, 491)
|
||||
Me.PictureBox2.Image = CaptureScreen(RECT)
|
||||
|
||||
Dim Preview As New PrintPreviewDialog()
|
||||
Try
|
||||
Preview.Document = pDoc
|
||||
Preview.ShowDialog()
|
||||
|
||||
Catch EX As Exception
|
||||
MsgBox(EX.Message)
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Function CaptureScreen() As Image
|
||||
Return CaptureScreen(New Rectangle(0, 0, My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height))
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function CaptureScreen(ByVal CaptureArea_ As Rectangle) As Image
|
||||
|
||||
Dim hBMP, hBMPOld As Integer
|
||||
Dim oBackground As Image
|
||||
|
||||
'QHD = GetDesktopWindow '//바탕화면핸들을 구한다.
|
||||
QHD = GetForegroundWindow
|
||||
|
||||
|
||||
|
||||
|
||||
'QHD = FindWindow(vbNullString, "Qring")
|
||||
'QHD = FindWindow(vbNullString, "제목 없음 - 메모장")
|
||||
If QHD = 0 Then
|
||||
Return Nothing
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
hSDC = GetDC(QHD)
|
||||
hMDC = CreateCompatibleDC(hSDC)
|
||||
|
||||
hBMP = CreateCompatibleBitmap(hSDC, CaptureArea_.Width, CaptureArea_.Height)
|
||||
|
||||
hBMPOld = SelectObject(hMDC, hBMP)
|
||||
BitBlt(hMDC, 0, 0, CaptureArea_.Width, CaptureArea_.Height, hSDC, CaptureArea_.X, CaptureArea_.Y, SRCCOPY)
|
||||
hBMP = SelectObject(hMDC, hBMPOld)
|
||||
|
||||
oBackground = Image.FromHbitmap(New IntPtr(hBMP))
|
||||
DeleteObject(hBMP)
|
||||
DeleteDC(hSDC)
|
||||
DeleteDC(hMDC)
|
||||
|
||||
Return oBackground
|
||||
End Function
|
||||
|
||||
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
|
||||
Dim PageSetup As New PageSetupDialog()
|
||||
PageSetup.Document = pDoc
|
||||
PageSetup.PageSettings = pDoc.DefaultPageSettings
|
||||
If PageSetup.ShowDialog = Windows.Forms.DialogResult.OK Then pDoc.DefaultPageSettings = PageSetup.PageSettings
|
||||
End Sub
|
||||
|
||||
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
|
||||
Dim Print As New PrintDialog()
|
||||
Print.Document = pDoc
|
||||
If Print.ShowDialog = Windows.Forms.DialogResult.OK Then pDoc.Print()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
|
||||
|
||||
Dim A As PictureBox = Me.PictureBox2
|
||||
|
||||
'If SelCon Is Nothing Then Exit Sub
|
||||
'For Each A As Control In SelCon
|
||||
Select Case e.KeyCode
|
||||
Case Keys.Up
|
||||
If e.Shift Then
|
||||
A.Height -= Val(Me.tb_pixelsize.Text)
|
||||
Else
|
||||
A.Top -= Val(Me.tb_pixelpos.Text)
|
||||
End If
|
||||
Case Keys.Down
|
||||
If e.Shift Then
|
||||
A.Height += Val(Me.tb_pixelsize.Text)
|
||||
Else
|
||||
A.Top += Val(Me.tb_pixelpos.Text)
|
||||
End If
|
||||
Case Keys.Left
|
||||
If e.Shift Then
|
||||
A.Width -= Val(Me.tb_pixelsize.Text)
|
||||
Else
|
||||
A.Left -= Val(Me.tb_pixelpos.Text)
|
||||
End If
|
||||
Case Keys.Right
|
||||
If e.Shift Then
|
||||
A.Width += Val(Me.tb_pixelsize.Text)
|
||||
Else
|
||||
A.Left += Val(Me.tb_pixelpos.Text)
|
||||
End If
|
||||
|
||||
End Select
|
||||
'Next
|
||||
|
||||
e.Handled = False
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
For Each obj As Control In Me.Panel1.Controls
|
||||
'MsgBox(obj.GetType.Name.ToString)
|
||||
If obj.GetType.Name.ToUpper = "LABEL" Then
|
||||
AddHandler CType(obj, Label).MouseDown, AddressOf Con_Click
|
||||
'AddHandler CType(obj, Label).Move, AddressOf con_move
|
||||
AddHandler CType(obj, Label).DoubleClick, AddressOf con_dclick
|
||||
'AddHandler CType(obj, Label).MouseMove, AddressOf con_move
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub con_dclick(ByVal sender As Object, ByVal e As System.EventArgs)
|
||||
Dim A As Label = sender
|
||||
Dim Val As String = InputBox("변경할 값을 입력하세요" & vbCrLf & vbCrLf & "데이터베이스에는 적용되지 않습니다", "변경", A.Text)
|
||||
A.Text = IIf(Val = vbNullString, A.Text, Val)
|
||||
End Sub
|
||||
Private Sub con_move(ByVal sender As Object, ByVal e As System.EventArgs)
|
||||
'ViewProperty(sender)
|
||||
End Sub
|
||||
|
||||
Private Sub Con_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
|
||||
On Error Resume Next
|
||||
If SelCon Is Nothing Then
|
||||
SelCon.Add(sender)
|
||||
Else
|
||||
If e.Button = Windows.Forms.MouseButtons.Right Then
|
||||
For Each obj As Label In SelCon
|
||||
If obj.Name = CType(sender, Label).Name Then '//삭제된다.
|
||||
SelCon.Remove(obj)
|
||||
Exit Sub
|
||||
Else '//추가된다.
|
||||
SelCon.Add(sender)
|
||||
End If
|
||||
Next
|
||||
Else '//재셋팅
|
||||
SelCon.Clear()
|
||||
SelCon.Add(sender)
|
||||
End If
|
||||
End If
|
||||
ViewProperty(sender)
|
||||
onlyOne = sender
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub ViewProperty(ByVal sender As Label)
|
||||
Me.lb_sel.Text = "선택된 개체명 : " & sender.Name & " 값=" & sender.Text
|
||||
Me.tb_height.Text = sender.Height
|
||||
Me.tB_width.Text = sender.Width
|
||||
|
||||
Me.tb_left.Text = sender.Left
|
||||
Me.tb_top.Text = sender.Top
|
||||
|
||||
Me.tb_foncol.Text = Hex(sender.ForeColor.ToArgb)
|
||||
Me.tb_fontbakcol.Text = Hex(sender.BackColor.ToArgb)
|
||||
|
||||
End Sub
|
||||
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
|
||||
Dim A As New System.Text.StringBuilder
|
||||
If Not SelCon Is Nothing Then
|
||||
For Each c As Label In SelCon
|
||||
A.Append(c.Name.ToString & ",")
|
||||
Next
|
||||
Me.lb_selcon.Text = "선택된컨트롤:" & A.ToString
|
||||
End If
|
||||
If Not onlyOne Is Nothing Then
|
||||
Me.lb_sel.Text = "개체명:[" & onlyOne.Name & "]=" & onlyOne.Text & " 위치=" & onlyOne.Location.ToString & " 크기=" & onlyOne.Size.ToString
|
||||
Me.lb_b.ForeColor = IIf(onlyOne.Font.Bold, Color.Red, Color.Black)
|
||||
Me.lb_i.ForeColor = IIf(onlyOne.Font.Italic, Color.Red, Color.Black)
|
||||
Me.lb_s.ForeColor = IIf(onlyOne.Font.Strikeout, Color.Red, Color.Black)
|
||||
Me.lb_u.ForeColor = IIf(onlyOne.Font.Underline, Color.Red, Color.Black)
|
||||
Me.lb_font.Text = onlyOne.Font.Name & "(" & onlyOne.Font.Size & ")"
|
||||
Me.Button6.Enabled = True
|
||||
Me.Button7.Enabled = True
|
||||
Me.Button8.Enabled = True
|
||||
|
||||
Me.Button9.Enabled = True
|
||||
Me.Button10.Enabled = True
|
||||
Me.Button11.Enabled = True
|
||||
Me.Button12.Enabled = True
|
||||
Me.Button13.Enabled = True
|
||||
Me.Button14.Enabled = True
|
||||
Me.Button15.Enabled = True
|
||||
Me.Button16.Enabled = True
|
||||
Me.cb_autosize.Enabled = True
|
||||
|
||||
Else
|
||||
Me.Button6.Enabled = False
|
||||
Me.Button7.Enabled = False
|
||||
Me.Button8.Enabled = False
|
||||
|
||||
Me.Button9.Enabled = False
|
||||
Me.Button10.Enabled = False
|
||||
Me.Button11.Enabled = False
|
||||
Me.Button12.Enabled = False
|
||||
Me.Button13.Enabled = False
|
||||
Me.Button14.Enabled = False
|
||||
Me.Button15.Enabled = False
|
||||
Me.Button16.Enabled = False
|
||||
Me.cb_autosize.Enabled = False
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
|
||||
'Me.PictureBox1.Visible = IIf(CType(sender, CheckBox).Checked, True, False)
|
||||
|
||||
If CType(sender, CheckBox).Checked Then
|
||||
Me.Panel1.BackgroundImage = Image.FromFile(Me.tb_picfile.Text)
|
||||
Else
|
||||
Me.Panel1.BackgroundImage = Nothing
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click
|
||||
Me.Panel1.BackgroundImage = Image.FromFile(Me.tb_picfile.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click
|
||||
Dim A As New OpenFileDialog
|
||||
A.ShowDialog()
|
||||
Me.tb_picfile.Text = A.FileName
|
||||
End Sub
|
||||
|
||||
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
|
||||
Select Case CType(sender, ComboBox).SelectedIndex
|
||||
Case 0
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.None
|
||||
|
||||
Case 1
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.Center
|
||||
Case 2
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.Stretch
|
||||
Case 3
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.Tile
|
||||
Case 4
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.Zoom
|
||||
Case Else
|
||||
Me.Panel1.BackgroundImageLayout = ImageLayout.None
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
|
||||
Dim A As New ColorDialog
|
||||
If A.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
onlyOne.ForeColor = A.Color
|
||||
Me.tb_foncol.Text = Hex(A.Color.ToArgb)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
|
||||
Dim A As New ColorDialog
|
||||
If A.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
onlyOne.BackColor = A.Color
|
||||
Me.tb_fontbakcol.Text = Hex(A.Color.ToArgb)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub cb_autosize_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_autosize.CheckedChanged
|
||||
onlyOne.AutoSize = IIf(CType(sender, CheckBox).Checked, True, False)
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyPosSize()
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
|
||||
Me.onlyOne.Left = IIf(IsNumeric(Me.tb_left.Text), Val(Me.tb_left.Text), Me.onlyOne.Left)
|
||||
Me.onlyOne.Top = IIf(IsNumeric(Me.tb_top.Text), Val(Me.tb_top.Text), Me.onlyOne.Top)
|
||||
Me.onlyOne.Width = IIf(IsNumeric(Me.tB_width.Text), Val(Me.tB_width.Text), Me.onlyOne.Width)
|
||||
Me.onlyOne.Height = IIf(IsNumeric(Me.tb_height.Text), Val(Me.tb_height.Text), Me.onlyOne.Height)
|
||||
End Sub
|
||||
|
||||
Private Sub tb_left_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb_left.TextChanged, tb_top.TextChanged, tB_width.TextChanged, tb_height.TextChanged
|
||||
ApplyPosSize()
|
||||
End Sub
|
||||
|
||||
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelpos.Text) Then Exit Sub
|
||||
onlyOne.Left -= Val(Me.tb_pixelpos.Text)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelpos.Text) Then Exit Sub
|
||||
onlyOne.Left += Val(Me.tb_pixelpos.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelpos.Text) Then Exit Sub
|
||||
onlyOne.Top -= Val(Me.tb_pixelpos.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelpos.Text) Then Exit Sub
|
||||
onlyOne.Top += Val(Me.tb_pixelpos.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelsize.Text) Then Exit Sub
|
||||
onlyOne.Height -= Val(Me.tb_pixelsize.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelsize.Text) Then Exit Sub
|
||||
onlyOne.Height += Val(Me.tb_pixelsize.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelsize.Text) Then Exit Sub
|
||||
onlyOne.Width -= Val(Me.tb_pixelsize.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
|
||||
If onlyOne Is Nothing Then Exit Sub
|
||||
If Not IsNumeric(Me.tb_pixelsize.Text) Then Exit Sub
|
||||
onlyOne.Width += Val(Me.tb_pixelsize.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub ShowMsg(ByVal Message As String)
|
||||
Me.lb_msg.Text = "▷ " & Message & Space(1) & TimeOfDay.ToString
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
|
||||
Dim B As New FontDialog
|
||||
B.Font = onlyOne.Font
|
||||
B.ShowDialog()
|
||||
onlyOne.Font = B.Font
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
|
||||
|
||||
Me.PictureBox2.Image = Obj2img(Me)
|
||||
Me.PictureBox2.BorderStyle = BorderStyle.None
|
||||
Me.PictureBox2.SizeMode = PictureBoxSizeMode.AutoSize
|
||||
Me.PictureBox2.Refresh()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function Obj2img(ByVal objTarget As Control) As Image
|
||||
Dim gObject As Graphics = objTarget.CreateGraphics 'Drawing.Graphics.FromHwnd(objTarget.Handle)
|
||||
|
||||
Dim MyImage As Image = New Bitmap(objTarget.Width, objTarget.Height, gObject)
|
||||
Dim gSave As Graphics = Graphics.FromImage(MyImage)
|
||||
Dim dcObject As IntPtr = gObject.GetHdc
|
||||
Dim dcSave As IntPtr = gSave.GetHdc
|
||||
'파일로저장할떄쓴다.Dim sFileName As String = "C:\aaa.jpg"
|
||||
BitBlt(dcSave.ToInt32, 0, 0, objTarget.Width, objTarget.Height, dcObject.ToInt32, 0, 0, 13369376)
|
||||
|
||||
gObject.ReleaseHdc(dcObject)
|
||||
gSave.ReleaseHdc(dcSave)
|
||||
|
||||
dcObject = Nothing
|
||||
dcSave = Nothing
|
||||
gObject.Dispose()
|
||||
gSave.Dispose()
|
||||
Return MyImage
|
||||
'MyImage.Save(sFileName, ImageFormat.Jpeg)
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
|
||||
'폰트객체를 가지고 폰트를 생성한다음 필요한조작(회전및크기)을 행한후 그래픽개체를 이미지로 바꾼다.
|
||||
'Dim BMP As New Bitmap
|
||||
|
||||
Dim Af As Font = New Font(Label3.Font.FontFamily, Label3.Font.Size * 10, Label3.Font.Style)
|
||||
Dim z As LOGFONT
|
||||
z.lfFacename = "굴림"
|
||||
z.lfHeight = 400
|
||||
z.lfOrientation = 1
|
||||
z.lfWidth = 0
|
||||
|
||||
' Af = Drawing.Font.FromLogFont(z)
|
||||
|
||||
Dim FS As Size
|
||||
FS.Width = (Label3.Font.Size * 100) '/ 15
|
||||
FS.Height = (Label3.Font.Size * 200) '/ 15
|
||||
|
||||
MsgBox(FS.ToString)
|
||||
|
||||
Dim BMP As New Bitmap(Me.Panel1.Width, Me.Panel1.Height, Imaging.PixelFormat.Format32bppArgb)
|
||||
Dim G As Graphics = Graphics.FromImage(BMP) '//기본그래픽개체생성(사이즈는 위에처 맞췄다)
|
||||
'이제 그래픽개체에 글자를 찍고 그것을 IMAGE로 전환한뒤 반환픽쳐박스에 적용해주면된다.
|
||||
G.DrawString("TEST", Af, Brushes.Black, 3, 3)
|
||||
'G.ScaleTransform(100, 100)
|
||||
G.Dispose()
|
||||
|
||||
|
||||
|
||||
|
||||
' MsgBox(PictureBox2.Image.Size.ToString, MsgBoxStyle.Information, PictureBox2.Left & "/" & Me.PictureBox2.Top)
|
||||
My.Application.DoEvents()
|
||||
Me.PictureBox2.Left = Me.Panel1.Left
|
||||
Me.PictureBox2.Top = Me.Panel1.Top
|
||||
Me.PictureBox2.Image = BMP
|
||||
Me.PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
|
||||
Me.PictureBox2.Refresh()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
|
||||
Me.UpdateZOrder()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
|
||||
Dim A As New Size(Me.PictureBox2.Size.Width + 2, Me.PictureBox2.Size.Height + 2)
|
||||
Me.PictureBox2.Size = A
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
|
||||
Me.PictureBox2.SizeMode = PictureBoxSizeMode.AutoSize
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMove
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseUp
|
||||
Me.Text = e.Delta & e.Button.ToString
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox2_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseWheel
|
||||
Me.Text = e.Delta.ToString & e.Button.ToString
|
||||
End Sub
|
||||
|
||||
Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
|
||||
'MyPicture1.MyRefresh()
|
||||
'MyPicture1.Refresh()
|
||||
'MyPicture1.Update()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user