Geri git   Van.GEN.TR Forum | Yerel Van Forumu > Bilgisayar > Programlama > Visual Basic, Delphi, C++ Ve Diğer Diller

Cevapla
 
Konu Araçları Stil
Alt 06/04/07, 14:12   #1
gokhanaygun
Tuğgeneral
 
gokhanaygun - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Apr 2007
Bulunduğu yer: VAN
Yaş: 36
Mesajlar: 925
Tecrübe Puanı: 26 gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold
Standart Visual Basıc ' te xp buton ....

'VB.net de butonları XP yapmak icin
'(form1 in ustundeki button1 icin)
'oncelikle vb.net in drawing clasını import etmeliyiz,
'bunun icin formun en ustune;

Imports System.Drawing.Drawing2

'bundan sonra windows form designer generated code ifadesinin
'hemen altına grekli tanımlamaları yapalım;

Enum BtnState
Disabled
Normal
Hot
Pushed
End Enum

Const cornerR As Integer = 4
Const cornerD As Integer = (cornerR * 2)

'simdi butonun seklini degistiren paint Sub ını olusturalım;

Private Sub PaintXPButton(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles Button1.Paint
'eger butonun ismi degisik ise yukarda button1 yerine kendi butonunuzun ismini yazmalısınız isterseniz virgul koyup istediginiz diger butonları yazarak aynı efekti verebilirsiniz.

Dim btn As Button = CType(sender, Button)
Dim backgroundBrush As New SolidBrush(Me.BackColor)
Dim bMouseDown As Boolean = (btn.MouseButtons And MouseButtons.Left) <> 0

Dim ptMouse As Point = Me.PointToClient(btn.MousePosition)
Dim bMouseInButton As Boolean = btn.Bounds.Contains(ptMouse)

'butonun davranısını belirliyelim
Dim state As BtnState
If (btn.Enabled = False) Then
state = BtnState.Disabled
ElseIf (bMouseDown = False) Then
If (bMouseInButton = True) Then
state = BtnState.Hot
Else 'bMouseInButton = False
state = BtnState.Normal
End If
Else 'bMouseDown = True
If (bMouseInButton = True) Then
state = BtnState.Pushed
Else 'bMouseInButton = False
state = BtnState.Hot
End If
End If

e.Graphics.FillRectangle(backgroundBrush, e.ClipRectangle)

Dim rect As New Rectangle(1, 1, e.ClipRectangle.Width - (cornerR + 1), e.ClipRectangle.Height - (cornerR + 1))
Dim layoutRect As New RectangleF(rect.X, rect.Y, rect.Width, rect.Height)
Dim gradNormal As New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(0, 0, 10, e.ClipRectangle.Height), _
SystemColors.ControlLightLight, SystemColors.ActiveCaption, LinearGradientMode.Vertical)
Dim gradPushed As New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(0, 0, 10, e.ClipRectangle.Height), _
SystemColors.ActiveCaption, SystemColors.ControlLightLight, LinearGradientMode.Vertical)

Dim strFormat As New StringFormat()
strFormat.Alignment = StringAlignment.Center
strFormat.LineAlignment = StringAlignment.Center

Dim pp As GraphicsPath = RoundRectPath(rect, cornerR)

If (state <> BtnState.Disabled) Then

Dim shadowRect As New Rectangle(0, 0, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2)

