help with Pen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KVV

    #1

    help with Pen

    Hello, All!

    SolidBrush brush = new SolidBrush(Syst emColors.Contro l);
    e.Graphics.Fill Rectangle(brush ,Rect);
    Why this code draw
    and this

    Pen pen = new Pen(brush,drawW idth);
    pen.Alignment = PenAlignment.In set;
    e.Graphics.Draw Rectangle(pen,R ect);
    draw ?(take a look on small rose pixels)

    How to get picture1 using pen?

    With best regards, KVV. E-mail: kvv_vlad@ua.fm
  • Morten Wennevik

    #2
    Re: help with Pen

    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.

    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

    Comment

    • KVV

      #3
      Re: help with Pen

      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(Syst emColors.Contro l);
      Rect.Width = 10; Rect.Hight=10;
      e.Graphics.Fill Rectangle(brush ,Rect);

      2.
      SolidBrush brush = new SolidBrush(Syst emColors.Contro l);
      Rect.Width = 10; Rect.Hight=10;
      Pen pen = new Pen(brush,5);
      pen.Alignment = PenAlignment.In set;
      e.Graphics.Draw Rectangle(pen,R ect);

      With best regards, KVV. E-mail: kvv_vlad@ua.fm


      Comment

      • Morten Wennevik

        #4
        Re: help with Pen

        Well, considering that Penaligment.Ins et 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?

        --
        Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

        Comment

        • KVV

          #5
          Re: help with Pen

          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: kvv_vlad@ua.fm


          Comment

          • Morten Wennevik

            #6
            Re: help with Pen

            Why can't you just use the brush and fillrectangle?

            --
            Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

            Comment

            • KVV

              #7
              Re: help with Pen

              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: kvv_vlad@ua.fm


              Comment

              • Morten Wennevik

                #8
                Re: help with Pen

                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

                --
                Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

                Comment

                Working...