Click here to Skip to main content
15,915,093 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using separate class to handle events of user controls Pin
Heath Stewart23-Dec-04 6:03
protectorHeath Stewart23-Dec-04 6:03 
GeneralRe: Using separate class to handle events of user controls Pin
jomargon24-Dec-04 15:06
jomargon24-Dec-04 15:06 
GeneralRe: Using separate class to handle events of user controls Pin
Heath Stewart27-Dec-04 10:21
protectorHeath Stewart27-Dec-04 10:21 
GeneralAsa Client Pin
sreejith ss nair23-Dec-04 3:34
sreejith ss nair23-Dec-04 3:34 
GeneralRe: Asa Client Pin
Heath Stewart23-Dec-04 5:57
protectorHeath Stewart23-Dec-04 5:57 
GeneralDraw line between pictureboxes Pin
ninja260523-Dec-04 2:18
ninja260523-Dec-04 2:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 5:47
protectorHeath Stewart23-Dec-04 5:47 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 18:37
ninja260523-Dec-04 18:37 
Thanks for the reply Heath. By Tag i mean PicturBox.Tag property. Here is my code, difficult to understand though Smile | :) as there r few commments. Now you might get the clear picture as to what i am trying to achieve. There is drag drop functionality, where i am trying to link images and get their names in a string which i am going to use later. So when i do drag drop i should be able to draw line between images and on the panel.

using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;

