473,802 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Speeding up the Label_Paint event

I have a program that is an external viewer. It is launched with a hotkey
from within another application. The program has 30 labels that can be
displayed. Since the labels may not always be oriented the same as the
Operating System I needed to use the Label_Paint event to PAINT the labels
text if it not oriented the same as the operating system. I am trying to
figure out a way to make this event happen faster or optimize it if
possible. I am new to this code. I think the idea was Herfreid's, can't even
remember. Here is the code:

Public Sub myPaint1(ByVal e As System.Windows. Forms.PaintEven tArgs)
Dim strLabelName As String

Select Case myPLabel.Name

Case "lblP1JoyUp "

strLabelName = Label1.Text

Case "lblP1JoyLe ft"

strLabelName = Label2.Text

Case "lblP1JoyDo wn"

strLabelName = Label3.Text

Case "lblP1JoyRi ght"

strLabelName = Label4.Text

Case "lblP1B1"

strLabelName = Label5.Text

Case "lblP1B2"

strLabelName = Label6.Text

Case "lblP1B3"

strLabelName = Label7.Text

Case "lblP1B4"

strLabelName = Label8.Text

Case "lblP1B5"

strLabelName = Label9.Text

Case "lblP1B6"

strLabelName = Label10.Text

Case "lblP1B7"

strLabelName = Label11.Text

Case "lblP1B8"

strLabelName = Label12.Text

Case "lblP1JoyTy pe"

strLabelName = Label25.Text

Case "lblGameNam e"

strLabelName = Label27.Text

Case "lblNumPlay ers"

strLabelName = Label28.Text

Case "lblHistory "

strLabelName = Label29.Text

Case "lblUndocumente d"

strLabelName = Label30.Text

End Select

If myPLabel.Visibl e = True Then

Dim myFontBrush As New SolidBrush(myPL abel.ForeColor)

