Create a cust usercontrol project, insert the following codes to that calass. This is only a very simple example to make you go ahead.-----------------------------------------------public override void OnPaint(PaintEventArgs e)
{
 Pen p = new Pen(Color.Blue);p.StartCap = System.Drawing.Drawing2D.LineCap.Square; 
p.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; 
p.Width = 5; 
e.Graphics.DrawLine(p,100,100,340,240);}
■■■■■ To teach a fish how to swim. ■■■■■

解决方案 »

  1.   

    http://chs.gotdotnet.com/quickstart/aspplus/doc/quickstart.aspx
      

  2.   

    thanks a lot
    I'am trying
      

  3.   

    well ! TheAres thanks for your help 
    I test the code but it does not what I want
    The above code draw a fix arrow line in the rectangle but what I want is :the whole control is just a arrow line I can change it's direction
    by set it's start and end point  property
      

  4.   

    Well, just like what I said, the previous one is only used to make you start. There is no problem to change the property of the user control, the following is the next stop.
    --------------------------------------------
    1. Define 2 private variables:
    private Point _start;
    private Point _endPoint;2. Give the default value for the two variables in the constructor of the class user control_startPoint = new Point(1,1);
    _endPoint = new Point(100,100);3.Define a property of the class.
      public Point StartPoint
      {
       set
       {
        _startPoint = value;
       }
       get
       {
        return _startPoint;
       }
      }4. change the line "e.Graphics.DrawLine(p,100,100,340,240);" to "
    e.Graphics.DrawLine(p,_startPoint,_endPoint);"5. Build you control again. 6. Then you can change the StartPoint property from the "property  window" now. If you want to change other property, such as end pont,color, you can go ahead form here by yourself.Any problem or comments, please feel free to let me know.■■■■■ To teach a fish how to swim. ■■■■■
      

  5.   

    :D
    congratulations on your promotion and I'am very appreciate for your helpI'am very sorry that I'am not make myself very clear My problems is 1.I want my control's shape to be an arrow line not a rectangle 
    (I have no idea about this point!)2.I need some hot point on the line's inflexion when user click it
    by mouse the control can show the hot point so User can adjust it to a curve by mouse Am I clear now ?!
      

  6.   

    oh !
     TheAres:
    I'll try very means to take it ,I'll send my solutions to u 
    :D and take u a fresh fish 
      

  7.   

    Thands and you are welcome!I try to explain your two question.For the first one, please try to  change the"p.Width = 5;" to "p.Width = 1;".  That's it.For the seond one, The "System.Drawing.Drawing2D.LineCap" is for reference. If you don't get what you want from here. You may need to write a small circle here. For the adjusting according to the mouse moving, you  could write some code on the event "MouseMove, MouseDown, Mouseup". the following is a example.private void UserControl1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this._endPoint = new Point(e.X,e.Y);
    this.Refresh();}■■■■■ To teach a fish how to swim. ■■■■■
      

  8.   

    wonderful !
    actually  I do the the same Project as u  did 
    could u give me some good opinions about your UserControl 
    It is my grestest honor to learn more about from u