namespace medappzDMS.folderList
{
///
/// Summary description for fmlinks.
///

public class fmlinks : System.Windows.Forms.Form
{
private CustomAutoScrollPanel.ScrollablePanel panel1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage thumbnails;
private System.Windows.Forms.TabPage actualsize;
private System.Windows.Forms.PictureBox[] pb;
private System.Windows.Forms.Label[] lbl;
//private System.ComponentModel.IContainer components;
//private System.Drawing.Image _image = null;
private int _margin = 50;
private bool m_MouseIsDown=false;
private bool m_IsDragDrop=true;
//private bool panelmousedown=false;
//private string[] arrfilename;
private string[] arrfileindex1;
private string[] arrfileindex2;

// private char[] charfileindex1;
private string[] filename;
private string[] filename1;
private string locallink=null;

private string linkfrom=null;

private int j=0;

private bool hascolor=false;
private System.Drawing.Image _image = null;
private string pbcolor;
private int x1=0,y1=0,x2=0,y2=0;
Rectangle SelectRect = new Rectangle();
Point ps=new Point();
private System.Windows.Forms.Label lblviewcurlinks;
private System.Windows.Forms.Label lblcurlinks;
Point pe=new Point();
private System.Windows.Forms.ToolTip toolTip1;
private System.ComponentModel.IContainer components;
private string startcoordinates=null;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.NumericUpDown numericUpDown5;
private System.Windows.Forms.NumericUpDown numericUpDown6;
private string endcoordinates=null;


private System.Drawing.Image Image
{
get { return _image; }
}

public fmlinks()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
string [] fileEntries = Directory.GetFiles(utils.imgfolderpath);
j=fileEntries.Length;
//arrfilename=new string[j];
arrfileindex1=new string[j];
arrfileindex2=new string[j];


//charfileindex1=new char[]{'#'};
filename=new string[j];
filename1=new string[j*3];

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(fmlinks));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.thumbnails = new System.Windows.Forms.TabPage();
this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
this.lblviewcurlinks = new System.Windows.Forms.Label();
this.lblcurlinks = new System.Windows.Forms.Label();
this.panel1 = new CustomAutoScrollPanel.ScrollablePanel();
this.panel2 = new System.Windows.Forms.Panel();
this.actualsize = new System.Windows.Forms.TabPage();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
this.thumbnails.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.thumbnails);
this.tabControl1.Controls.Add(this.actualsize);
this.tabControl1.Location = new System.Drawing.Point(8, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(580, 520);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// thumbnails
//
this.thumbnails.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("thumbnails.BackgroundImage")));
this.thumbnails.Controls.Add(this.numericUpDown6);
this.thumbnails.Controls.Add(this.numericUpDown5);
this.thumbnails.Controls.Add(this.lblviewcurlinks);
this.thumbnails.Controls.Add(this.lblcurlinks);
this.thumbnails.Controls.Add(this.panel1);
this.thumbnails.Location = new System.Drawing.Point(4, 22);
this.thumbnails.Name = "thumbnails";
this.thumbnails.Size = new System.Drawing.Size(572, 494);
this.thumbnails.TabIndex = 0;
this.thumbnails.Text = "Thumbnails";
//
// numericUpDown6
//
this.numericUpDown6.Location = new System.Drawing.Point(352, 8);
this.numericUpDown6.Maximum = new System.Decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown6.Name = "numericUpDown6";
this.numericUpDown6.TabIndex = 4;
this.numericUpDown6.Visible = false;
this.numericUpDown6.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
//
// numericUpDown5
//
this.numericUpDown5.Location = new System.Drawing.Point(488, 8);
this.numericUpDown5.Maximum = new System.Decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown5.Name = "numericUpDown5";
this.numericUpDown5.TabIndex = 3;
this.numericUpDown5.Visible = false;
this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
//
// lblviewcurlinks
//
this.lblviewcurlinks.AutoSize = true;
this.lblviewcurlinks.Location = new System.Drawing.Point(192, 16);
this.lblviewcurlinks.Name = "lblviewcurlinks";
this.lblviewcurlinks.Size = new System.Drawing.Size(0, 16);
this.lblviewcurlinks.TabIndex = 2;
//
// lblcurlinks
//
this.lblcurlinks.Location = new System.Drawing.Point(48, 16);
this.lblcurlinks.Name = "lblcurlinks";
this.lblcurlinks.Size = new System.Drawing.Size(72, 23);
this.lblcurlinks.TabIndex = 1;
this.lblcurlinks.Text = "Current Link";
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.AutoScrollHorizontalMaximum = 100;
this.panel1.AutoScrollHorizontalMinimum = 0;
this.panel1.AutoScrollHPos = 0;
this.panel1.AutoScrollVerticalMaximum = 100;
this.panel1.AutoScrollVerticalMinimum = 0;
this.panel1.AutoScrollVPos = 0;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.panel2);
this.panel1.EnableAutoScrollHorizontal = true;
this.panel1.EnableAutoScrollVertical = true;
this.panel1.Location = new System.Drawing.Point(8, 48);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(568, 440);
this.panel1.TabIndex = 0;
this.panel1.VisibleAutoScrollHorizontal = true;
this.panel1.VisibleAutoScrollVertical = true;
this.panel1.ScrollVertical += new System.Windows.Forms.ScrollEventHandler(this.panel1_ScrollVertical);
this.panel1.ScrollHorizontal += new System.Windows.Forms.ScrollEventHandler(this.panel1_ScrollHorizontal);
this.panel1.ScrollMouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_ScrollMouseWheel);
//
// panel2
//
this.panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel2.BackgroundImage")));
this.panel2.Location = new System.Drawing.Point(24, 16);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(700, 750);
this.panel2.TabIndex = 0;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
this.panel2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
this.panel2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
//
// actualsize
//
this.actualsize.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("actualsize.BackgroundImage")));
this.actualsize.Location = new System.Drawing.Point(4, 22);
this.actualsize.Name = "actualsize";
this.actualsize.Size = new System.Drawing.Size(648, 438);
this.actualsize.TabIndex = 1;
this.actualsize.Text = "Actual Size";
//
// fmlinks
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(592, 542);
this.Controls.Add(this.tabControl1);
this.Name = "fmlinks";
this.Load += new System.EventHandler(this.fmlinks_Load);
this.tabControl1.ResumeLayout(false);
this.thumbnails.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion
private void DisplayThumbnails()
{

//string sourceDir="g:\\images";
string [] fileEntries = Directory.GetFiles(utils.imgfolderpath);

int j=fileEntries.Length;
//get the first and second filename numbers in an array for example for file 1_2_medhistory.png
//getting 1 and 2

for(int i=0; i<j; i++)
="" {
="" char[]="" charfileindex;
="" charfileindex="new" char[]{'_'};
="" int="" index="fileEntries[i].ToString().LastIndexOf(@"\");
" string="" s="fileEntries[i].ToString().Substring(index+1);
" filename[i]="s;
"
="" filename1="filename[i].Split(charfileindex);
" arrfileindex1[i]="filename1[0];
" arrfileindex2[i]="filename1[1];
" }
="" try
="" pb="new" system.windows.forms.picturebox[j];
="" lbl="new" system.windows.forms.label[j];
="" messagebox.show(fileindex2max.tostring());
="" for(int="" i="0" ;="" <="" j="" i++="" )
="" folderpath="g:\\images" ;
="" image="" img="Image.FromFile(folderpath" +="" @"\"="" (i+1)="" "_"+k+"_medicalhistorypage_done.png");
="" if(file.exists(utils.imgfolderpath="" (arrfileindex1[i])="" "_"="" (arrfileindex2[i])="" "_medicalhistorypage_done.png"))
="" pb[i]="new" picturebox();
="" lbl[i]="new" label();
="" pb[i].image="Image.FromFile(folderpath" "_medicalhistorypage_done.png");
="" _image="Image.FromFile(utils.imgfolderpath" pb[i].backcolor="Color.Black;
" pb[i].width="150;
" pb[i].name="arrfileindex1[i].ToString()+"_"+arrfileindex2[i].ToString();
" pb[i].height="120;
" lbl[i].width="60;
" lbl[i].height="15;
" pb[i].tag="arrfileindex1[i].ToString()+"_"+arrfileindex2[i].ToString();
" messagebox.show(pb[i,k].tag.tostring());
="" pb[i].sizemode="PictureBoxSizeMode.CenterImage;
" numberhorizontal="-1;
" if="" (numberhorizontal="" 0)
="" determine="" how="" many="" thumbnails="" can="" be="" displayed="" on="" one="" row
="" (this.panel2.width="" pb[i].width);
="" set="" the="" position="" for="" thumbnail="" and="" add="" it="" to="" panel's="" controls
="" pb[i].left="_margin" (pb[i].width+_margin)="" *="" ((this.panel2.controls.count="" 2)="" %="" (numberhorizontal-1));
="" pb[i].top="_margin" (pb[i].height+_margin)="" lbl[i].left="pb[i].Left" 60;
="" lbl[i].top="pb[i].Top" 120;
="" lbl[i].backcolor="Color.White;
" pb[i].click+="new" eventhandler(pictureclick);
="" pb[i].mousedown+="new" mouseeventhandler(picturemousedown);
="" pb[i].mousemove+="new" mouseeventhandler(picturemousemove);
="" pb[i].dragdrop+="new" drageventhandler(picturedragdrop);
="" pb[i].dragenter+="new" drageventhandler(picturedragenter);
="" pb[i].mouseup+="new" mouseeventhandler(picturemouseup);
="" pb[i].paint+="new" painteventhandler(imageview1_paint);
="" pb[i].allowdrop="true;
" pb[i].enabled="false;
" disable="" picturebox="" which="" are="" already="" linked
="" if(utils.globallink!="null)
//" tag="arrfileindex1[i].ToString()+"_"+arrfileindex2[i].ToString();
//" if(index!="-1)
//" lbl[i].mousemove+="new" mouseeventhandler(lblimageview_mousemove);
="" lbl[i].click+="new" eventhandler(lblimageview_click);
="" lbl[i].text="(arrfileindex1[i])" (arrfileindex2[i]);

="" this.panel1.controls.add(pb[i]);
="" this.panel1.controls.add(lbl[i]);
="" max="Math.Min(150," 120);
="" width="_image.Width;
" height="_image.Height;
" size="" image
="" (_image.width=""> max || _image.Height > max)
{
if (_image.Width > _image.Height)
{
width = max+15;
height = (int) (_image.Height * max / _image.Width)-10;
}
else
{
width = (int) (_image.Width * max / _image.Height)+15;
height = max-10;
}
}
pb[i].Image = new Bitmap(_image, width, height);
this.panel2.Controls.Add(pb[i]);
pb[i].SendToBack();

}
this.panel2.Controls.AddRange(lbl);
// this.panel1.Controls.AddRange(pb);
if((j%4)==0)
{
panel2.Height=(j/4)*150;
}
else
{
panel2.Height=(int)((j/4)*150+250);
}



}


}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
}

}

