Click here to Skip to main content
15,890,897 members
Home / Discussions / C#
   

C#

 
GeneralRe: Object to IntPtr... Pin
Shy Agam27-Oct-06 7:41
Shy Agam27-Oct-06 7:41 
GeneralRe: Object to IntPtr... Pin
led mike27-Oct-06 7:46
led mike27-Oct-06 7:46 
GeneralRe: Object to IntPtr... Pin
Eric Dahlvang27-Oct-06 8:12
Eric Dahlvang27-Oct-06 8:12 
GeneralRe: Object to IntPtr... Pin
Shy Agam27-Oct-06 8:27
Shy Agam27-Oct-06 8:27 
AnswerRe: Object --> IntPtr... Pin
ednrgc27-Oct-06 7:35
ednrgc27-Oct-06 7:35 
QuestionNewbie in need of webcam/capture/video overlay help Pin
edwa582327-Oct-06 6:18
edwa582327-Oct-06 6:18 
AnswerRe: Newbie in need of webcam/capture/video overlay help [modified] Pin
Larantz27-Oct-06 9:52
Larantz27-Oct-06 9:52 
GeneralRe: Newbie in need of webcam/capture/video overlay help Pin
Larantz27-Oct-06 14:00
Larantz27-Oct-06 14:00 
If you want the selected rectangle to draw in all four quadrants from start of selection, you can rewrite the MouseMove and MouseUp eventhandlers as follows:

//Add these two points aswell
private Point _rectstart = new Point(-1,-1);
private Point _rectend = new Point(-1,-1);
</p>
//then rewrite these methods as follows
private void videopanel_MouseMove(object sender, MouseEventArgs e)
{   
	if(mouse_down)
	{
		videopanel.Refresh();

		_pen = new Pen(this._blackbrush);
		Graphics g = this.videopanel.CreateGraphics();
		Point _mousemove = new Point(e.X, e.Y);

		if(_mousemove.X > _mousedown.X &&
		_mousemove.Y > _mousedown.Y)
		{
			_rectstart = new Point(
			   _mousedown.X,         
			   _mousedown.Y);
         
			_rectend = new Point(
			   _mousemove.X,         
			   _mousemove.Y);
		}
		else if(_mousemove.X < _mousedown.X &&
			_mousemove.Y < _mousedown.Y)
		{
			_rectstart = new Point(       
			   _mousemove.X,         
			   _mousemove.Y);
      
			_rectend = new Point(
			   _mousedown.X,         
			   _mousedown.Y);
		}
		else if(_mousemove.X > _mousedown.X &&
			_mousemove.Y < _mousedown.Y)
		{
			_rectstart = new Point(
			   _mousedown.X,         
			   _mousemove.Y);
        
			_rectend = new Point(
			   _mousemove.X,         
			   _mousedown.Y);
		}
		else
		{
			_rectstart = new Point(
			   _mousemove.X,         
			   _mousedown.Y);
    
			_rectend = new Point(
			   _mousedown.X,         
			   _mousemove.Y);
		}

		_captureRect = new Rectangle(         
			_rectstart,         
			new Size(
			_rectend.X - _rectstart.X,         
			_rectend.Y - _rectstart.Y));

		g.DrawRectangle(         
			_pen,         
			_captureRect);

	}
}
</p>		
private void videopanel_MouseUp(object sender, MouseEventArgs e)
{   
	mouse_down = false;

	Graphics g = this.videopanel.CreateGraphics();   
			
	_pen = new Pen(_redbrush);
	g.DrawRectangle(_pen, _captureRect);
}


-Larantz-

for those about to code, we salute you
http://www.tellus-software.com

QuestionDisplay Asian Characters in a Rich Text Box [modified] Pin
PowerRack27-Oct-06 5:58
PowerRack27-Oct-06 5:58 
QuestionC# MarshalAs problem Pin
cpshadle27-Oct-06 5:56
cpshadle27-Oct-06 5:56 
Question[Message Deleted] Pin
Rahithi27-Oct-06 5:22
Rahithi27-Oct-06 5:22 
AnswerRe: C# basic Exercise Help Pin
albCode27-Oct-06 5:29
albCode27-Oct-06 5:29 
General[Message Deleted] Pin
Rahithi27-Oct-06 6:06
Rahithi27-Oct-06 6:06 
GeneralRe: C# basic Exercise Help Pin
Kevin McFarlane27-Oct-06 6:26
Kevin McFarlane27-Oct-06 6:26 
AnswerRe: C# basic Exercise Help Pin
Kevin McFarlane27-Oct-06 5:47
Kevin McFarlane27-Oct-06 5:47 
General[Message Deleted] Pin
Rahithi27-Oct-06 6:47
Rahithi27-Oct-06 6:47 
GeneralRe: C# basic Exercise Help Pin
Guffa27-Oct-06 7:23
Guffa27-Oct-06 7:23 
GeneralRe: C# basic Exercise Help Pin
ednrgc27-Oct-06 7:37
ednrgc27-Oct-06 7:37 
GeneralRe: C# basic Exercise Help Pin
led mike27-Oct-06 7:50
led mike27-Oct-06 7:50 
General[Message Deleted] Pin
Rahithi27-Oct-06 6:56
Rahithi27-Oct-06 6:56 
GeneralRe: C# basic Exercise Help Pin
Dave Kreskowiak27-Oct-06 7:38
mveDave Kreskowiak27-Oct-06 7:38 
GeneralRe: C# basic Exercise Help Pin
ednrgc27-Oct-06 7:39
ednrgc27-Oct-06 7:39 
GeneralRe: C# basic Exercise Help Pin
BoneSoft27-Oct-06 10:17
BoneSoft27-Oct-06 10:17 
AnswerRe: C# basic Exercise Help Pin
Dan Neely27-Oct-06 8:18
Dan Neely27-Oct-06 8:18 
QuestionAsync jScript and mshtml Pin
sterenzi27-Oct-06 5:19
sterenzi27-Oct-06 5:19 

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.