Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DrawMode changes itself from 10 to 13 !!! Driving me bananas

2 views
Skip to first unread message

MM

unread,
Jan 30, 2009, 9:52:51 AM1/30/09
to
I asked this back in March, but received no response. I have a
PictureBox with DrawMode set to 10. Every so often when working in the
IDE I notice that DrawMode has changed to 13 without ANY intervention
from me! It never happens in the compiled version. When it changes and
I next run the app (in the IDE) I notice immediately, abort the test,
change DrawMode back to 10 and everything's hunky dory again. Until
the next time it happens (which seems to be completely random).

This surely must be a bug, yes?

MM

Larry Serflaten

unread,
Jan 30, 2009, 10:18:27 AM1/30/09
to

"MM" <kyli...@yahoo.co.uk> wrote

Are changing it in code, or in the IDE?


LFS


Ken Halter

unread,
Jan 30, 2009, 11:17:25 AM1/30/09
to
"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.
'=====
Option Explicit

Private Sub Form_Load()
Picture1.DrawMode = vbNotXorPen
End Sub

Private Sub Picture1_Click()
Debug.Print Picture1.DrawMode 'shows 10
End Sub
'=====


MM

unread,
Jan 30, 2009, 12:30:05 PM1/30/09
to

IDE.

MM

MM

unread,
Jan 30, 2009, 12:36:57 PM1/30/09
to
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.

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

expvb

unread,
Jan 30, 2009, 12:46:04 PM1/30/09
to
"MM" <kyli...@yahoo.co.uk> wrote in message
news:s9e6o4tr0sc9neq67...@4ax.com...

> 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.

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.


Rick Raisley

unread,
Jan 30, 2009, 3:42:52 PM1/30/09
to
"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?

--
Regards,

Rick Raisley
heavymetal-A-T-bellsouth-D-O-T-net


MM

unread,
Jan 31, 2009, 5:07:47 AM1/31/09
to
On Fri, 30 Jan 2009 15:42:52 -0500, "Rick Raisley"
<heavymetal-A-T-bellsouth-D-O-Tnet> wrote:

>"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

Bill McCarthy

unread,
Feb 1, 2009, 8:36:00 PM2/1/09
to
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 ?

"MM" <kyli...@yahoo.co.uk> wrote in message
news:jq46o4hk9g72tjhlh...@4ax.com...

MM

unread,
Feb 2, 2009, 5:05:22 AM2/2/09
to
On Mon, 2 Feb 2009 12:36:00 +1100, "Bill McCarthy" <TPASoft.com Are
Identity Thieves> wrote:

>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

0 new messages