private void pictureClick(object sender, System.EventArgs e)
{
panel1.Focus();

//pb[j].Tag=1;

// PictureBox who1=(PictureBox) sender;
// if(who1.Image!=null)
// {
// //who1.BackColor=Color.Black;
// m_MouseIsDown=false;
// utils.img = who1.Image;
// utils.imgname=who1.Tag.ToString();
// //MessageBox.Show(who1.Tag.ToString());
// actualimagesize frmAIS=new actualimagesize();
// frmAIS.ShowDialog();
//
//
//
// }
}




private void pictureMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{

PictureBox who=(PictureBox) sender;
//MessageBox.Show(who.Tag.ToString());
if(who.Image!=null)
{
//Panel who1=(Panel) panel1;

//toolTip1.Dispose();
//MessageBox.Show(who.Tag.ToString());

linkfrom=who.Tag.ToString();
m_MouseIsDown=true;
//who.Focus();

//who.BackColor=Color.Tomato;

ps.X = e.X;
ps.Y = e.Y;
pe = ps;
string x=e.X.ToString();
string y=e.Y.ToString();
string coord=x+","+y;
if(startcoordinates==null)
{
startcoordinates=coord;
}
else
{
startcoordinates=startcoordinates+"#"+coord;
}
// panelmousedown=true;

}
}

