Kaynak kodları;
Resources:
bg.png
bullet.png
pic.png
app.config
PHP Kodu:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
CodeFile1.
vb PHP Kodu:
Imports System.Drawing.Printing
Module PrintFormStuff
Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean
Private Const SRCCOPY As Integer = &HCC0020
Private Declare Auto Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As System.IntPtr) As System.IntPtr
' Return an image of the form, with or without
' decoration (borders, title bar, etc).
Public Function GetFormImage(ByVal frm As Form, Optional ByVal with_decoration As Boolean = True) As Bitmap
' Get this form's Graphics object.
Dim me_gr As Graphics = frm.CreateGraphics
' See how big to make the result bitmap.
Dim wid, hgt As Integer
If with_decoration Then
wid = frm.Width
hgt = frm.Height
Else
wid = frm.ClientSize.Width
hgt = frm.ClientSize.Height
End If
' Make a Bitmap to hold the image.
Dim bm As New Bitmap(wid, hgt, me_gr)
Dim bm_gr As Graphics = me_gr.FromImage(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc
' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr
If with_decoration Then
me_hdc = GetWindowDC(frm.Handle)
Else
me_hdc = me_gr.GetHdc
End If
' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, wid, hgt, _
me_hdc, 0, 0, SRCCOPY)
' Clean up.
bm_gr.ReleaseHdc(bm_hdc)
If Not with_decoration Then
me_gr.ReleaseHdc(me_hdc)
End If
' Return the result.
Return bm
End Function
#Region "PrintingStuff"
' Variables used to print.
Private m_PrintBitmap As Bitmap
Private WithEvents m_PrintDocument As PrintDocument
' Print the form's image.
Public Sub PrintForm(ByVal frm As Form, Optional ByVal with_decoration As Boolean = True)
' Copy the form's image into a bitmap.
m_PrintBitmap = GetFormImage(frm, with_decoration)
' Make a PrintDocument and print.
m_PrintDocument = New PrintDocument
m_PrintDocument.Print()
End Sub
' Print the form image.
Private Sub m_PrintDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles m_PrintDocument.PrintPage
' Draw the image centered.
Dim x As Integer = e.MarginBounds.X + _
(e.MarginBounds.Width - m_PrintBitmap.Width) \ 2
Dim y As Integer = e.MarginBounds.Y + _
(e.MarginBounds.Height - m_PrintBitmap.Height) \ 2
e.Graphics.DrawImage(m_PrintBitmap, x, y)
' There's only one page.
e.HasMorePages = False
End Sub
#End Region ' PrintingStuff
#Region "SavingStuff"
' Save the picture.
Public Sub SaveFormImage(ByVal frm As Form, ByVal file_name As String, Optional ByVal with_decoration As Boolean = True, Optional ByVal image_format As System.Drawing.Imaging.ImageFormat = Nothing)
' Copy the form's image into a bitmap.
m_PrintBitmap = GetFormImage(frm, with_decoration)
' Save the bitmap.
If image_format Is Nothing Then
image_format = System.Drawing.Imaging.ImageFormat.Bmp
End If
m_PrintBitmap.Save(file_name, image_format)
End Sub
#End Region ' SavingStuff
End Module
Form1.
vb PHP Kodu:
Public Class Form1
Dim secili
Private MouseMoving As Boolean
Private MouseStartPoint As Point
Dim yazi As New FontDialog
Dim renk As New ColorDialog
Dim pic As New OpenFileDialog
Private Sub cho_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bullet.Visible = False
bullet.Parent = arkaplan
baslik.Parent = arkaplan
resim.Parent = arkaplan
baslik2.Parent = arkaplan
aciklama.Parent = arkaplan
altbilgi.Parent = arkaplan
baslik.Left -= (arkaplan.Left)
baslik.Top -= (arkaplan.Top)
baslik2.Left -= (arkaplan.Left)
baslik2.Top -= (arkaplan.Top)
aciklama.Left -= (arkaplan.Left)
aciklama.Top -= (arkaplan.Top)
altbilgi.Left -= (arkaplan.Left)
altbilgi.Top -= (arkaplan.Top)
resim.Left -= (arkaplan.Left)
resim.Top -= (arkaplan.Top)
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub arkaplan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arkaplan.Click
bullet.Visible = False
secili = "hic"
TextBox1.Visible = False
rnk.Visible = False
font.Visible = False
Label1.Visible = False
uygula.Visible = False
altbilgi.Cursor = Cursors.Default
baslik.Cursor = Cursors.Default
baslik2.Cursor = Cursors.Default
resim.Cursor = Cursors.Default
aciklama.Cursor = Cursors.Default
End Sub
Private Sub baslik_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik.MouseDown
secili = "baslik"
Label1.Visible = True
TextBox1.Visible = True
rnk.Visible = True
font.Visible = True
uygula.Visible = True
TextBox1.Text = baslik.Text
Button4.Visible = False
bullet.Left = (baslik.Left) + (arkaplan.Left)
bullet.Top = (baslik.Top) + (arkaplan.Top)
bullet.Visible = True
baslik.Cursor = Cursors.SizeAll
baslik2.Cursor = Cursors.Default
aciklama.Cursor = Cursors.Default
altbilgi.Cursor = Cursors.Default
resim.Cursor = Cursors.Default
MouseMoving = True
MouseStartPoint = e.Location
End Sub
Private Sub baslik_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik.MouseMove
If MouseMoving Then
baslik.Left += e.X - MouseStartPoint.X
baslik.Top += e.Y - MouseStartPoint.Y
bullet.Left = (baslik.Left) + (arkaplan.Left)
bullet.Top = (baslik.Top) + (arkaplan.Top)
bullet.Visible = False
End If
End Sub
Private Sub baslik_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik.MouseUp
MouseMoving = False
bullet.Visible = True
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub altbilgi_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles altbilgi.MouseDown
secili = "altbilgi"
Label1.Visible = True
TextBox1.Visible = True
rnk.Visible = True
font.Visible = True
uygula.Visible = True
TextBox1.Text = altbilgi.Text
Button4.Visible = False
bullet.Left = (altbilgi.Left) + (arkaplan.Left)
bullet.Top = (altbilgi.Top) + (arkaplan.Top)
bullet.Visible = True
altbilgi.Cursor = Cursors.SizeAll
baslik.Cursor = Cursors.Default
baslik2.Cursor = Cursors.Default
resim.Cursor = Cursors.Default
aciklama.Cursor = Cursors.Default
MouseMoving = True
MouseStartPoint = e.Location
End Sub
Private Sub altbilgi_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles altbilgi.MouseMove
If MouseMoving Then
altbilgi.Left += e.X - MouseStartPoint.X
altbilgi.Top += e.Y - MouseStartPoint.Y
bullet.Left = (altbilgi.Left) + (arkaplan.Left)
bullet.Top = (altbilgi.Top) + (arkaplan.Top)
bullet.Visible = False
End If
End Sub
Private Sub altbilgi_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles altbilgi.MouseUp
MouseMoving = False
bullet.Visible = True
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub baslik2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik2.MouseDown
secili = "baslik2"
Label1.Visible = True
TextBox1.Visible = True
rnk.Visible = True
font.Visible = True
uygula.Visible = True
TextBox1.Text = baslik2.Text
Button4.Visible = False
bullet.Left = (baslik2.Left) + (arkaplan.Left)
bullet.Top = (baslik2.Top) + (arkaplan.Top)
bullet.Visible = True
baslik2.Cursor = Cursors.SizeAll
baslik.Cursor = Cursors.Default
aciklama.Cursor = Cursors.Default
altbilgi.Cursor = Cursors.Default
resim.Cursor = Cursors.Default
MouseMoving = True
MouseStartPoint = e.Location
End Sub
Private Sub baslik2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik2.MouseMove
If MouseMoving Then
baslik2.Left += e.X - MouseStartPoint.X
baslik2.Top += e.Y - MouseStartPoint.Y
bullet.Left = (baslik2.Left) + (arkaplan.Left)
bullet.Top = (baslik2.Top) + (arkaplan.Top)
bullet.Visible = False
End If
End Sub
Private Sub baslik2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles baslik2.MouseUp
MouseMoving = False
bullet.Visible = True
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub resim_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles resim.MouseDown
secili = "resim"
Button4.Visible = True
bullet.Left = (resim.Left) + (arkaplan.Left)
bullet.Top = (resim.Top) + (arkaplan.Top)
bullet.Visible = True
Label1.Visible = False
TextBox1.Visible = False
rnk.Visible = False
font.Visible = False
uygula.Visible = False
TextBox1.Text = ""
resim.Cursor = Cursors.SizeAll
baslik.Cursor = Cursors.Default
baslik2.Cursor = Cursors.Default
altbilgi.Cursor = Cursors.Default
aciklama.Cursor = Cursors.Default
MouseMoving = True
MouseStartPoint = e.Location
End Sub
Private Sub resim_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles resim.MouseMove
If MouseMoving Then
resim.Left += e.X - MouseStartPoint.X
resim.Top += e.Y - MouseStartPoint.Y
bullet.Left = (resim.Left) + (arkaplan.Left)
bullet.Top = (resim.Top) + (arkaplan.Top)
bullet.Visible = False
End If
End Sub
Private Sub resim_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles resim.MouseUp
MouseMoving = False
bullet.Visible = True
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub aciklama_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles aciklama.MouseDown
secili = "aciklama"
Label1.Visible = True
TextBox1.Visible = True
rnk.Visible = True
font.Visible = True
uygula.Visible = True
TextBox1.Text = aciklama.Text
Button4.Visible = False
bullet.Left = (aciklama.Left) + (arkaplan.Left)
bullet.Top = (aciklama.Top) + (arkaplan.Top)
bullet.Visible = True
aciklama.Cursor = Cursors.SizeAll
baslik.Cursor = Cursors.Default
baslik2.Cursor = Cursors.Default
altbilgi.Cursor = Cursors.Default
resim.Cursor = Cursors.Default
MouseMoving = True
MouseStartPoint = e.Location
End Sub
Private Sub aciklama_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles aciklama.MouseMove
If MouseMoving Then
aciklama.Left += e.X - MouseStartPoint.X
aciklama.Top += e.Y - MouseStartPoint.Y
bullet.Left = (aciklama.Left) + (arkaplan.Left)
bullet.Top = (aciklama.Top) + (arkaplan.Top)
bullet.Visible = False
End If
End Sub
Private Sub aciklama_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles aciklama.MouseUp
MouseMoving = False
bullet.Visible = True
bullet.Left -= (arkaplan.Left)
bullet.Top -= (arkaplan.Top)
End Sub
Private Sub font_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles font.Click
If secili = "baslik" Then
yazi.ShowDialog()
baslik.Font = yazi.Font
ElseIf secili = "aciklama" Then
yazi.ShowDialog()
aciklama.Font = yazi.Font
ElseIf secili = "altbilgi" Then
yazi.ShowDialog()
altbilgi.Font = yazi.Font
ElseIf secili = "baslik2" Then
yazi.ShowDialog()
baslik2.Font = yazi.Font
End If
End Sub
Private Sub rnk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rnk.Click
If secili = "baslik" Then
renk.ShowDialog()
baslik.ForeColor = renk.Color
ElseIf secili = "aciklama" Then
renk.ShowDialog()
aciklama.ForeColor = renk.Color
ElseIf secili = "altbilgi" Then
renk.ShowDialog()
altbilgi.ForeColor = renk.Color
ElseIf secili = "baslik2" Then
renk.ShowDialog()
baslik2.ForeColor = renk.Color
End If
End Sub
Private Sub uygula_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uygula.Click
If secili = "baslik" Then
baslik.Text = TextBox1.Text
ElseIf secili = "aciklama" Then
aciklama.Text = TextBox1.Text
ElseIf secili = "altbilgi" Then
altbilgi.Text = TextBox1.Text
ElseIf secili = "baslik2" Then
baslik2.Text = TextBox1.Text
ElseIf secili = "hic" Then
MsgBox("Seçili bir öğe bulunamadı")
<