Re: Problem with vista and form appearance
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Dec 2009 14:25:53 -0000
"peter smith" <qqpixe@xxxxxxxxxxxxxx> wrote in message news:608dba46-ed27-4371-a61d-82b764da5c41@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
picture1.line (0,195)-(195,0)
.. . . another thing I also forgot to mention Peter is about the line lengths (although it is just a side note really in terms of your specific probem). When drawing single pixel thickness lines (the default thickness) then the final pixel of the line is not actually plotted. This applies both when drawing using the native VB Line method and when drawing using the alternative API (GDI) LineTo method. It is the standard behaviour in Windows. So, in the case of a 200 x 200 pixel PictureBox with a standard border the actual drawing area is 196 x 196 pixels (for the reasons described in my previous responses) and those pixels are numbered 0 to 195, with the top right coordinate of course being coordinate (195, 0). Therefore when you draw your (0, 195) - (195, 0) line the very last pixel of that line, pixel (195, 0) will not actually be plotted, with the result that the diagonal line does not quite extend fully to the top right corner of the drawing area. The first pixel of the line is always plotted, but the last pixel is not, although the "current pixel position" /does/ actually move to the final unplotted pixel position (as you will see if you use Picture1.CurrentX and Picture1.CurrentY to examine the current coordinate after drawing the line). This is not easy to see normally, but if you press the PrintScreen key on your keyboard to copy the screen to the clipboard and then open MS Paint and use use Edit / Paste and then use the MS Paint View / Zoom / Custom to set the view to 400 or 800 per cent you will clearly see the missing pixel.
Again this behaviour is by design, and one of the reasons for it is so that continuous lines which are drawn by repeatedly using the Line method to draw from the end of the previous line to some new position, etc, etc all get drawn properly. (The same reasoning applies to lines drawn using the API (GDI) PolyLine method which draws connected line segments). The rationale behind it is to prevent the last pixel of each line segment being plotted twice, once as the last pixel of the first line segment and once again as the first pixel of the following line segment. This "double plotting" of a specific pixel at the join of each line segment (if it were allowed to happen) would not be a problem when drawing with the standard DrawMode (vbCopyPen) but it would definitely be a problem for some other DrawModes, such as vbInvert or vbXorPen (drawing modes which are common for many tasks) because in such cases the "double plotting" of a pixel would return it back to the condition it was in before the drawing took place, causing little "holes" to appear in the otherwise continuous full line that was drawn with multiple Line methods or with the API PolyLine method or whatever.
Anyway, I just though I would mention this in case you examine the output of your new code in detail (after you have taken account of the stuff I said in my previous responses) and if you begin to wonder why the final pixel of your diagonal line has not been plotted. In order to draw the line fully you need to take the "last pixel of a line is not plotted" business into account, and draw your line accordingly.
Mike
.
- References:
- Problem with vista and form appearance
- From: peter smith
- Re: Problem with vista and form appearance
- From: Dee Earley
- Re: Problem with vista and form appearance
- From: peter smith
- Problem with vista and form appearance
- Prev by Date: Re: Quick Find in List view
- Next by Date: Re: Datagrid and rows
- Previous by thread: Re: Problem with vista and form appearance
- Next by thread: Re: Problem with vista and form appearance
- Index(es):
Relevant Pages
|