471,089 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

OnPaint() works differently between 2K and XP?

Hi,

I wrote a progam, which pop up a form that with OnPaint() overrided. It
works great in XP but bad in 2K. In 2K, most of the form content will not
be displayed until I drag the form a little. And I set a breakpoint to the
OnPaint... The breakpoint was hit when the form popuped... But if I shrink
the VS.NET to make it can't overlap with the popup form, the form content is
still not displayed after the OnPaint() returned. If I move the form a
little, the content will be displayed all right even without the former
breakpoint reached.

I tried that in both .NET framework 1.1 and 1.0.

Is that a bug of .NET framework in Windows 2K? How can I avoid this
problem?

Thank you very much,
Wei Xiang
Nov 15 '05 #1
5 1174
Wei,

Can you show the code in the OnPaint method? It is possible that there
could be a bug, but XP is just an extension of the W2K codebase, so I don't
see any reason why you should have this kind of problem.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"weixiang" <we******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I wrote a progam, which pop up a form that with OnPaint() overrided. It
works great in XP but bad in 2K. In 2K, most of the form content will not
be displayed until I drag the form a little. And I set a breakpoint to the OnPaint... The breakpoint was hit when the form popuped... But if I shrink the VS.NET to make it can't overlap with the popup form, the form content is still not displayed after the OnPaint() returned. If I move the form a
little, the content will be displayed all right even without the former
breakpoint reached.

I tried that in both .NET framework 1.1 and 1.0.

Is that a bug of .NET framework in Windows 2K? How can I avoid this
problem?

Thank you very much,
Wei Xiang

Nov 15 '05 #2
My code is quite simple:

protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
int i, j;
for (i=0; i<rowCount; i++)
{
for (j=0; j<colCount; j++)
{
int id = j*rowCount + i;
if (id < imageListSmallPic.Images.Count)
g.DrawImageUnscaled(imageListSmallPic.Images[id], i*iconWidth,
j*iconHeight);
}
}
}

I don't know whether it can be different in 2K. Firstly the imageList is
24bit. And I tried to set it to 8 bit, but solve nothing.

I have the SP4 installed in 2K, also the newest patches.

Thank you very much
Wei Xiang
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eC**************@TK2MSFTNGP09.phx.gbl...
Wei,

Can you show the code in the OnPaint method? It is possible that there could be a bug, but XP is just an extension of the W2K codebase, so I don't see any reason why you should have this kind of problem.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"weixiang" <we******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I wrote a progam, which pop up a form that with OnPaint() overrided. It
works great in XP but bad in 2K. In 2K, most of the form content will not be displayed until I drag the form a little. And I set a breakpoint to the
OnPaint... The breakpoint was hit when the form popuped... But if I

shrink
the VS.NET to make it can't overlap with the popup form, the form

content is
still not displayed after the OnPaint() returned. If I move the form a
little, the content will be displayed all right even without the former
breakpoint reached.

I tried that in both .NET framework 1.1 and 1.0.

Is that a bug of .NET framework in Windows 2K? How can I avoid this
problem?

Thank you very much,
Wei Xiang


Nov 15 '05 #3
Wei,

The bit level of the images sounds like it could be part of the problem.
How are you converting the 24 bit images to 8 bit? I don't think 2000
supports 24 bit images (for example, when I try and render the icons from XP
in 2000, it fails).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"weixiang" <we******@yahoo.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
My code is quite simple:

protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
int i, j;
for (i=0; i<rowCount; i++)
{
for (j=0; j<colCount; j++)
{
int id = j*rowCount + i;
if (id < imageListSmallPic.Images.Count)
g.DrawImageUnscaled(imageListSmallPic.Images[id], i*iconWidth,
j*iconHeight);
}
}
}

I don't know whether it can be different in 2K. Firstly the imageList is
24bit. And I tried to set it to 8 bit, but solve nothing.

I have the SP4 installed in 2K, also the newest patches.

Thank you very much
Wei Xiang
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:eC**************@TK2MSFTNGP09.phx.gbl...
Wei,

Can you show the code in the OnPaint method? It is possible that

there
could be a bug, but XP is just an extension of the W2K codebase, so I

don't
see any reason why you should have this kind of problem.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"weixiang" <we******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I wrote a progam, which pop up a form that with OnPaint() overrided. It works great in XP but bad in 2K. In 2K, most of the form content will not be displayed until I drag the form a little. And I set a breakpoint to
the
OnPaint... The breakpoint was hit when the form popuped... But if I

shrink
the VS.NET to make it can't overlap with the popup form, the form

content
is
still not displayed after the OnPaint() returned. If I move the form

a little, the content will be displayed all right even without the former breakpoint reached.

I tried that in both .NET framework 1.1 and 1.0.

Is that a bug of .NET framework in Windows 2K? How can I avoid this
problem?

Thank you very much,
Wei Xiang



