This surely must be a bug, yes?
MM
If it is, why fight it. Change drawmode at runtime.
'=====
Option Explicit
Private Sub Form_Load()
Picture1.DrawMode = vbNotXorPen
End Sub
Private Sub Picture1_Click()
Debug.Print Picture1.DrawMode 'shows 10
End Sub
'=====
IDE.
MM
>"MM" <kyli...@yahoo.co.uk> wrote in message
>news:jq46o4hk9g72tjhlh...@4ax.com...
>>
>> This surely must be a bug, yes?
>>
>> MM
>
>If it is, why fight it. Change drawmode at runtime.
It doesn't ever change in the compiled exe, so it's not a problem. But
irritating nevertheless. I don't like the idea of hiding a bug if it
~is~ a bug. I'd prefer to work round it by manually resetting the
value to 10 when necessary.
When it first happened I assumed I'd clicked on the wrong field in
Properties, but it's absolutely not due to anything I'm doing. I'm
just surprised that nobody else has had a similar problem with
DrawMode. Oh, by the way, I recently upgraded to SP6 and it happened
before and since.
MM
VB is probably calling GetROP2() to see the current DrawMode value rather
than use something from memory. My guess is that it is reset when you close
the Form design window and reopen it. This method have the added benefit
that if you mix API calls and VB's properties, the properties would
represent the correct settings.
Well, if it ~is~ a bug, then it's a bug that is certainly going to go
unfixed. That being the case, it makes more sense to work around it by
changing drawmode at runtime, rather than manually changing it all the time,
no?
--
Regards,
Rick Raisley
heavymetal-A-T-bellsouth-D-O-T-net
>"MM" <kyli...@yahoo.co.uk> wrote in message
>news:s9e6o4tr0sc9neq67...@4ax.com...
>> On Fri, 30 Jan 2009 08:17:25 -0800, "Ken Halter"
>> <Ken_Halter@Use_Sparingly_Hotmail.com> wrote:
>>
>>>"MM" <kyli...@yahoo.co.uk> wrote in message
>>>news:jq46o4hk9g72tjhlh...@4ax.com...
>>>>
>>>> This surely must be a bug, yes?
>>>>
>>>> MM
>>>
>>>If it is, why fight it. Change drawmode at runtime.
>>
>> I don't like the idea of hiding a bug if it
>> ~is~ a bug. I'd prefer to work round it by manually resetting the
>> value to 10 when necessary.
>>
>
>
>Well, if it ~is~ a bug, then it's a bug that is certainly going to go
>unfixed. That being the case, it makes more sense to work around it by
>changing drawmode at runtime, rather than manually changing it all the time,
>no?
No. That'd be like placing a spanner on a safety valve because it
won't stay shut. If it were something that stopped the app from
working, then even I would have to contemplate such a Heath Robinson
fix, but it isn't, even though it's exasperating.
MM
I can't see this accidentally changing unless you change another control's
DrawMode, then click on your control in the designer and DrawMode has the
focus in the property grid without you noticing. More plausible is perhaps
some code is changing that. Have you searched your code for DrawMode ?
"MM" <kyli...@yahoo.co.uk> wrote in message
news:jq46o4hk9g72tjhlh...@4ax.com...
>Hi MM,
>
>I can't see this accidentally changing unless you change another control's
>DrawMode, then click on your control in the designer and DrawMode has the
>focus in the property grid without you noticing. More plausible is perhaps
>some code is changing that. Have you searched your code for DrawMode ?
It is absolutely not ANYthing I am doing. I have noticed the change
occur when I have just loaded the app in the IDE and edited a label
slightly, or done something equally as trivial. Something is happening
(that shouldn't) internally. And always the change is FROM 10 TO 13
(it needs to be 10). It never happens that DrawMode changes to a
different number. When it changes it's always to 13, which is the
default value. But most often I can make much more than trivial
changes to the code or GUI and DrawMode faithfully stays at 10. It is
completely random.
Here's the relevant fragment from the .frm:
Begin VB.PictureBox tbFlood <-- NB: tb stands for Toolbar.
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
DrawMode = 10 'Mask Pen
FillStyle = 0 'Solid
ForeColor = &H00800000&
Height = 255
HelpContextID = 310
Left = 6540
ScaleHeight = 195
ScaleWidth = 3555
TabIndex = 31
Top = 30
WhatsThisHelpID = 310
Width = 3615
End
Despite that explicit setting to 10 above, it sometimes ends up at 13,
I notice the difference immediately the app next runs, I stop it,
change it back to 10 and carry on.
(I also checked to see that there is no other place that DrawMode is
getting set programmatically.)
MM