Click here to Skip to main content
15,893,487 members
Home / Discussions / C#
   

C#

 
QuestionHow to open a file using windows API? Pin
Anonymous31-May-05 2:16
Anonymous31-May-05 2:16 
AnswerRe: How to open a file using windows API? Pin
darthWesley31-May-05 5:27
sussdarthWesley31-May-05 5:27 
AnswerRe: How to open a file using windows API? Pin
nemopeti31-May-05 23:23
nemopeti31-May-05 23:23 
AnswerRe: How to open a file using windows API? Pin
Anonymous31-May-05 23:27
Anonymous31-May-05 23:27 
AnswerRe: How to open a file using windows API? Pin
Anonymous31-May-05 23:39
Anonymous31-May-05 23:39 
Generalfind registry if modem connected Pin
ksanju100031-May-05 2:10
ksanju100031-May-05 2:10 
GeneralProgramatically moving a borderless form Pin
darthWes31-May-05 1:52
darthWes31-May-05 1:52 
GeneralRe: Programatically moving a borderless form Pin
rudy.net31-May-05 5:14
rudy.net31-May-05 5:14 
Wes, you have to use a fixed coordinate system because the form's coordinate keeps changing as it moves, so you should use the Screen coordinates.
Here is the code: (Try using entire form instead of panel to see if painting still works fine)
<br />
		private Point lastPos, offset;<br />
		private bool movingMe;<br />
<br />
		private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)<br />
		{<br />
			//Get the position of the top left corner of the form<br />
			Size zeroCoordinate = (Size)PointToScreen(new Point(-2,-30));<br />
			//Store the offset from top left corner to the current mouse position<br />
			Point mousePos = PointToScreen(new Point(e.X, e.Y));<br />
			offset = mousePos - zeroCoordinate;<br />
			movingMe = true;<br />
		}<br />
		private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
		{<br />
			if(movingMe)<br />
			{<br />
				int dX, dY;<br />
				Point mousePos = PointToScreen(new Point(e.X, e.Y));<br />
				dX=mousePos.X - lastPos.X;<br />
				dY=mousePos.Y - lastPos.Y;<br />
				if(dX != 0 || dY != 0)<br />
				{<br />
					this.Location = mousePos - (Size)offset;<br />
					this.Refresh();<br />
					lastPos = mousePos;<br />
				}<br />
			}<br />
<br />
		}<br />
		private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
		{<br />
			movingMe = false;<br />
		}<br />
<br />
This was an interesting problem, please let me know of any additional updates you make so I can add your changes to my code snippets.

GeneralRe: Programatically moving a borderless form Pin
Luis Alonso Ramos31-May-05 12:14
Luis Alonso Ramos31-May-05 12:14 
QuestionWhat is this for Pin
rain71131-May-05 0:26
rain71131-May-05 0:26 
AnswerRe: What is this for Pin
Dave Kreskowiak31-May-05 6:24
mveDave Kreskowiak31-May-05 6:24 
AnswerRe: What is this for Pin
Robert Rohde31-May-05 8:12
Robert Rohde31-May-05 8:12 
AnswerRe: What is this for Pin
Green Fuze31-May-05 8:44
Green Fuze31-May-05 8:44 
AnswerRe: What is this for Pin
Tom Wright31-May-05 12:22
Tom Wright31-May-05 12:22 
GeneralSynchroniza VFP table with dataset created by SQL dataAdapter Pin
Member 185596330-May-05 23:59
Member 185596330-May-05 23:59 
GeneralRe: Synchroniza VFP table with dataset created by SQL dataAdapter Pin
MicrosoftBob31-May-05 4:51
MicrosoftBob31-May-05 4:51 
GeneralCrystal Report Progress Dialog Box Pin
Nic Rowan30-May-05 20:26
Nic Rowan30-May-05 20:26 
QuestionHow to get Parameters Type of EventHandlers Pin
hasansheik30-May-05 20:02
hasansheik30-May-05 20:02 
AnswerRe: How to get Parameters Type of EventHandlers Pin
S. Senthil Kumar30-May-05 20:31
S. Senthil Kumar30-May-05 20:31 
GeneralBest practices, web services Pin
johanhertz30-May-05 19:45
johanhertz30-May-05 19:45 
General'System.UnauthorizedAccessException in Winform Pin
ksanju100030-May-05 19:45
ksanju100030-May-05 19:45 
GeneralRe: 'System.UnauthorizedAccessException in Winform Pin
Dave Kreskowiak31-May-05 6:19
mveDave Kreskowiak31-May-05 6:19 
Generalprint label and datagrid Pin
georgeser30-May-05 19:24
georgeser30-May-05 19:24 
GeneralNHibernate: Timestamp - problem with mapping file Pin
devvvy30-May-05 17:12
devvvy30-May-05 17:12 
GeneralRe: NHibernate: Timestamp - problem with mapping file Pin
SimonS18-Jun-05 4:40
SimonS18-Jun-05 4:40 

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.