If frm1.intPriHP1 = frm1.intPriVP1 Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width
+ x) \ 2, (myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""

e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

lblP1JoyUp.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width -
x) \ 2, (myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf frm1.intPriHP1 <> frm1.intPriVP1 Then

If strGameO = "h" Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf strGameO = "v" Then

If strLay2RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay2RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay2RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay2RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

End If

End If

myFontBrush.Dis pose()

End If

End Sub

Any ides how I might speed this up? Currently, if then user is displaying
all 30 labels I need am calling this code 30 times.

Thnaks,
John
Nov 21 '05 #1
5 1330
John,

If your call your code 30 times in a loop or 1 time one by one, will not
speed up your code, it makes only your program easier to maintanance.

It is possible that Herfried has pointed you on the invalidate method

http://msdn.microsoft.com/library/de...idatetopic.asp

However from that not sure because I am not really a painter.

Just my thought,

Cor
Nov 21 '05 #2
John,
The paint event should be doing as little as possible.

How is myPaint1 sub being called?
How is myPLabel being set?

Based on what you posted I would make the following recommendations :
1. Use variables of the correct type (I would expect strLay1RotAngle &
strLay2RotAngle would be integers not strings).
2. Seriously (very seriously) consider using a class derived from Label
instead of all the code in your form.

For example rather then having 30 Labels on my form I would have 30
SpecializedLabe ls on my form. Where SpecializedLabe l inherits from Label,
and has properties, methods & event handlers specific to each label.

Within the SpecializedLabe l class I would override the OnPaint method to
handle painting that specific label. I would have properties on
SpecializedLabe l to handle the rotation & what to display.

I would use the ControlStyles.U serPaint to handle all the painting myself,
then simply use the Text property for what to paint (rather then the select
case myPLabel.Name). Alternatively I would have a property for LabelName to
display...

I will try to post a start of a sample later today.

Hope this helps
Jay

"jcrouse" <me> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
I have a program that is an external viewer. It is launched with a hotkey
from within another application. The program has 30 labels that can be
displayed. Since the labels may not always be oriented the same as the
Operating System I needed to use the Label_Paint event to PAINT the labels
text if it not oriented the same as the operating system. I am trying to
figure out a way to make this event happen faster or optimize it if
possible. I am new to this code. I think the idea was Herfreid's, can't even remember. Here is the code:

Public Sub myPaint1(ByVal e As System.Windows. Forms.PaintEven tArgs)
Dim strLabelName As String

Select Case myPLabel.Name

Case "lblP1JoyUp "

strLabelName = Label1.Text

Case "lblP1JoyLe ft"

strLabelName = Label2.Text

Case "lblP1JoyDo wn"

strLabelName = Label3.Text

Case "lblP1JoyRi ght"

strLabelName = Label4.Text

Case "lblP1B1"

strLabelName = Label5.Text

Case "lblP1B2"

strLabelName = Label6.Text

Case "lblP1B3"

strLabelName = Label7.Text

Case "lblP1B4"

strLabelName = Label8.Text

Case "lblP1B5"

strLabelName = Label9.Text

Case "lblP1B6"

strLabelName = Label10.Text

Case "lblP1B7"

strLabelName = Label11.Text

Case "lblP1B8"

strLabelName = Label12.Text

Case "lblP1JoyTy pe"

strLabelName = Label25.Text

Case "lblGameNam e"

strLabelName = Label27.Text

Case "lblNumPlay ers"

strLabelName = Label28.Text

Case "lblHistory "

strLabelName = Label29.Text

Case "lblUndocumente d"

strLabelName = Label30.Text

End Select

If myPLabel.Visibl e = True Then

Dim myFontBrush As New SolidBrush(myPL abel.ForeColor)

If frm1.intPriHP1 = frm1.intPriVP1 Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2, (myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""

e.Graphics.Tran slateTransform( myPLabel.Client Size.Width, myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

lblP1JoyUp.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2, (myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf frm1.intPriHP1 <> frm1.intPriVP1 Then

If strGameO = "h" Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf strGameO = "v" Then

If strLay2RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay2RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay2RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay2RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

End If

End If

myFontBrush.Dis pose()

End If

End Sub

Any ides how I might speed this up? Currently, if then user is displaying
all 30 labels I need am calling this code 30 times.

Thnaks,
John

Nov 21 '05 #3
The myPaint1 sub is being called 30 times. Once from each Label_Paint event.
I agree about the user defined controls. You guys suggested that a month or
two ago, however, it is over my head and I'm still trying to figure out how
to do it. Here is one of my Label_Paint events:

Private Sub lblP1JoyUp_Pain t(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles lblP1JoyUp.Pain t

myPLabel = lblP1JoyUp

myPaint1(e)

End Sub

Thanks,
John

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
John,
The paint event should be doing as little as possible.

How is myPaint1 sub being called?
How is myPLabel being set?

Based on what you posted I would make the following recommendations :
1. Use variables of the correct type (I would expect strLay1RotAngle &
strLay2RotAngle would be integers not strings).
2. Seriously (very seriously) consider using a class derived from Label
instead of all the code in your form.

For example rather then having 30 Labels on my form I would have 30
SpecializedLabe ls on my form. Where SpecializedLabe l inherits from Label,
and has properties, methods & event handlers specific to each label.

Within the SpecializedLabe l class I would override the OnPaint method to
handle painting that specific label. I would have properties on
SpecializedLabe l to handle the rotation & what to display.

I would use the ControlStyles.U serPaint to handle all the painting myself,
then simply use the Text property for what to paint (rather then the select case myPLabel.Name). Alternatively I would have a property for LabelName to display...

I will try to post a start of a sample later today.

Hope this helps
Jay

"jcrouse" <me> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
I have a program that is an external viewer. It is launched with a hotkey from within another application. The program has 30 labels that can be
displayed. Since the labels may not always be oriented the same as the
Operating System I needed to use the Label_Paint event to PAINT the labels text if it not oriented the same as the operating system. I am trying to
figure out a way to make this event happen faster or optimize it if
possible. I am new to this code. I think the idea was Herfreid's, can't

even
remember. Here is the code:

Public Sub myPaint1(ByVal e As System.Windows. Forms.PaintEven tArgs)
Dim strLabelName As String

Select Case myPLabel.Name

Case "lblP1JoyUp "

strLabelName = Label1.Text

Case "lblP1JoyLe ft"

strLabelName = Label2.Text

Case "lblP1JoyDo wn"

strLabelName = Label3.Text

Case "lblP1JoyRi ght"

strLabelName = Label4.Text

Case "lblP1B1"

strLabelName = Label5.Text

Case "lblP1B2"

strLabelName = Label6.Text

Case "lblP1B3"

strLabelName = Label7.Text

Case "lblP1B4"

strLabelName = Label8.Text

Case "lblP1B5"

strLabelName = Label9.Text

Case "lblP1B6"

strLabelName = Label10.Text

Case "lblP1B7"

strLabelName = Label11.Text

Case "lblP1B8"

strLabelName = Label12.Text

Case "lblP1JoyTy pe"

strLabelName = Label25.Text

Case "lblGameNam e"

strLabelName = Label27.Text

Case "lblNumPlay ers"

strLabelName = Label28.Text

Case "lblHistory "

strLabelName = Label29.Text

Case "lblUndocumente d"

strLabelName = Label30.Text

End Select

If myPLabel.Visibl e = True Then

Dim myFontBrush As New SolidBrush(myPL abel.ForeColor)

If frm1.intPriHP1 = frm1.intPriVP1 Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width
+ x) \ 2, (myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""

e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

lblP1JoyUp.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width -
x) \ 2, (myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf frm1.intPriHP1 <> frm1.intPriVP1 Then

If strGameO = "h" Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

End If

ElseIf strGameO = "v" Then

If strLay2RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay2RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

ElseIf strLay2RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay2RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

End If

End If

End If

myFontBrush.Dis pose()

End If

End Sub

Any ides how I might speed this up? Currently, if then user is displaying all 30 labels I need am calling this code 30 times.

Thnaks,
John


Nov 21 '05 #4
I'm sure here I could have also use some sort of DirectCast(send er, Label)
but don't really understand that syntax either. I'll get there eventually.
It's just a slow process.

Thanks,
John

"jcrouse" <me> wrote in message
news:ea******** ******@TK2MSFTN GP15.phx.gbl...
The myPaint1 sub is being called 30 times. Once from each Label_Paint event. I agree about the user defined controls. You guys suggested that a month or two ago, however, it is over my head and I'm still trying to figure out how to do it. Here is one of my Label_Paint events:

Private Sub lblP1JoyUp_Pain t(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles lblP1JoyUp.Pain t

myPLabel = lblP1JoyUp

myPaint1(e)

End Sub

Thanks,
John

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
John,
The paint event should be doing as little as possible.

How is myPaint1 sub being called?
How is myPLabel being set?

Based on what you posted I would make the following recommendations :
1. Use variables of the correct type (I would expect strLay1RotAngle &
strLay2RotAngle would be integers not strings).
2. Seriously (very seriously) consider using a class derived from Label
instead of all the code in your form.

For example rather then having 30 Labels on my form I would have 30
SpecializedLabe ls on my form. Where SpecializedLabe l inherits from Label,
and has properties, methods & event handlers specific to each label.

Within the SpecializedLabe l class I would override the OnPaint method to
handle painting that specific label. I would have properties on
SpecializedLabe l to handle the rotation & what to display.

I would use the ControlStyles.U serPaint to handle all the painting myself, then simply use the Text property for what to paint (rather then the

select
case myPLabel.Name). Alternatively I would have a property for LabelName

to
display...

I will try to post a start of a sample later today.

Hope this helps
Jay

"jcrouse" <me> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
I have a program that is an external viewer. It is launched with a hotkey from within another application. The program has 30 labels that can be
displayed. Since the labels may not always be oriented the same as the
Operating System I needed to use the Label_Paint event to PAINT the labels text if it not oriented the same as the operating system. I am trying to figure out a way to make this event happen faster or optimize it if
possible. I am new to this code. I think the idea was Herfreid's, can't even
remember. Here is the code:

Public Sub myPaint1(ByVal e As
System.Windows. Forms.PaintEven tArgs) Dim strLabelName As String

Select Case myPLabel.Name

Case "lblP1JoyUp "

strLabelName = Label1.Text

Case "lblP1JoyLe ft"

strLabelName = Label2.Text

Case "lblP1JoyDo wn"

strLabelName = Label3.Text

Case "lblP1JoyRi ght"

strLabelName = Label4.Text

Case "lblP1B1"

strLabelName = Label5.Text

Case "lblP1B2"

strLabelName = Label6.Text

Case "lblP1B3"

strLabelName = Label7.Text

Case "lblP1B4"

strLabelName = Label8.Text

Case "lblP1B5"

strLabelName = Label9.Text

Case "lblP1B6"

strLabelName = Label10.Text

Case "lblP1B7"

strLabelName = Label11.Text

Case "lblP1B8"

strLabelName = Label12.Text

Case "lblP1JoyTy pe"

strLabelName = Label25.Text

Case "lblGameNam e"

strLabelName = Label27.Text

Case "lblNumPlay ers"

strLabelName = Label28.Text

Case "lblHistory "

strLabelName = Label29.Text

Case "lblUndocumente d"

strLabelName = Label30.Text

End Select

If myPLabel.Visibl e = True Then

Dim myFontBrush As New SolidBrush(myPL abel.ForeColor)

If frm1.intPriHP1 = frm1.intPriVP1 Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width
+ x) \ 2, (myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""

e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

lblP1JoyUp.Text = ""

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width -
x) \ 2, (myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font,
myFontBrush, -y, 0)

End If

ElseIf frm1.intPriHP1 <> frm1.intPriVP1 Then

If strGameO = "h" Then

If strLay1RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay1RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

ElseIf strLay1RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay1RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

End If

ElseIf strGameO = "v" Then

If strLay2RotAngle = "0" Then

myPLabel.Text = strLabelName

ElseIf strLay2RotAngle = "90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
(myPLabel.Clien tSize.Height + y) \ 2)

e.Graphics.Rota teTransform(90)

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

ElseIf strLay2RotAngle = "180" Then

Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center

sf.LineAlignmen t = StringAlignment .Center

myPLabel.Text = ""
e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
myPLabel.Client Size.Height)

e.Graphics.Rota teTransform(180 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)

ElseIf strLay2RotAngle = "-90" Then

Dim y As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)

Dim x As Integer =
CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)

myPLabel.Text = ""
e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
(myPLabel.Clien tSize.Height - y) \ 2)

