12 Haziran 2013 Çarşamba
BÜYÜTEÇ
BÜYÜTEÇ
KOD İNDİR
Public Class Form1 #Region " DEĞİŞKENLER VE SABİT DEĞERLER..." Inherits System.Windows.Forms.Form Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer Public Declare Function GetDesktopWindow Lib "user32" () As IntPtr Public Declare Function GetDC Lib "user32.dll" (ByVal hWnd As IntPtr) As IntPtr Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Integer, ByVal hdc As Integer) As Integer 'Bağlantı Sabitleri Public Const BLACKNESS = &H42 Public Const DSTINVERT = &H550009 Public Const CAPTUREBLT = &H40000000 Public Const MERGECOPY = &HC000CA Public Const MERGEPAINT = &HBB0226 Public Const NOMIRRORBITMAP = &H80000000 Public Const NOTSRCCOPY = &H330008 Public Const SRCCOPY = &HCC0020 Public Const PATCOPY = &HF00021 Dim GriScalaDizisi As Imaging.ColorMatrix = New Imaging.ColorMatrix(New Single()() _ {New Single() {0.3, 0.3, 0.3, 0, 0}, _ New Single() {0.59, 0.59, 0.59, 0, 0}, _ New Single() {0.11, 0.11, 0.11, 0, 0}, _ New Single() {0, 0, 0, 1, 0}, _ New Single() {0, 0, 0, 0, 1}}) Dim GorunumNitelikleri As New Imaging.ImageAttributes Friend WithEvents ToolStripTaşıyıcıPanel As System.Windows.Forms.Panel Friend WithEvents mnMercek As System.Windows.Forms.ToolStrip Friend WithEvents mnNormal As System.Windows.Forms.ToolStripButton Friend WithEvents mnGri As System.Windows.Forms.ToolStripButton Friend WithEvents mnTersYuz As System.Windows.Forms.ToolStripButton Friend WithEvents mnHepUstte As System.Windows.Forms.ToolStripButton Friend WithEvents PicOnde As System.Windows.Forms.PictureBox Friend WithEvents PicArkada As System.Windows.Forms.PictureBox Friend WithEvents KapatPic As System.Windows.Forms.PictureBox Friend WithEvents Slider1 As VirtualSoftware.ColorSlider Friend WithEvents YüzdeLBL As System.Windows.Forms.Label #End Region #Region " WİNDOWS FORM TASARIM KODU OLUŞTURMA...." Public Sub New() MyBase.New() 'Bu çağrı Windows Form Designer tarafından gereklidir. InitializeComponent() 'InitializeComponent () çağrısından sonra 'herhangi bir başlatma ekle 'Çift tamponlama Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True) Me.UpdateStyles() End Sub 'Form bileşen listesini temizler ve geçersiz kılar. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Windows Form tasarımı gereçleri Private components As System.ComponentModel.IContainer 'Not: Aşağıdaki yordam Windows Form Tasarımcısı tarafından gerekli 'Burda Windows Form tasarımcısı kullanılarak değişiklik yapılabilir 'Kod editörü kullanarak değişiklik yapmayın. Friend WithEvents tmrGuncelle As System.Windows.Forms.Timer Friend WithEvents tmrBoya As System.Windows.Forms.Timer
Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) Me.tmrBoya = New System.Windows.Forms.Timer(Me.components) Me.tmrGuncelle = New System.Windows.Forms.Timer(Me.components) Me.YüzdeLBL = New System.Windows.Forms.Label() Me.ToolStripTaşıyıcıPanel = New System.Windows.Forms.Panel() Me.KapatPic = New System.Windows.Forms.PictureBox() Me.mnMercek = New System.Windows.Forms.ToolStrip() Me.mnNormal = New System.Windows.Forms.ToolStripButton() Me.mnGri = New System.Windows.Forms.ToolStripButton() Me.mnTersYuz = New System.Windows.Forms.ToolStripButton() Me.mnHepUstte = New System.Windows.Forms.ToolStripButton() Me.PicArkada = New System.Windows.Forms.PictureBox() Me.PicOnde = New System.Windows.Forms.PictureBox() Me.Slider1 = New VirtualSoftware.ColorSlider() Me.ToolStripTaşıyıcıPanel.SuspendLayout() CType(Me.KapatPic, System.ComponentModel.ISupportInitialize).BeginInit() Me.mnMercek.SuspendLayout() CType(Me.PicArkada, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PicOnde, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'tmrBoya ' Me.tmrBoya.Enabled = True ' 'YüzdeLBL ' Me.YüzdeLBL.BackColor = System.Drawing.Color.LightSteelBlue Me.YüzdeLBL.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.YüzdeLBL.ForeColor = System.Drawing.Color.White Me.YüzdeLBL.ImageAlign = System.Drawing.ContentAlignment.TopCenter Me.YüzdeLBL.Location = New System.Drawing.Point(200, 5) Me.YüzdeLBL.Name = "YüzdeLBL" Me.YüzdeLBL.Size = New System.Drawing.Size(45, 13) Me.YüzdeLBL.TabIndex = 3 Me.YüzdeLBL.Text = "% :" ' 'ToolStripTaşıyıcıPanel ' Me.ToolStripTaşıyıcıPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.Slider1) Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.KapatPic) Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.YüzdeLBL) Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.mnMercek) Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.PicArkada) Me.ToolStripTaşıyıcıPanel.Controls.Add(Me.PicOnde) Me.ToolStripTaşıyıcıPanel.Dock = System.Windows.Forms.DockStyle.Top Me.ToolStripTaşıyıcıPanel.Location = New System.Drawing.Point(0, 0) Me.ToolStripTaşıyıcıPanel.Name = "ToolStripTaşıyıcıPanel" Me.ToolStripTaşıyıcıPanel.Size = New System.Drawing.Size(284, 25) Me.ToolStripTaşıyıcıPanel.TabIndex = 5 ' 'KapatPic ' Me.KapatPic.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.KapatPic.Image = CType(resources.GetObject("KapatPic.Image"), System.Drawing.Image) Me.KapatPic.Location = New System.Drawing.Point(264, 5) Me.KapatPic.Name = "KapatPic" Me.KapatPic.Size = New System.Drawing.Size(13, 13) Me.KapatPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.KapatPic.TabIndex = 8 Me.KapatPic.TabStop = False ' 'mnMercek ' Me.mnMercek.BackColor = System.Drawing.Color.LightSteelBlue Me.mnMercek.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnNormal, Me.mnGri, Me.mnTersYuz, Me.mnHepUstte}) Me.mnMercek.Location = New System.Drawing.Point(0, 0) Me.mnMercek.Name = "mnMercek" Me.mnMercek.Size = New System.Drawing.Size(282, 25) Me.mnMercek.Stretch = True Me.mnMercek.TabIndex = 22 ' 'mnNormal ' Me.mnNormal.Checked = True Me.mnNormal.CheckState = System.Windows.Forms.CheckState.Checked Me.mnNormal.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.mnNormal.Image = CType(resources.GetObject("mnNormal.Image"), System.Drawing.Image) Me.mnNormal.ImageTransparentColor = System.Drawing.Color.Magenta Me.mnNormal.Name = "mnNormal" Me.mnNormal.Size = New System.Drawing.Size(23, 22) Me.mnNormal.Text = "Normal Göster" ' 'mnGri ' Me.mnGri.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.mnGri.Image = CType(resources.GetObject("mnGri.Image"), System.Drawing.Image) Me.mnGri.ImageTransparentColor = System.Drawing.Color.Magenta Me.mnGri.Name = "mnGri" Me.mnGri.Size = New System.Drawing.Size(23, 22) Me.mnGri.Text = "Gri Renkte Göster" ' 'mnTersYuz ' Me.mnTersYuz.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.mnTersYuz.Image = CType(resources.GetObject("mnTersYuz.Image"), System.Drawing.Image) Me.mnTersYuz.ImageTransparentColor = System.Drawing.Color.Magenta Me.mnTersYuz.Name = "mnTersYuz" Me.mnTersYuz.Size = New System.Drawing.Size(23, 22) Me.mnTersYuz.Text = "TersYüz Et" ' 'mnHepUstte ' Me.mnHepUstte.Checked = True Me.mnHepUstte.CheckState = System.Windows.Forms.CheckState.Checked Me.mnHepUstte.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.mnHepUstte.Image = CType(resources.GetObject("mnHepUstte.Image"), System.Drawing.Image) Me.mnHepUstte.ImageTransparentColor = System.Drawing.Color.Magenta Me.mnHepUstte.Name = "mnHepUstte" Me.mnHepUstte.Size = New System.Drawing.Size(23, 22) Me.mnHepUstte.Text = "Hep Üstte tut" ' 'PicArkada ' Me.PicArkada.Image = CType(resources.GetObject("PicArkada.Image"), System.Drawing.Image) Me.PicArkada.Location = New System.Drawing.Point(136, -2) Me.PicArkada.Name = "PicArkada" Me.PicArkada.Size = New System.Drawing.Size(24, 24) Me.PicArkada.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.PicArkada.TabIndex = 7 Me.PicArkada.TabStop = False Me.PicArkada.Visible = False ' 'PicOnde ' Me.PicOnde.Image = CType(resources.GetObject("PicOnde.Image"), System.Drawing.Image) Me.PicOnde.Location = New System.Drawing.Point(122, 0) Me.PicOnde.Name = "PicOnde" Me.PicOnde.Size = New System.Drawing.Size(24, 24) Me.PicOnde.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.PicOnde.TabIndex = 6 Me.PicOnde.TabStop = False Me.PicOnde.Visible = False ' 'Slider1 ' Me.Slider1.BackColor = System.Drawing.Color.LightSteelBlue Me.Slider1.BarInnerColor = System.Drawing.Color.Black Me.Slider1.BarOuterColor = System.Drawing.Color.DimGray Me.Slider1.BarPenColor = System.Drawing.Color.WhiteSmoke Me.Slider1.BorderRoundRectSize = New System.Drawing.Size(8, 8) Me.Slider1.ElapsedInnerColor = System.Drawing.Color.Orange Me.Slider1.ElapsedOuterColor = System.Drawing.Color.Sienna Me.Slider1.LargeChange = CType(2UI, UInteger) Me.Slider1.Location = New System.Drawing.Point(106, 8) Me.Slider1.Name = "Slider1" Me.Slider1.Size = New System.Drawing.Size(89, 10) Me.Slider1.SmallChange = CType(1UI, UInteger) Me.Slider1.TabIndex = 87 Me.Slider1.Text = "slider2" Me.Slider1.ThumbInnerColor = System.Drawing.Color.White Me.Slider1.ThumbOuterColor = System.Drawing.Color.Sienna Me.Slider1.ThumbPenColor = System.Drawing.Color.Sienna Me.Slider1.ThumbRoundRectSize = New System.Drawing.Size(8, 8) Me.Slider1.Value = 25 ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.SystemColors.Control Me.ClientSize = New System.Drawing.Size(284, 262) Me.Controls.Add(Me.ToolStripTaşıyıcıPanel) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.MinimizeBox = False Me.MinimumSize = New System.Drawing.Size(250, 200) Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Büyüteç" Me.ToolStripTaşıyıcıPanel.ResumeLayout(False) Me.ToolStripTaşıyıcıPanel.PerformLayout() CType(Me.KapatPic, System.ComponentModel.ISupportInitialize).EndInit() Me.mnMercek.ResumeLayout(False) Me.mnMercek.PerformLayout() CType(Me.PicArkada, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PicOnde, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region #Region " BAŞLIKSIZ FORM..." Private mouse_offset As Point Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Const WS_CAPTION As Integer = &HC00000 Dim baseParams As CreateParams = MyBase.CreateParams 'Caption olmasın baseParams.Style = baseParams.Style And Not WS_CAPTION Return baseParams End Get End Property #End Region #Region " FORM OLAYLARI..." Private Sub KapatPic_Click(sender As System.Object, e As System.EventArgs) Handles KapatPic.Click Me.Close() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.mnHepUstte.Checked = GetSetting(Application.ProductName, Application.ProductName, " Hep Üstte", False) If mnHepUstte.Checked = True Then mnHepUstte.Image = Me.PicOnde.Image Me.TopMost = True Else mnHepUstte.Image = PicArkada.Image Me.TopMost = False End If 'Gri tonlamalı dizey başlat GorunumNitelikleri.SetColorMatrix(GriScalaDizisi) End Sub Private Sub mnHepUstte_Click(sender As System.Object, e As System.EventArgs) Handles mnHepUstte.Click If mnHepUstte.Checked = True Then mnHepUstte.Image = Me.PicOnde.Image mnHepUstte.Checked = False Me.TopMost = True Else mnHepUstte.Image = PicArkada.Image mnHepUstte.Checked = True Me.TopMost = False End If SaveSetting(Application.ProductName, Application.ProductName, " Hep Üstte", Me.mnHepUstte.Checked) End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub #End Region #Region " BÜYÜTEÇ İŞLEMLERİ..." 'Ayarlanan zaman aralığı veya yenileme hızı ile büyüteç rötuş yapmak için Timer kullanımı Private Sub tmrBoya_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrBoya.Tick BuyutecYenile() End Sub 'Ekran büyüteci programı yeniden boyamak için ayrı bir işlevi kullanarak 'oluşan titremeyi önlemeye yardımcı olacaktır. Private Sub BuyutecYenile() Dim e As Graphics = Me.CreateGraphics 'Yakınlaştırma yüzdesi alın Dim Yuzde As Single = Me.Slider1.Value / 100 Dim EnX As Single = (Me.Width) * Yuzde '- Me.Slider1.Width Dim BoyY As Single = (Me.Height - 0) * Yuzde 'Me.DurumBar.Height 'Statusbar için Yakınlaştırma Faktörü Me.YüzdeLBL.Text = " % :" & 100 - Me.Slider1.Value 'Fare Resim Çevresi Merkezi Dim DengeX As Single = EnX \ 4 Dim DengeY As Single = BoyY \ 4 'Hazır blit(Çalışma dönemi) için Gerçek Alan Dim BlitAlaniX As Integer = Me.Width ' Dim BlitAlaniY As Integer = Me.Height - 0 'Yeni Bitmap ve Grafik Nesnesi Dim b As New Bitmap(CInt(BlitAlaniX), CInt(BlitAlaniY)) Dim g As Graphics = Graphics.FromImage(b) 'Gösterimi daha hızlı yapmaya çalışın g.SmoothingMode = Drawing2D.SmoothingMode.HighSpeed g.CompositingQuality = Drawing2D.CompositingQuality.HighSpeed g.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighSpeed g.InterpolationMode = Drawing2D.InterpolationMode.Low 'Gösterimi daha hızlı yapmaya çalışın e.SmoothingMode = Drawing2D.SmoothingMode.HighSpeed e.CompositingQuality = Drawing2D.CompositingQuality.HighSpeed e.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighSpeed e.InterpolationMode = Drawing2D.InterpolationMode.Low 'Masaüstü Ve Grafik Nesnesi Dim hWndWindow As IntPtr = GetDesktopWindow() Dim hdcWindow As IntPtr = GetDC(hWndWindow) Dim hdcGraphics As IntPtr = g.GetHdc() 'BitBlt & Graphics.DrawImage Çözümü '------------------------------------------ ''(Şeffaf pencere yakalar ve Ayna Etkisini önler) BitBlt(hdcGraphics.ToInt32, 0, 0, BlitAlaniX, BlitAlaniY, hdcWindow.ToInt32, Windows.Forms.Cursor.Position.X - DengeX, Windows.Forms.Cursor.Position.Y - DengeY, SRCCOPY Or CAPTUREBLT Or NOMIRRORBITMAP) ''Renkleri tersyüz etmek için If Me.mnTersYuz.Checked = True Then BitBlt(hdcGraphics.ToInt32, 0, 0, BlitAlaniX, BlitAlaniY, hdcGraphics.ToInt32, 0, 0, NOTSRCCOPY) End If ''Belleği Boşalt ReleaseDC(hWndWindow.ToInt32, hdcWindow.ToInt32) g.ReleaseHdc(hdcGraphics) If Me.mnNormal.Checked = True Or Me.mnTersYuz.Checked = True Then e.DrawImage(b, New Rectangle(0, 0, BlitAlaniX, BlitAlaniY), 0, 0, EnX, BoyY, GraphicsUnit.Pixel) ElseIf Me.mnGri.Checked = True Then 'Gri Tonlama Görüntü Özellikleri e.DrawImage(b, New Rectangle(0, 0, BlitAlaniX, BlitAlaniY), 0, 0, EnX, BoyY, GraphicsUnit.Pixel, GorunumNitelikleri) End If e.Dispose() End Sub #End Region #Region " BÜYÜTME RENK SEÇENEKLERİ.." Private Sub mnNormal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnNormal.Click Me.mnNormal.Checked = True Me.mnGri.Checked = False Me.mnTersYuz.Checked = False End Sub Private Sub mnGri_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnGri.Click Me.mnNormal.Checked = False Me.mnGri.Checked = True Me.mnTersYuz.Checked = False End Sub Private Sub mnTersYuz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnTersYuz.Click Me.mnNormal.Checked = False Me.mnGri.Checked = False Me.mnTersYuz.Checked = True End Sub #End Region #Region " FORM TAŞIMA.." Const i As Integer = &HA1 Const j As Integer = 2 Private Sub mnMercek_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles mnMercek.MouseDown, MyBase.MouseDown mnMercek.Capture = False MyBase.Capture = False Dim msg As Message = Message.Create(Me.Handle, i, New IntPtr(j), IntPtr.Zero) Me.DefWndProc(msg) End Sub #End Region End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa