From: Family Tree Mike on
Loren Pechtel wrote:
> On Wed, 04 Nov 2009 12:30:56 -0800, Peter Duniho
> <no.peted.spam(a)no.nwlink.spam.com> wrote:
>
>> Loren Pechtel wrote:
>>> I agree it sounds exactly like fractional coordinates. How do you
>>> draw on fractional coordinates with integer variables, though? [...]
>> By drawing in an environment where coordinates given as integers are
>> scaling somehow.
>>
>> I posted a code example that shows that in general, the problem you
>> describe does not occur. Either your own code does something different,
>> or you are simply not observing the results correctly (i.e. you think
>> there's a problem when there's not).
>>
>> In the latter case, obviously there's nothing to fix. In the former
>> case, until you post a concise-but-complete code example that reliably
>> demonstrates the issue, there's no way to tell you how to fix your code.
>
> I managed to reproduce it very easily:
>
> A form containing a panel that contains a picture box. Drawing:
>
> Bitmap Image = new Bitmap(Box.ClientSize.Width
> ,Box.ClientSize.Height);
> Pen Ink = new Pen(Color.Black, -1);
> using (Graphics Paper = Graphics.FromImage(Image))
> {
> Paper.Clear(Color.LightGray);
> for (int x = 2; x < Image.Width / 2; x += 2)
> Paper.DrawLine(Ink, x, 0, x, Image.Height - 1);
> for (int y = 2; y < Image.Height; y += 2)
> Paper.DrawLine(Ink, Image.Width / 2, y, Image.Width -
> 1, y);
> }
> Box.Image = Image;
>
> Obviously the panel in this case is useless but I simply copied the
> layout from the main code--in the main code there are some controls
> off to the side and I use the panel to make the picture box take up
> the whole form.
>
> This code *SHOULD* draw one half of the screen with vertical lines and
> one half with horizontal. I'm getting a gray mass on the left and the
> expected behavior on the right.

For what it is worth, I see what you say it *SHOULD* draw when I execute
your routine.

--
Mike
From: Loren Pechtel on
On Wed, 04 Nov 2009 20:40:56 -0500, Family Tree Mike
<FamilyTreeMike(a)ThisOldHouse.com> wrote:

>Loren Pechtel wrote:
>> On Wed, 04 Nov 2009 12:30:56 -0800, Peter Duniho
>> <no.peted.spam(a)no.nwlink.spam.com> wrote:
>>
>>> Loren Pechtel wrote:
>>>> I agree it sounds exactly like fractional coordinates. How do you
>>>> draw on fractional coordinates with integer variables, though? [...]
>>> By drawing in an environment where coordinates given as integers are
>>> scaling somehow.
>>>
>>> I posted a code example that shows that in general, the problem you
>>> describe does not occur. Either your own code does something different,
>>> or you are simply not observing the results correctly (i.e. you think
>>> there's a problem when there's not).
>>>
>>> In the latter case, obviously there's nothing to fix. In the former
>>> case, until you post a concise-but-complete code example that reliably
>>> demonstrates the issue, there's no way to tell you how to fix your code.
>>
>> I managed to reproduce it very easily:
>>
>> A form containing a panel that contains a picture box. Drawing:
>>
>> Bitmap Image = new Bitmap(Box.ClientSize.Width
>> ,Box.ClientSize.Height);
>> Pen Ink = new Pen(Color.Black, -1);
>> using (Graphics Paper = Graphics.FromImage(Image))
>> {
>> Paper.Clear(Color.LightGray);
>> for (int x = 2; x < Image.Width / 2; x += 2)
>> Paper.DrawLine(Ink, x, 0, x, Image.Height - 1);
>> for (int y = 2; y < Image.Height; y += 2)
>> Paper.DrawLine(Ink, Image.Width / 2, y, Image.Width -
>> 1, y);
>> }
>> Box.Image = Image;
>>
>> Obviously the panel in this case is useless but I simply copied the
>> layout from the main code--in the main code there are some controls
>> off to the side and I use the panel to make the picture box take up
>> the whole form.
>>
>> This code *SHOULD* draw one half of the screen with vertical lines and
>> one half with horizontal. I'm getting a gray mass on the left and the
>> expected behavior on the right.
>
>For what it is worth, I see what you say it *SHOULD* draw when I execute
>your routine.

What in the world is the difference then? How do I get it to draw
what you're seeing?
From: Family Tree Mike on
Loren Pechtel wrote:
> On Wed, 04 Nov 2009 20:40:56 -0500, Family Tree Mike
> <FamilyTreeMike(a)ThisOldHouse.com> wrote:
>
>> Loren Pechtel wrote:
>>> On Wed, 04 Nov 2009 12:30:56 -0800, Peter Duniho
>>> <no.peted.spam(a)no.nwlink.spam.com> wrote:
>>>

<snip>

>>>
>>> This code *SHOULD* draw one half of the screen with vertical lines and
>>> one half with horizontal. I'm getting a gray mass on the left and the
>>> expected behavior on the right.
>> For what it is worth, I see what you say it *SHOULD* draw when I execute
>> your routine.
>
> What in the world is the difference then? How do I get it to draw
> what you're seeing?

I suspect screen settings. When I set my display settings really
poorly, then I see what you observe. My normal settings are 1680x1050
32 bit color.

--
Mike
From: Peter Duniho on
Loren Pechtel wrote:
> What in the world is the difference then? How do I get it to draw
> what you're seeing?

You've yet to establish it's _not_ drawing what Mike is seeing.

Visual inspection isn't good enough. Just because you've drawn a bitmap
a certain way, that's no guarantee it will be presented on the screen
that way.

Pete
From: Peter Duniho on
Loren Pechtel wrote:
> There should be no scaling in my case [...]

So you say. But until you post a concise-but-complete code example,
it's not possible to know for sure there's not. If I had a nickel for
every time someone asked a question, 100% certain that their description
of the situation was accurate, only to find it out wasn't...

And even if we establish there's no scaling in the _drawing_ of the
bitmap, there's still some possibility you've got some non-standard
system configuration that is meddling with the display on-screen.

Pete
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: URGENT
Next: DataRow InsertAt Database