grrrrrrr
Ok, here's the problem.
I have a picture box on a form, on form startup and resize faint grid lines are drawn onto the picture box to make it look like graph paper.
Because I'm using the line method rather that lots of line controls I can't set the AutoRedraw to true. All works fine except if the form is partially or completely covered, when the grid lines vanish leaving the white picture box.
I can put up with this to a degree but I want to have the lines redrawn on focus of my app. Gotfocus and Activate don't do work (I tried making a call to the line draw the same way as the resize but nothing happens)
why??????
here's the code!
Code:Option Explicit Const L_Space = 15 Private Sub Command1_Click() Dim HorLoop As Long Dim VerLoop As Long Dim ZeroCounter As Integer ZeroCounter = 0 'vertical lines For HorLoop = Pallette1.Left To Pallette1.Width + Pallette1.Left ZeroCounter = ZeroCounter + 1 If ZeroCounter Mod L_Space = 0 Then frmMap.Line (HorLoop, Pallette1.Top + 2)-(HorLoop, Pallette1.Height + Pallette1.Top - 2), RGB(200, 200, 200) End If Next ZeroCounter = 0 ' horizontal lines For VerLoop = Pallette1.Top To Pallette1.Height + Pallette1.Top ZeroCounter = ZeroCounter + 1 If ZeroCounter Mod L_Space = 0 Then frmMap.Line (Pallette1.Left + 2, VerLoop)-(Pallette1.Width + Pallette1.Left - 2, VerLoop), RGB(200, 200, 200) End If Next End Sub Private Sub Form_Resize() On Error Resume Next Pallette1.Height = frmMap.ScaleHeight - 50 Pallette1.Width = frmMap.ScaleWidth - 30 Command1.Top = Pallette1.Top + Pallette1.Height + 20 Command2.Top = Pallette1.Top + Pallette1.Height + 20 Command3.Top = Pallette1.Top + Pallette1.Height + 20 VScroll1.Left = Pallette1.Left + Pallette1.Width '+ 1 VScroll1.Height = Pallette1.Height HScroll1.Top = Pallette1.Top + Pallette1.Height '+ 1 HScroll1.Width = Pallette1.Width DoEvents Call Command1_Click End Sub




Paul Dwyer
Reply With Quote