VB2013 was able to invoke Form2 class functions (subs) from Form1 class.

Asked 2 years ago, Updated 2 years ago, 138 views

VB2013 was able to invoke a function (Sub) of the Form2 class from the Form1 class.
However, the drawing in Form2 described in the function does not occur.

To summarize the flow (1~2)
①In Form1:

 Dim f2 as New Form 2
f2. The function describing the drawing ( )

<Form2, in the function ( ) describing the drawing:

Dimage As New Bitmap (picturebox1.Width,......
Dimage_g As Graphics= Graphics.FromImage(image)

image_g.DrawLine, FillElipse...

For some reason, only the drawing inside の doesn't work.
timer.tick in Form2 draws normally, but only when calling a function.

Why is that?
I look forward to your prompt reply
Do not draw when explicitly activated...Console.WriteLine appears.

I tried to display two screens (Form1,Form2), one for checking (numerical) and the other for drawing...

Supplemental and Modify Form1Form2Button starts the program manually and
→ Obtain numerical data from the Module self-made Timer→To Module numerical calculation
→ Perform calculation operation from Sub function in Module numerical calculation →After that, we arrive at the Subdrawing function and from here we call the drawing function of Form2.
It was......
In other words, the drawing function of Form2 is called from Module.
The problem was that the file was printed but not displayed in PictureBox etc....

Furthermore, when f2.Form2.ActivateForm() at Load of Form2, the drawing function of Form2 is called, and then the drawing function in Form2 stops at .

visual-studio vb.net

2022-09-30 20:49

1 Answers

dim f2 as new form 2
f2. The function describing the drawing ( )

So, when do you plan to display f2? If you are running new form 2 in another place and viewing it, the drawing for f2 will not be reflected in another instance because the instances are different.


2022-09-30 20:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.