Nov 15 '05 #4
I set the color depth to 8 bit by call imageList.ColorDepth =
ColorDepth.Depth8Bit before add icons to it.

And, as I said, the form will be shown correctly when I move that a little,
without the OnPaint() called...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ui**************@TK2MSFTNGP12.phx.gbl...
Wei,

The bit level of the images sounds like it could be part of the problem. How are you converting the 24 bit images to 8 bit? I don't think 2000
supports 24 bit images (for example, when I try and render the icons from XP in 2000, it fails).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"weixiang" <we******@yahoo.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
My code is quite simple:

protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
int i, j;
for (i=0; i<rowCount; i++)
{
for (j=0; j<colCount; j++)
{
int id = j*rowCount + i;
if (id < imageListSmallPic.Images.Count)
g.DrawImageUnscaled(imageListSmallPic.Images[id], i*iconWidth,
j*iconHeight);
}
}
}

I don't know whether it can be different in 2K. Firstly the imageList is
24bit. And I tried to set it to 8 bit, but solve nothing.

I have the SP4 installed in 2K, also the newest patches.

Thank you very much
Wei Xiang
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eC**************@TK2MSFTNGP09.phx.gbl...
Wei,

Can you show the code in the OnPaint method? It is possible that

there
could be a bug, but XP is just an extension of the W2K codebase, so I

don't
see any reason why you should have this kind of problem.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"weixiang" <we******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I wrote a progam, which pop up a form that with OnPaint() overrided. It > works great in XP but bad in 2K. In 2K, most of the form content will not
> be displayed until I drag the form a little. And I set a breakpoint to the
> OnPaint... The breakpoint was hit when the form popuped... But if
I shrink
> the VS.NET to make it can't overlap with the popup form, the form

content
is
> still not displayed after the OnPaint() returned. If I move the

form a > little, the content will be displayed all right even without the former > breakpoint reached.
>
> I tried that in both .NET framework 1.1 and 1.0.
>
> Is that a bug of .NET framework in Windows 2K? How can I avoid this
> problem?
>
> Thank you very much,
> Wei Xiang
>
>



Nov 15 '05 #5
I wrote a tiny test program, which can be downloaded from
http://weixiang.nease.net/data/TestOnPaint.rar

It seems the ImageList draw has problem. If I call graphics.FillRectangle
in OnPaint() method, it can display correctly. But the
graphics.DrawImageUnscaled(imageList,...) could not work well in Win 2K.

"weixiang" <am**@sh163.net> wrote in message
news:e6****************@TK2MSFTNGP11.phx.gbl...
I set the color depth to 8 bit by call imageList.ColorDepth =
ColorDepth.Depth8Bit before add icons to it.

And, as I said, the form will be shown correctly when I move that a little, without the OnPaint() called...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ui**************@TK2MSFTNGP12.phx.gbl...
Wei,

The bit level of the images sounds like it could be part of the problem.
How are you converting the 24 bit images to 8 bit? I don't think 2000
supports 24 bit images (for example, when I try and render the icons from XP
in 2000, it fails).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"weixiang" <we******@yahoo.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
My code is quite simple:

protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
int i, j;
for (i=0; i<rowCount; i++)
{
for (j=0; j<colCount; j++)
{
int id = j*rowCount + i;
if (id < imageListSmallPic.Images.Count)
g.DrawImageUnscaled(imageListSmallPic.Images[id], i*iconWidth,
j*iconHeight);
}
}
}

I don't know whether it can be different in 2K. Firstly the imageList is 24bit. And I tried to set it to 8 bit, but solve nothing.

I have the SP4 installed in 2K, also the newest patches.

Thank you very much
Wei Xiang
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eC**************@TK2MSFTNGP09.phx.gbl...
> Wei,
>
> Can you show the code in the OnPaint method? It is possible
that there
> could be a bug, but XP is just an extension of the W2K codebase, so I don't
> see any reason why you should have this kind of problem.
>
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "weixiang" <we******@yahoo.com> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > I wrote a progam, which pop up a form that with OnPaint() overrided.
It
> > works great in XP but bad in 2K. In 2K, most of the form content will not
> > be displayed until I drag the form a little. And I set a
breakpoint to
> the
> > OnPaint... The breakpoint was hit when the form popuped... But
if I > shrink
> > the VS.NET to make it can't overlap with the popup form, the form
content
> is
> > still not displayed after the OnPaint() returned. If I move the

form
a
> > little, the content will be displayed all right even without the

former
> > breakpoint reached.
> >
> > I tried that in both .NET framework 1.1 and 1.0.
> >
> > Is that a bug of .NET framework in Windows 2K? How can I avoid

this > > problem?
> >
> > Thank you very much,
> > Wei Xiang
> >
> >
>
>



Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by DraguVaso | last post: by
11 posts views Thread by Sagaert Johan | last post: by
3 posts views Thread by Colin McGuire | last post: by
14 posts views Thread by raylopez99 | last post: by

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.