e.Graphics.DrawLine(SystemPens.ControlDarkDark, _
shadowRect.Left, shadowRect.Bottom - (cornerR + 1), _
shadowRect.Left, shadowRect.Top + cornerR)
e.Graphics.DrawArc(SystemPens.ControlDarkDark, _
New Rectangle(shadowRect.Left, shadowRect.Top, cornerD, cornerD), 180, 90)
e.Graphics.DrawLine(SystemPens.ControlDarkDark, _
shadowRect.Left + cornerR, shadowRect.Top, _
shadowRect.Right - (cornerR + 1), shadowRect.Top
e.Graphics.DrawArc(SystemPens.ControlDark, _
New Rectangle(shadowRect.Right - (cornerD + 1), shadowRect.Top, cornerD, cornerD), 270, 90)
e.Graphics.DrawLine(SystemPens.ControlLightLight, _
shadowRect.Right - 1, shadowRect.Top + cornerR, _
shadowRect.Right - 1, shadowRect.Bottom - (cornerR + 1))
e.Graphics.DrawArc(SystemPens.ControlLightLight, _
New Rectangle(shadowRect.Right - (cornerD + 1), _
shadowRect.Bottom - (cornerD + 1), cornerD, cornerD), 0, 90)
e.Graphics.DrawLine(SystemPens.ControlLightLight, _
shadowRect.Right - (cornerR + 1), shadowRect.Bottom - 1, _
shadowRect.Left + cornerR, shadowRect.Bottom - 1)
e.Graphics.DrawArc(SystemPens.ControlLight, _
New Rectangle(shadowRect.Left, shadowRect.Bottom - (cornerD + 1), cornerD, cornerD), 90, 90)
End If

Select Case state
Case BtnState.Disabled
e.Graphics.FillPath(SystemBrushes.ControlLight, pp)
e.Graphics.DrawPath(SystemPens.ControlDarkDark, pp)
e.Graphics.DrawString(btn.Text, btn.Font, SystemBrushes.ControlDarkDark, layoutRect, strFormat)

Case BtnState.Hot, BtnState.Normal
e.Graphics.FillPath(gradNormal, pp)
e.Graphics.DrawPath(SystemPens.ControlDarkDark, pp)
If (state = BtnState.Hot) Then
e.Graphics.DrawLine(Pens.Orange, rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 1)
e.Graphics.DrawLine(Pens.Orange, rect.Right - 1, rect.Top + 1, rect.Right - 1, rect.Bottom - 1)
e.Graphics.DrawLine(Pens.PeachPuff, rect.Left + 2, rect.Top + 1, rect.Right - 2, rect.Top + 1)
e.Graphics.DrawLine(Pens.DarkOrange, rect.Left + 2, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1)
e.Graphics.DrawRectangle(Pens.Orange, rect.Left + 2, rect.Top + 2, rect.Width - 4, rect.Height - 5)
End If
e.Graphics.DrawString(btn.Text, btn.Font, SystemBrushes.ActiveCaptionText, layoutRect, strFormat)

Case BtnState.Pushed
e.Graphics.FillPath(gradPushed, pp)
Dim hiRect As Rectangle = rect
hiRect.Inflate(-1, -1)
e.Graphics.DrawRectangle(SystemPens.ControlLightLi ght, hiRect)
e.Graphics.DrawPath(SystemPens.ControlDarkDark, pp)
e.Graphics.DrawString(btn.Text, btn.Font, SystemBrushes.ActiveCaptionText, layoutRect, strFormat)
End Select

pp.Dispose()
strFormat.Dispose()
backgroundBrush.Dispose()
gradNormal.Dispose()
gradPushed.Dispose()

End Sub

'simdi de butona son seklini bir fonksiyon yardımıyla verelim


Public Shared Function RoundRectPath(ByVal rect As Rectangle, ByVal cornerRadius As Integer) As GraphicsPath
Dim cornerDiameter As Integer = cornerRadius * 2
Dim pp As New GraphicsPath()
pp.AddLine(rect.Left + cornerRadius, rect.Top, rect.Right - cornerRadius, rect.Top)
pp.AddArc(New Rectangle(rect.Right - cornerDiameter, rect.Top, cornerDiameter, cornerDiameter), 270, 90)
pp.AddLine(rect.Right, rect.Top + cornerRadius, rect.Right, rect.Bottom - cornerRadius)
pp.AddArc(New Rectangle(rect.Right - cornerDiameter, rect.Bottom - cornerDiameter, cornerDiameter, cornerDiameter), 0, 90)
pp.AddLine(rect.Right - cornerRadius, rect.Bottom, rect.Left + cornerRadius, rect.Bottom)
pp.AddArc(New Rectangle(rect.Left, rect.Bottom - cornerDiameter, cornerDiameter, cornerDiameter), 90, 90)
pp.AddLine(rect.Left, rect.Bottom - cornerRadius, rect.Left, rect.Top + cornerRadius)
pp.AddArc(New Rectangle(rect.Left, rect.Top, cornerDiameter, cornerDiameter), 180, 90)
pp.CloseFigure()
Return pp
End Function
gokhanaygun isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayısı: 187
Alt 16/06/07, 13:45   #2
LastDesiqner
Super Moderator
 
LastDesiqner - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Jan 2007
Bulunduğu yer: ναη
Mesajlar: 8.132
Tecrübe Puanı: 56 LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute LastDesiqner has a reputation beyond repute
Standart

emeğine sağlık kardeş... teşekkürler....
__________________
[Bu Adresi (link) Görme Yetkiniz Yok BEDAVA'ya Üye Ol Sitemizden Faydalan....]
[Bu Adresi (link) Görme Yetkiniz Yok BEDAVA'ya Üye Ol Sitemizden Faydalan....]


[Bu Adresi (link) Görme Yetkiniz Yok BEDAVA'ya Üye Ol Sitemizden Faydalan....]
LastDesiqner isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayısı: 488
Takımınız:
Alt 31/07/08, 15:32   #3
Neutralizer
Yasaklı kullanıcı
 
Neutralizer - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Jan 2008
Bulunduğu yer: İstediğin yerden
Mesajlar: 1.890
Tecrübe Puanı: 0 Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute
Standart

paylaşım için tşkrlr
Neutralizer isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayısı: 317
Takımınız:
Cevapla


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 
Konu Araçları
Stil

Yetkileriniz
Yeni Mesaj yazma yetkiniz Aktif değil dir.
Mesajlara Cevap verme yetkiniz aktif değil dir.
Eklenti ekleme yetkiniz Aktif değil dir.
Kendi Mesajınızı değiştirme yetkiniz Aktif değildir dir.

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-KodlarıKapalı
Gitmek istediğiniz klasörü seçiniz


Bütün Zaman Ayarları WEZ +3 olarak düzenlenmiştir. Şu Anki Saat: 17:56 .


Powered by vBulletin
Copyright © 2000-2007 Jelsoft Enterprises Limited.
Sitemap
6, 5, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 113, 16, 17, 18, 19, 81, 20, 27, 22, 23, 24, 25, 26, 48, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 136, 40, 58, 45, 42, 44, 46, 47, 53, 54, 55, 56, 57, 59, 60, 70, 61, 62, 63, 64, 65, 66, 68, 69, 71, 72, 74, 75, 76, 77, 78, 79, 80, 82, 83, 96, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 98, 97, 100, 101, 102, 103, 106, 104, 105, 112, 109, 108, 107, 110, 111, 114, 115, 118, 116, 117, 119, 148, 154, 124, 165, 122, 120, 123, 121, 150, 153, 125, 128, 129, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 151, 149, 202, 175, 164, 152, 167, 155, 156, 157, 158, 159, 160, 161, 162, 163, 195, 169, 166, 168, 170, 171, 172, 199, 174, 173, 196, 200, 176, 177, 180, 178, 179, 182, 189, 187, 184, 186, 191, 192, 193, 194, 197, 198, 201, 203, 229, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 236, 231, 232, 233, 234, 235, 237, 240, 239, 241, 243, 242, 244,