Click here to Skip to main content
15,894,291 members

Comments by hanymet (Top 5 by date)

hanymet 6-May-21 10:02am View    
I have change my code:

private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
current = e.Location;
g.DrawLine(p, old, current);
old = current;
}
}

with your answer:

private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
using (Graphics g = Graphics.FromImage(pictureBox1.Image))
{
g.DrawLine(p, old, current);
}
pictureBox1.Invalidate();
}
}

and when draw by mouse, it gives me this error:

System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: image
Source=System.Drawing
StackTrace:
at System.Drawing.Graphics.FromImage(Image image)
at WindowsFormsApp1_Paint_Temp.Form3.PictureBox1_MouseMove(Object sender, MouseEventArgs e) in C:\Users\HRS7_PC\source\repos\WindowsFormsApp1_Paint_Temp\WindowsFormsApp1_Paint_Temp\Form3.cs:line 56
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApp1_Paint_Temp.Program.Main() in C:\Users\HRS7_PC\source\repos\WindowsFormsApp1_Paint_Temp\WindowsFormsApp1_Paint_Temp\Program.cs:line 19
hanymet 1-Dec-20 18:43pm View    
I have found the missing part, That I should host my asp.net web to iis first, So by deploy and host web to iis, the app works well.
Thank you Richard
hanymet 1-Dec-20 11:59am View    
By change localhost with my local ip (in android mode) the app is works without loading data...
also i try with pc name and the same result (app works without loading data)
But in uwp mode the error still the same.
what i have missed
hanymet 22-Jul-20 22:50pm View    
can you guide me to a simple Bluetooth sample, Just send and receive text.
hanymet 29-Jan-20 8:44am View    
I drag and drop the user control ,
I have expose event handler for user control and try to add the tabpage in the tabcontrol result is OK :

// this is my code in user control
public event EventHandler UCButtonClick;

private void button1_Click_1(object sender, EventArgs e)
{
if (UCButtonClick != null)
UCButtonClick(sender, e);
}

// my code at the form
private void userControl11_UCButtonClick(object sender, EventArgs e)
{
TabPage tb = new TabPage("test1");
tabControl1.TabPages.Add(tb);
}

But the problem is from the code of loading customers as you can see, it load every customer in new user control(Not drag and drop user control), So how can i link the click event handler to every user control to open the customer details in new tabpage.