Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
QuestionNew gradient background for Button...? Pin
Edmundisme10-Feb-08 11:23
Edmundisme10-Feb-08 11:23 
AnswerRe: New gradient background for Button...? Pin
Joachim Kerschbaumer10-Feb-08 21:48
Joachim Kerschbaumer10-Feb-08 21:48 
GeneralRe: New gradient background for Button...? Pin
Edmundisme11-Feb-08 7:37
Edmundisme11-Feb-08 7:37 
AnswerRe: New gradient background for Button...? Pin
Abhijit Jana10-Feb-08 22:03
professionalAbhijit Jana10-Feb-08 22:03 
GeneralRe: New gradient background for Button...? Pin
Edmundisme11-Feb-08 7:38
Edmundisme11-Feb-08 7:38 
AnswerRe: New gradient background for Button...? Pin
Ravenet11-Feb-08 3:13
Ravenet11-Feb-08 3:13 
GeneralRe: New gradient background for Button...? Pin
Edmundisme11-Feb-08 7:38
Edmundisme11-Feb-08 7:38 
GeneralAssigning a control back to the main form in the DragOver method... [modified] Pin
new_phoenix10-Feb-08 9:13
new_phoenix10-Feb-08 9:13 
I need some assistance resolving this issue. In the DragOver method I need to identify the column panel that a control was assigned to before assigning it back again to the main form for the application. The question is, what is the correct approach to assign the control back to the application main form so that the NewLocation() function can assign it to a new location on the main form? Currently, the control only stops dragging when I attempt to drag the control onto the control on that Panel object. I need the control that is dragged to be able to identify which panel the control is being dragged onto and then to reassign the control back to the main form using the PointToScreen() method. Is this even possible?

private static void _ctrlParent_DragOver(object sender, DragEventArgs e) 
{

...

// Correctly identifies which panel the control it is assigned to so that other code could work correctly. This code provides the need to reassign the control back to the main form again below all within one DragOver method.
	ctrl.Parent.Controls.Remove(ctrl);
	ctrl.Parent = cthis;
	cthis.Controls.Add(ctrl);
	Control ctrlPanelContainer = getPanelContainerName(ctrl);
	string strPanelContainerName = ctrlPanelContainer.Text;
	int intPanelContainerX = ctrlPanelContainer.Left;
	int intPanelContainerY = ctrlPanelContainer.Top;
	Point pt_parent = new Point(intPanelContainerX, intPanelContainerY);				Control panelContainer = ctrl.TopLevelControl.GetChildAtPoint(pt_parent);
	strPanelContainerNameMouseUp = panelContainer.Name;
		
// Attempts to assign the control back to the form so that is could drag over another control	
	frmSolitaireMainForm frm = new frmMainForm();
	ctrl.Parent.Controls.Remove(ctrl);
//	cthis = frm;                         // assigns the control to the form.
	ctrl.Parent = cthis;
	cthis.Controls.Add(ctrl);
	string strCthisNew = cthis.Name;   // correctly retrieves the form assignment.


// Incorrectly places the control back onto the main form.
	Point NewLocation = cthis.PointToScreen(new Point(e.X, e.Y));
	ctrl.Left = NewLocation.X;
	ctrl.Top = NewLocation.Y;
	ctrl.BringToFront();

...
}


modified on Sunday, February 10, 2008 4:26 PM

GeneralApplication of Digital Dictionary Pin
Abdul8510-Feb-08 7:23
Abdul8510-Feb-08 7:23 
GeneralDouble post - please ignore Pin
pmarfleet10-Feb-08 7:51
pmarfleet10-Feb-08 7:51 
GeneralBest approach Pin
pokabot10-Feb-08 6:41
pokabot10-Feb-08 6:41 
GeneralRe: Best approach Pin
Pete O'Hanlon10-Feb-08 10:10
mvePete O'Hanlon10-Feb-08 10:10 
GeneralRe: Best approach Pin
pokabot10-Feb-08 10:30
pokabot10-Feb-08 10:30 
GeneralCreate a windows explorer toolbar in .NET Pin
Yevgeny Efter10-Feb-08 6:05
Yevgeny Efter10-Feb-08 6:05 
GeneralRe: Create a windows explorer toolbar in .NET Pin
Mircea Puiu10-Feb-08 23:33
Mircea Puiu10-Feb-08 23:33 
GeneralRe: Create a windows explorer toolbar in .NET Pin
Yevgeny Efter11-Feb-08 5:52
Yevgeny Efter11-Feb-08 5:52 
Generalchange button icon in toolstrip Pin
nogetfx10-Feb-08 5:48
nogetfx10-Feb-08 5:48 
GeneralRe: change button icon in toolstrip Pin
Giorgi Dalakishvili10-Feb-08 6:09
mentorGiorgi Dalakishvili10-Feb-08 6:09 
GeneralRe: change button icon in toolstrip Pin
nogetfx10-Feb-08 7:34
nogetfx10-Feb-08 7:34 
GeneralRe: change button icon in toolstrip Pin
Giorgi Dalakishvili10-Feb-08 7:49
mentorGiorgi Dalakishvili10-Feb-08 7:49 
GeneralDiagnostics.process Pin
Shaahinm10-Feb-08 5:48
Shaahinm10-Feb-08 5:48 
GeneralRe: Diagnostics.process Pin
Giorgi Dalakishvili10-Feb-08 6:07
mentorGiorgi Dalakishvili10-Feb-08 6:07 
GeneralRe: Diagnostics.process Pin
Shaahinm10-Feb-08 6:10
Shaahinm10-Feb-08 6:10 
GeneralRe: Diagnostics.process Pin
Giorgi Dalakishvili10-Feb-08 6:35
mentorGiorgi Dalakishvili10-Feb-08 6:35 
GeneralRe: Diagnostics.process Pin
Kristian Sixhøj10-Feb-08 7:10
Kristian Sixhøj10-Feb-08 7:10 

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.