e.Graphics.Rota teTransform(270 )

e.Graphics.Draw String(strLabel Name, myPLabel.Font, myFontBrush, -y, 0)

End If

End If

End If

myFontBrush.Dis pose()

End If

End Sub

Any ides how I might speed this up? Currently, if then user is displaying all 30 labels I need am calling this code 30 times.

Thnaks,
John



Nov 21 '05 #5
John,
Unfortunately I do not have time to come up with a meaningful sample for
you.

You can shorten the following to:
Private Sub lblP1JoyUp_Pain t(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles lblP1JoyUp.Pain t

myPLabel = DirectCast(send er, Label)

myPaint1(e)

End Sub
If you do the above all 30 times, then you can simply reduce it to once,
with 30 controls on the Handles.

Private Sub lblP1JoyUp_Pain t(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles lblP1JoyUp.Pain t,
lblP2JoyUp.Pain t...

myPLabel = DirectCast(send er, Label)

myPaint1(e)

End Sub
I would recommend you start with Robin A. Reynolds-Haertle's book "OOP -
with Microsoft Visual Basic .NET and Microsoft Visual C# .NET - Step by
Step" from MS Press. As its a good book on the how of OO. Taking an OO
approach with your app should significantly reduce the amount of code you
have, which should also cause it to run quicker (you would not be jumping
through hopes to get to select case statements to get back to the control
that you started with.
Hope this helps
Jay

"jcrouse" <me> wrote in message
news:ea******** ******@TK2MSFTN GP15.phx.gbl... The myPaint1 sub is being called 30 times. Once from each Label_Paint
event.
I agree about the user defined controls. You guys suggested that a month
or
two ago, however, it is over my head and I'm still trying to figure out
how
to do it. Here is one of my Label_Paint events:

Private Sub lblP1JoyUp_Pain t(ByVal sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles lblP1JoyUp.Pain t

myPLabel = lblP1JoyUp

myPaint1(e)

End Sub

Thanks,
John

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:Ol******** ******@TK2MSFTN GP10.phx.gbl...
John,
The paint event should be doing as little as possible.

How is myPaint1 sub being called?
How is myPLabel being set?

Based on what you posted I would make the following recommendations :
1. Use variables of the correct type (I would expect strLay1RotAngle &
strLay2RotAngle would be integers not strings).
2. Seriously (very seriously) consider using a class derived from Label
instead of all the code in your form.

For example rather then having 30 Labels on my form I would have 30
SpecializedLabe ls on my form. Where SpecializedLabe l inherits from Label,
and has properties, methods & event handlers specific to each label.

Within the SpecializedLabe l class I would override the OnPaint method to
handle painting that specific label. I would have properties on
SpecializedLabe l to handle the rotation & what to display.

I would use the ControlStyles.U serPaint to handle all the painting
myself,
then simply use the Text property for what to paint (rather then the

select
case myPLabel.Name). Alternatively I would have a property for LabelName

to
display...

I will try to post a start of a sample later today.

Hope this helps
Jay

"jcrouse" <me> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
> I have a program that is an external viewer. It is launched with a hotkey > from within another application. The program has 30 labels that can be
> displayed. Since the labels may not always be oriented the same as the
> Operating System I needed to use the Label_Paint event to PAINT the labels > text if it not oriented the same as the operating system. I am trying
> to
> figure out a way to make this event happen faster or optimize it if
> possible. I am new to this code. I think the idea was Herfreid's, can't

even
> remember. Here is the code:
>
> Public Sub myPaint1(ByVal e As System.Windows. Forms.PaintEven tArgs)
> Dim strLabelName As String
>
> Select Case myPLabel.Name
>
> Case "lblP1JoyUp "
>
> strLabelName = Label1.Text
>
> Case "lblP1JoyLe ft"
>
> strLabelName = Label2.Text
>
> Case "lblP1JoyDo wn"
>
> strLabelName = Label3.Text
>
> Case "lblP1JoyRi ght"
>
> strLabelName = Label4.Text
>
> Case "lblP1B1"
>
> strLabelName = Label5.Text
>
> Case "lblP1B2"
>
> strLabelName = Label6.Text
>
> Case "lblP1B3"
>
> strLabelName = Label7.Text
>
> Case "lblP1B4"
>
> strLabelName = Label8.Text
>
> Case "lblP1B5"
>
> strLabelName = Label9.Text
>
> Case "lblP1B6"
>
> strLabelName = Label10.Text
>
> Case "lblP1B7"
>
> strLabelName = Label11.Text
>
> Case "lblP1B8"
>
> strLabelName = Label12.Text
>
> Case "lblP1JoyTy pe"
>
> strLabelName = Label25.Text
>
> Case "lblGameNam e"
>
> strLabelName = Label27.Text
>
> Case "lblNumPlay ers"
>
> strLabelName = Label28.Text
>
> Case "lblHistory "
>
> strLabelName = Label29.Text
>
> Case "lblUndocumente d"
>
> strLabelName = Label30.Text
>
> End Select
>
> If myPLabel.Visibl e = True Then
>
> Dim myFontBrush As New SolidBrush(myPL abel.ForeColor)
>
> If frm1.intPriHP1 = frm1.intPriVP1 Then
>
> If strLay1RotAngle = "0" Then
>
> myPLabel.Text = strLabelName
>
> ElseIf strLay1RotAngle = "90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> myPLabel.Text = ""
>
>

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width
> + x) \ 2, (myPLabel.Clien tSize.Height + y) \ 2)
>
> e.Graphics.Rota teTransform(90)
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font,
> myFontBrush, -y, 0)
>
> ElseIf strLay1RotAngle = "180" Then
>
> Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
>
> sf.LineAlignmen t = StringAlignment .Center
>
> myPLabel.Text = ""
>
>

e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
> myPLabel.Client Size.Height)
>
> e.Graphics.Rota teTransform(180 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font,
> myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)
>
> ElseIf strLay1RotAngle = "-90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> lblP1JoyUp.Text = ""
>
>
>
>

