C Click the Form A button to draw a straight line on Form B

Updated on technology 2024-04-05
17 answers
  1. Anonymous users2024-02-07

    form1**:

    using system;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    namespace windowsformsapplication1public partial class form1 : formpublic form1()

    initializecomponent();

    private void button1_click(object sender, eventargs e)

    int startx =

    int starty =

    int endx =

    int endy =

    form2 f2 = new form2();

    starty, endx, endy);

    form2**:

    using system;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    namespace windowsformsapplication1public partial class form2 : formpublic form2()

    initializecomponent();

    int sx; int sy; int ex; int ey;

    public void get(int startx, int starty, int endx, int endy)

    Get the data of form1, sx = startx;

    sy = starty;

    ex = endx;

    ey = endy;

    private void picturebox1_mousemove(object sender, mouseeventargs e)

    Hover the mouse over the picturebox to display the picture.

    graphics g;

    pen p = new pen(, 2);

    g = ; sx, sy, ex, ey);

  2. Anonymous users2024-02-06

    This one you're talking about is called the owner

    var b = new formb();

    this (this is forma).

    After that, you can manipulate the forma and the formb will always be on top of the forma and will not block your operation, but the formb will be manipulated in the same way when the forma is closed or minimized

  3. Anonymous users2024-02-05

    There are two ways to open a form, one is showdialog (modal window) and the other is show (unmodal window), so you can use show.

  4. Anonymous users2024-02-04

    Add a form member to b.

    public form frmwina=null;

    A value is then assigned before reality b.

    So that there is a reference to window A in window B, and finally write in B's closing response that "but when B is closed"; Can.

  5. Anonymous users2024-02-03

    Write directly in the form closing time of form b; Turn it all off.

  6. Anonymous users2024-02-02

    1. Open B from A in modal mode, and then B returns a modal result, such as OK, and A can refresh it after receiving this result!

    A button event!

    form2 f2 = new form2();

    dialogresult dr= ;

    if (dr ==

    elseb's button event:;;

  7. Anonymous users2024-02-01

    It's simple.

    Write the ** of the button directly, but you need an object of a form, and then it is =

  8. Anonymous users2024-01-31

    Define an event in Form A, then Form B subscribes to the event, and then triggers the event when you click the button in Form A.

  9. Anonymous users2024-01-30

    You check the parameters of the load method, and track to see if the path or something is correct.

  10. Anonymous users2024-01-29

    You can call the C event directly in the A button and change Sander to the C button. Type oak.

    But if you want to call C's Bi Rent Circle event, A must be able to refer to the B object...

    You can store a reference to a in a...

    The landlord can consider taking a look at the ** mode in the design pattern...

  11. Anonymous users2024-01-28

    Make the click event in b static and public.

    a.

  12. Anonymous users2024-01-27

    Although there is a way to achieve the effect you want, it is best not to write ** in Form A using the click event of the button control of Form B, which does not conform to the characteristics of object-oriented encapsulation.

  13. Anonymous users2024-01-26

    First instantiate the B form in the A form, and then call it, I don't know if you want to make the click event in B static and public.

    You give it a try.

  14. Anonymous users2024-01-25

    Hello! Not compliant with object-oriented encapsulation, but in a form.

    Write the click event using the button control of the b-form ** Although there are ways to achieve the effect you want, it's best not to do it.

  15. Anonymous users2024-01-24

    Suppose there are two forms, form1 and form2, there is button A on form1 and button B on form2, and the following ** is written in the click event of A

    form2 f2=new form2();

    In the click event of b, write the following **:

    form1 f1=new form1();

  16. Anonymous users2024-01-23

    I don't know what you're in, but you can use these two forms as sub-forms.

  17. Anonymous users2024-01-22

    Write in a:

    b frm=new b();

    If a is the main form, it cannot be closed, but can only be hidden.

    Handful; Changed to:

Related questions
4 answers2024-04-05

Your form2 constructor should be overloaded once: it should pass the textbox as an argument and it becomes: >>>More

19 answers2024-04-05

Write in the click of button1; Then write using system in the main function; >>>More

9 answers2024-04-05

GDI is like this, you can use any of the following methods I provide to alleviate this problem. 1. Before drawing this circle, draw a blue circle with a slightly lighter color, with a radius larger than your circle, so as to achieve the effect of blurring the edges, and add more circles (but the more the circle drawn before must have a slightly larger radius than the radius of the circle behind, and the color is slightly lighter), the better the effect. 2. Using WPF, this is not GDI but based on DX, which is more exquisite. >>>More

22 answers2024-04-05

Register the keypress event for this textbox.

new ; >>>More

12 answers2024-04-05

There's a function. There is a sqrt function below, for example, if you want to open a square of 4, you can use it; >>>More