473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 1241
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: DraguVaso | last post by:
Hi, I have my custom Inherited DataGrid. I override the OnPaint-event to speed up things and avoid flikkering using Double Buffering. To draw the normal things of the DataGrid I have to call the...
11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
1
by: weixiang | last post by:
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...
4
by: | last post by:
Please, help. I created my contol, ButtonX, which subclasses System.Forms.Windows.Button class. I am doing my own paiting, by overriding OnPaint and OnPaintBackground (without calling base...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
3
by: Colin McGuire | last post by:
Hi, I am just learning "how-to" by reading some of the existing article solutions in this newsgroup. I happened to come across this one. Tom Spink knows what he is talking about and I am wondering...
4
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
14
by: raylopez99 | last post by:
KeyDown won't work KeyPress fails KeyDown not seen inspired by a poster here:http://tinyurl.com/62d97l I found some interesting stuff, which I reproduce below for newbies like me. The main...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.