e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width
-
> x) \ 2, (myPLabel.Clien tSize.Height - y) \ 2)
>
> e.Graphics.Rota teTransform(270 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font,
> myFontBrush, -y, 0)
>
> End If
>
> ElseIf frm1.intPriHP1 <> frm1.intPriVP1 Then
>
> If strGameO = "h" Then
>
> If strLay1RotAngle = "0" Then
>
> myPLabel.Text = strLabelName
>
> ElseIf strLay1RotAngle = "90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
> (myPLabel.Clien tSize.Height + y) \ 2)
>
> e.Graphics.Rota teTransform(90)
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, -y, 0)
>
> ElseIf strLay1RotAngle = "180" Then
>
> Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
>
> sf.LineAlignmen t = StringAlignment .Center
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
> myPLabel.Client Size.Height)
>
> e.Graphics.Rota teTransform(180 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)
>
> ElseIf strLay1RotAngle = "-90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
> (myPLabel.Clien tSize.Height - y) \ 2)
>
> e.Graphics.Rota teTransform(270 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, -y, 0)
>
> End If
>
> ElseIf strGameO = "v" Then
>
> If strLay2RotAngle = "0" Then
>
> myPLabel.Text = strLabelName
>
> ElseIf strLay2RotAngle = "90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width + x) \ 2,
> (myPLabel.Clien tSize.Height + y) \ 2)
>
> e.Graphics.Rota teTransform(90)
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, -y, 0)
>
> ElseIf strLay2RotAngle = "180" Then
>
> Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
>
> sf.LineAlignmen t = StringAlignment .Center
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( myPLabel.Client Size.Width,
> myPLabel.Client Size.Height)
>
> e.Graphics.Rota teTransform(180 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, RectangleF.op_I mplicit(myPLabe l.ClientRectang le), sf)
>
> ElseIf strLay2RotAngle = "-90" Then
>
> Dim y As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Width)
>
> Dim x As Integer =
> CInt(e.Graphics .MeasureString( strLabelName, myPLabel.Font). Height)
>
> myPLabel.Text = ""
>
>
> e.Graphics.Tran slateTransform( (myPLabel.Clien tSize.Width - x) \ 2,
> (myPLabel.Clien tSize.Height - y) \ 2)
>
> e.Graphics.Rota teTransform(270 )
>
> e.Graphics.Draw String(strLabel Name, myPLabel.Font, > myFontBrush, -y, 0)
>
> End If
>
> End If
>
> End If
>
> myFontBrush.Dis pose()
>
> End If
>
> End Sub
>
>
>
> Any ides how I might speed this up? Currently, if then user is displaying > all 30 labels I need am calling this code 30 times.
>
> Thnaks,
> John
>
>



Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2715
by: Snyke | last post by:
Hi. I have a command line script which works really fine, the only problem is that it take *really* long for the first output to be printed on screen. Since I also get some HTTP headers I'm suspecting that some sort of output buffering is used. How can I tell PHP to flush the buffer automatically (without using flush(); after every print or echo) and to remove the headers?
0
407
by: Apollo | last post by:
I have about 20K records that result from the following query. Front end for the database is ACCESS97 and pulling up 20K records makes a huge performance hit. For the form in question I am using PASSTHROUGH type query (the one that just passes everything straight to server without ODBC). NOTE: souce_for_inquiries_form is the TEMP table and is searchable in the from (it feeds a pull-down list). SELECT inquiries.inquiry_id,...
12
2232
by: dvumani | last post by:
I have C code which computes the row sums of a matrix, divide each element of each row with the row sum and then compute the column sum of the resulting matrix. Is there a way I can speed up the code in C: /* Here is the code */ // Table is "wij" int i, j; for(i = 0; i < N; ++i) {
9
3406
by: mfyahya | last post by:
Hi, I'm new to databases :) I need help speeding up select queries on my data which are currently taking 4-5 seconds. I set up a single large table of coordinates data with an index on the fields I use most frequently in select queries. The data is about 100MB and index is 80MB. The table has the following structure: CREATE TABLE `ptimes` ( `id` INT UNSIGNED NOT NULL , `rc` CHAR ( 1 ) UNSIGNED NOT NULL ,
2
1564
by: Robert Wilkens | last post by:
Ok... This may be the wrong forum, but it's the first place I'm trying. I'm new to C# and just implemented the 3-tier Distributed application from Chapter 1 (the first walkthrough) in the "Walkthrough" book that comes with Visual Studio .NET 2003 Enterprise Architect. My first observation is -- woah, is this thing slow. From the time I clicked "load" to the time I had a populated data set on the windows-based app was almost 5-10...
2
1259
by: OHM | last post by:
I was wondering about this topic and although I accept that different situations call for different solutions, but wondered are there any other solutions and whether has anyone carried out a comparison of the different methods for avoiding JIT. Further more, is there anything I should be considering before using NGEN? Better methods etc > TIA
6
1656
by: jcrouse | last post by:
I am having problems with a Label_Paint event causing a continuous loop. Here is an explanation of the code. I right click on a label and a context menu pops up. I then select a menu item named "cmLSolidColor". Here is its code:
5
1440
by: RobinAG | last post by:
Hello, I just split my database into front and back end. My front end users are experiencing really slow opening of forms. I've searched online for help speeding up forms, but I'm not sure what the best way is with my current setup. I've inherited the database from a previous programmer, and he set things up a little uniquely. Here's the deal: I have a main form that opens, listing in a subform all of the projects, with some top-level...
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.