private void pictureMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
PictureBox who=(PictureBox) sender;
//who.Cursor=Cursors.Hand;

//toolTip1.SetToolTip(who, "Click to view document full size. Drag the document to link it to another document");

if(m_MouseIsDown==true)
{
//code added on 12/21/2004 for backcolor of picturbox
if(hascolor==false)
{
Color c = new Color();
c=medappzDMS.utils.GetRandomColor();
pbcolor=c.Name;

hascolor=true;
}
// MessageBox.Show(pbcolor);
//who.BackColor=utils.getcolorname(pbcolor);
//code end 12/21/2004
who.DoDragDrop(who.Image, DragDropEffects.Move);
m_IsDragDrop=true;



}
m_MouseIsDown=false;


}

private void pictureDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.Bitmap))
{


//Check for the CTRL key.
if(e.KeyState == 9)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.Move;
}
}

else
{
e.Effect = DragDropEffects.None;
}

}

private void pictureDragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{

if(m_IsDragDrop==true)
{


PictureBox who=(PictureBox) sender;

//code 12/21/2004
//who.BackColor=utils.getcolorname(pbcolor);
//DrawLineInt(who);
//code end 12/21/2004
string linkto=who.Tag.ToString();
//MessageBox.Show(who.Tag.ToString());
if(linkfrom==linkto)
{
//who.BackColor=Color.Black;
m_MouseIsDown=false;
utils.img = who.Image;
utils.imgname=who.Tag.ToString();

actualimagesize frmAIS=new actualimagesize();
frmAIS.ShowDialog();
}
else
{

if(locallink==null)
{
locallink=linkfrom+","+linkto;
// MessageBox.Show(locallink);

lblviewcurlinks.Text=locallink;
}
else
{
int index=locallink.IndexOf(linkto);
int index1=locallink.IndexOf(linkfrom);
if((index==-1)&&(index1==-1))
{
locallink+=","+linkfrom+","+linkto;
// MessageBox.Show(locallink);
lblviewcurlinks.Text=locallink;
}
else if((index==-1)&&(index1!=-1))
{
locallink+=","+linkto;
// MessageBox.Show(locallink);
lblviewcurlinks.Text=locallink;
}
else if((index!=-1)&&(index1==-1))
{
locallink+=","+linkfrom;
// MessageBox.Show(locallink);
lblviewcurlinks.Text=locallink;
}
else
{
// MessageBox.Show(locallink);
lblviewcurlinks.Text=locallink;
}

}
}
Panel thisform = (Panel) panel1;

// First DrawReversible to toggle to the background color
// Second DrawReversible to toggle to the specified color
ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
pe.X = e.X;
pe.Y = e.Y;
string x=e.X.ToString();
string y=e.Y.ToString();
string coord=x+","+y;
if(endcoordinates==null)
{
endcoordinates=coord;
}
else
{
endcoordinates=endcoordinates+"#"+coord;
}
//ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);



//Panel thisform = (Panel)sender;
Graphics g = thisform.CreateGraphics();
Pen p = new Pen(Color.Blue, 2);

//ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
g.DrawLine(p, ps, pe);

g.Dispose();
}




//btnstop.Enabled=true;
m_IsDragDrop=false;

}


public void DrawLineInt(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);

e.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
}

private void imageview1_Paint(object sender, PaintEventArgs e)
{

}

private void pictureMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
// if (e.Button==MouseButtons.Left)
// {
//
// Panel thisform = (Panel) panel1;
//
// // First DrawReversible to toggle to the background color
// // Second DrawReversible to toggle to the specified color
// ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
// pe.X = e.X;
// pe.Y = e.Y;
// string x=e.X.ToString();
// string y=e.Y.ToString();
// string coord=x+","+y;
// if(endcoordinates==null)
// {
// endcoordinates=coord;
// }
// else
// {
// endcoordinates=endcoordinates+"#"+coord;
// }
// ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
//
//
//
// //Panel thisform = (Panel)sender;
// Graphics g = thisform.CreateGraphics();
// Pen p = new Pen(Color.Blue, 2);
//
// ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
// g.DrawLine(p, ps, pe);
//
// g.Dispose();
// }



}



private void fmlinks_Load(object sender, System.EventArgs e)
{
DisplayThumbnails();

}

