PDA

View Full Version : AutoRedraw در دات نت



amirsajjadi
پنج شنبه 01 آذر 1386, 14:44 عصر
آیا خاصیتی برای فرم وجود داره که مثل خاصیت AutoRedraw ویژوال بیسیک 6 باشه

__siavash__
پنج شنبه 01 آذر 1386, 17:39 عصر
AutoRedraw Property

<DIV class=subSection xmlns="">In Visual Basic 6.0, graphics methods can be called from any event procedure; the AutoRedraw property is used to persist graphics when graphics methods are called from an event other than the Paint event.

In Visual Basic 2005, graphics methods should only be called from the Paint event procedure, or in the case of some owner-drawn controls, from the various Draw event procedures
The AutoRedraw property is no longer supported and is not necessary because the Paint and Draw events automatically persist graphics.

__siavash__
پنج شنبه 01 آذر 1386, 17:48 عصر
نمیدونم چرا پست بالایی ویرایش نمیشه !!!
Displaying Text on a Form


' Visual Basic 6.0
Private Sub Form_Paint()
Me.Font.Size = 24
Me.Font.Bold = True
Me.ForeColor = vbRed
Print "Hello World!"
End Sub




' Visual Basic.Net 2005
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim TextFont As New System.Drawing.Font("Arial", 24, FontStyle.Bold)
Dim TextBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red )
e.Graphics.DrawString("Hello World!", TextFont, TextBrush, 10, 10)
TextFont.Dispose()
TextBrush.Dispose()
End Sub

amirsajjadi
پنج شنبه 01 آذر 1386, 18:22 عصر
نه ؛ من میدونم اگه تو رویداد Paint کدهای گرافیک رو بنویسم دیگه از روی فرم پاک نمیشه. من منظورم اینه که توی رویدادی غیر از Paint ، مثلا من میخوام روی باتونی اگه کلیک کردم خطی روی فرم رسم بشه و دیگه پاک نشه دقیقا مثل AutoRedraw توی بیسیک 6

amirsajjadi
پنج شنبه 01 آذر 1386, 19:07 عصر
دوستان خودم یک روش پیدا کردم اونم اینه که کل گرافیک رسم شده روی فرم رو توی یک Bitmap (حافظه) کپی کنم و وقتی که فرم Paint میشه اون بیت مپ رو روی فرم دوباره نمایش بدم ولی این روش من خیلی سرعت برنامه رو میاره پایین
حالا اگه شما روش دیگه ای سراغ دارید حتما بزارید ممنون میشم