help with Pen

  • Thread starter Thread starter KVV
  • Start date Start date
K

KVV

Hello, All!

SolidBrush brush = new SolidBrush(SystemColors.Control);
e.Graphics.FillRectangle(brush,Rect);
Why this code draw
and this

Pen pen = new Pen(brush,drawWidth);
pen.Alignment = PenAlignment.Inset;
e.Graphics.DrawRectangle(pen,Rect);
draw ?(take a look on small rose pixels)

How to get picture1 using pen?

With best regards, KVV. E-mail: (e-mail address removed)
 
First, please use only simple text when posting on usenet.
I am unable to see your images, but FillRectanle and DrawRectangle are two
different methods, one draws a rectangle and fills it using the specified
brush, the other draws only the rectangle using the specified Pen to
determine how the lines should look.
 
Hello, Morten!
You wrote on Thu, 27 Nov 2003 14:16:12 +0100:

MW> First, please use only simple text when posting on usenet.
MW> I am unable to see your images, but FillRectanle and DrawRectangle are
MW> two different methods, one draws a rectangle and fills it using the
MW> specified brush, the other draws only the rectangle using the specified
MW> Pen to determine how the lines should look.

In my case these two methods do same things, but draw different pictures.
These two fragments do, imho, same things, but draw Rectangles with
different colors:

1.
SolidBrush brush = new SolidBrush(SystemColors.Control);
Rect.Width = 10; Rect.Hight=10;
e.Graphics.FillRectangle(brush,Rect);

2.
SolidBrush brush = new SolidBrush(SystemColors.Control);
Rect.Width = 10; Rect.Hight=10;
Pen pen = new Pen(brush,5);
pen.Alignment = PenAlignment.Inset;
e.Graphics.DrawRectangle(pen,Rect);

With best regards, KVV. E-mail: (e-mail address removed)
 
Well, considering that Penaligment.Inset forces the line, of width 5, to
be drawn "inside" of the coordinates the effect is indeed a 10x10
rectangle (actually, it's a 10x5 rectangle x 4).
The effect is probably from drawing ontop of the last part of the last
line when drawing the next line. Not sure why this should change any
color.
Change the drawrectangle to two drawlines instead?
 
Hello, Morten!
You wrote on Thu, 27 Nov 2003 15:08:10 +0100:

MW> Change the drawrectangle to two drawlines instead?

Same effect.
Help me, please.


With best regards, KVV. E-mail: (e-mail address removed)
 
Hello, Morten!
You wrote on Thu, 27 Nov 2003 15:29:39 +0100:

MW> Why can't you just use the brush and fillrectangle?
I wany draw only border on control and not fill all control.

With best regards, KVV. E-mail: (e-mail address removed)
 
Maybe the brush causes some interpolation pattern when drawn 90 degrees on
itself. That shouldn't happen if you use two lines though.

Sorry, I'm all out of ideas. Try the .Drawing group
 
Back
Top