private void panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
for (int i=0; i< panel1.Controls.Count; i++)
{
if(panel1.Controls[i].Focused==true)
{
//panel1.Controls[i].Enabled=true;
MessageBox.Show(panel1.Controls[i].Tag.ToString());
}
}
ps.X = e.X + panel1.AutoScrollHPos;
ps.Y = e.Y + panel1.AutoScrollVPos;
pe = ps;
string x=e.X.ToString();
string y=e.Y.ToString();
string coord=x+","+y;
//MessageBox.Show(panel1.AutoScrollPosition.X.ToString()+" "+panel1.AutoScrollPosition.Y.ToString());
if(startcoordinates==null)
{
startcoordinates=coord;
}
else
{
startcoordinates=startcoordinates+"#"+coord;
}

// panelmousedown=true;




}

private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
// if (e.Button==MouseButtons.Left)
// {
// if(panelmousedown==true)
// {
// Panel thisform = (Panel)sender;
//
// First DrawReversible to toggle to the background color
// Second DrawReversible to toggle to the specified color
// ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
// pe.X = e.X;
// pe.Y = e.Y;
// string x=e.X.ToString();
// string y=e.Y.ToString();
// string coord=x+","+y;
// if(endcoordinates==null)
// {
// endcoordinates=coord;
// }
// else
// {
// endcoordinates=endcoordinates+"#"+coord;
// }
// ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
//
// }
// panelmousedown=false;

//}


}

private void panel1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button==MouseButtons.Left)
{

Panel thisform = (Panel)sender;

// First DrawReversible to toggle to the background color
// Second DrawReversible to toggle to the specified color
ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
pe.X = e.X + panel1.AutoScrollHPos;
pe.Y = e.Y + panel1.AutoScrollVPos;
string x=e.X.ToString();
string y=e.Y.ToString();
string coord=x+","+y;
if(endcoordinates==null)
{
endcoordinates=coord;
}
else
{
endcoordinates=endcoordinates+"#"+coord;
}
ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);



//Panel thisform = (Panel)sender;
Graphics g = thisform.CreateGraphics();
Pen p = new Pen(Color.Blue, 2);

ControlPaint.DrawReversibleLine(thisform.PointToScreen(ps), thisform.PointToScreen(pe), Color.Black);
g.DrawLine(p, ps, pe);

g.Dispose();
MessageBox.Show(startcoordinates);

}

}

private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
{
//this.panel1.SuspendLayout();
}

private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Panel thisform = (Panel)sender;
Graphics g = thisform.CreateGraphics();
Pen p = new Pen(Color.Blue, 2);
if((startcoordinates!=null)||(endcoordinates!=null))
{
char[] charfileindex1;
charfileindex1=new char[]{'#'};
char[] charfileindex2;
charfileindex2=new char[]{'#'};
int charfileindexlen1=startcoordinates.Split(charfileindex1).Length;
string[] ss=new string[charfileindexlen1];
ss=startcoordinates.Split(charfileindex1);
string[] ss1=new string[charfileindexlen1];
ss1=endcoordinates.Split(charfileindex1);
for(int i=0; i
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 19:24
protectorHeath Stewart23-Dec-04 19:24 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 20:18
ninja260523-Dec-04 20:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 20:23
protectorHeath Stewart23-Dec-04 20:23 
GeneralRe: Draw line between pictureboxes Pin
ninja260524-Dec-04 0:33
ninja260524-Dec-04 0:33 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart27-Dec-04 10:09
protectorHeath Stewart27-Dec-04 10:09 
GeneralRe: Draw line between pictureboxes Pin
ninja260529-Dec-04 0:38
ninja260529-Dec-04 0:38 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart29-Dec-04 5:28
protectorHeath Stewart29-Dec-04 5:28 
GeneralRe: Draw line between pictureboxes Pin
ninja260510-Jan-05 0:49
ninja260510-Jan-05 0:49 
GeneralI wish myself a flicker free form Pin
TyronX23-Dec-04 2:09
TyronX23-Dec-04 2:09 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 5:27
protectorHeath Stewart23-Dec-04 5:27 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 6:47
TyronX23-Dec-04 6:47 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 9:31
protectorHeath Stewart23-Dec-04 9:31 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 10:23
TyronX23-Dec-04 10:23 
GeneralConnection to access database with C#.net Pin
Robske23-Dec-04 1:41
Robske23-Dec-04 1:41 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 3:27
leppie23-Dec-04 3:27 
GeneralRe: Connection to access database with C#.net Pin
Robske23-Dec-04 4:25
Robske23-Dec-04 4:25 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 4:42
leppie23-Dec-04 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.