2
Answers

Drawing a line into a picture box

Shay Wilner

Shay Wilner

14y
6.9k
1

Hello every body
I 'm new in vb.net  I tried to write a little app drawing a line into a picture box and
show it
here the code
Public
Class Form1
Private Sub draws()
Dim mypen As Pen
Dim gr As System.Drawing.Graphics
gr = panel2.CreateGraphics
mypen =
New Pen(Color.Chocolate, 3)
gr.DrawLine(mypen, 20, 20, 700, 700)
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DisplayPanel()
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
draws()
End Sub

Private Sub DisplayPanel()
Me.Panel2.BackgroundImage = Image.FromFile("E:\drawnet\Draw\Draw\bin\Debug\lcws\board.bmp")
Me.Panel2.Width = Me.Panel2.BackgroundImage.Width
Me.Panel2.Height = Me.Panel2.BackgroundImage.Height
Me.Panel2.Left = Me.Width / 2 - Me.Panel2.Width / 2
Me.Panel2.Top = Me.Height / 2 - Me.Panel2.Height / 2
End Sub

End
Class
panel2 is the name of  the picture box.
When i run the app i didn't see the line  but only if i create an event like mouse click etc. why?
thanks for explanation
Answers (2)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

In this case you have to implement security logic, the .Net provides an entire API  System.Security, you can create a permission set that determines rule of messages transactions 
0
Riccardo
NA 5 0 16y
I mean every outgoing mail of a company (mail from a internal network to outside the network)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

What do you mean by outgoing mail, do you mean from example a spam?
0
Riccardo
NA 5 0 16y
Thank you very much for your answer!

Probably I should explain a little bit more about the functionality I would like to implement. Basicaly I would like to check every outgoing mail. Therefore I would like to
1. stop the smtp queue
2. wait for messages
3.check these messages (allowed or unallowed and probably remove some of them)
4. Start the smtp queue, so the messages can be send


0
Bechir Bejaoui
NA 20.1k 5.3m 16y

If I well understand your question you're using a Message queue object then you can do

MessageQueue mqueue = new MessageQueue();
            //This method will make the message queue in a standby state for any message
            IAsyncResult Async = mqueue.BeginReceive();

            //TO do perform you code here

            //This method
            Message Recived = mqueue.EndReceive(Async);
           
            //close the message queue
            mqueue.Close();
It's better to do that asynchormously