Click here to Skip to main content
15,909,530 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to register? Pin
Colin Angus Mackay10-Oct-04 4:01
Colin Angus Mackay10-Oct-04 4:01 
GeneralRe: How to register? Pin
momer10-Oct-04 15:17
momer10-Oct-04 15:17 
AnswerRe: How to register? Pin
Christian Graus10-Oct-04 11:49
protectorChristian Graus10-Oct-04 11:49 
GeneralRe: How to register? Pin
momer10-Oct-04 15:25
momer10-Oct-04 15:25 
AnswerRe: How to register? Pin
Dave Kreskowiak11-Oct-04 6:14
mveDave Kreskowiak11-Oct-04 6:14 
GeneralHelp in editmode on Datalist. Pin
macsgirl9-Oct-04 11:07
macsgirl9-Oct-04 11:07 
GeneralRe: Help in editmode on Datalist. Pin
Heath Stewart10-Oct-04 11:07
protectorHeath Stewart10-Oct-04 11:07 
GeneralWindow Position Pin
dbetting9-Oct-04 10:59
dbetting9-Oct-04 10:59 
I've put together a component that, upon a certain action, a window opens. I am opening that window directly below the component, aligned with the bottom edge. It works great and exactly as I need it to...until the UC form is contained within a mdicontainer.

I am currently determining the position to place the window by looking at the position of the current component and its parents. Apparently with mdicontainers, the child form is a parent and I cannot get the appropriate screen position because the application form creates an unknown offset.

private void GetRefLocation(Control controlIn, ref int top, ref int left)<br />
{<br />
  /* Recursive procedure to get the total height position of the combobox.<br />
   *   This allows the use of the combo box within a User Class and the position <br />
   *   of the pop-up window will still be in the correct relative position.  */<br />
  Control controlParent = controlIn.Parent;<br />
  Form parent = this.FindForm();<br />
 <br />
  if (parent == controlParent)<br />
  {<br />
    top += parent.Top;<br />
    left += parent.Left;<br />
  }<br />
  else<br />
  {<br />
    int addHeight = 0;<br />
    System.Type a = controlParent.GetType();<br />
    string b = controlParent.GetType().FullName;<br />
    if (controlParent.GetType().FullName == "System.Windows.Forms.Panel")<br />
      addHeight = ((Panel)controlParent).BorderStyle == BorderStyle.None ? 0 : (((Panel)controlParent).BorderStyle == BorderStyle.FixedSingle ? 1 : 2);<br />
 <br />
    top += controlParent.Top + addHeight;<br />
    left += controlParent.Left;<br />
    GetRefLocation(controlParent, ref top, ref left);<br />
  }<br />
}


What do I really need to do to determine the position within the screen? I followed a couple trails involving GDI but I never found a way that I can set component.Location based on the screen position, let alone position of another component.

Thanks
GeneralRe: Window Position Pin
Stefan Troschuetz9-Oct-04 22:50
Stefan Troschuetz9-Oct-04 22:50 
GeneralRe: Window Position Pin
dbetting10-Oct-04 3:11
dbetting10-Oct-04 3:11 
GeneralRe: Window Position Pin
Stefan Troschuetz10-Oct-04 7:07
Stefan Troschuetz10-Oct-04 7:07 
GeneralWriting hex values to a file Pin
cgcrute9-Oct-04 6:50
cgcrute9-Oct-04 6:50 
GeneralRe: Writing hex values to a file Pin
Heath Stewart9-Oct-04 8:01
protectorHeath Stewart9-Oct-04 8:01 
GeneralRe: Writing hex values to a file Pin
cgcrute10-Oct-04 7:46
cgcrute10-Oct-04 7:46 
GeneralRe: Writing hex values to a file Pin
Heath Stewart10-Oct-04 11:05
protectorHeath Stewart10-Oct-04 11:05 
GeneralAdd dropdownlist to datalist Pin
macsgirl9-Oct-04 6:14
macsgirl9-Oct-04 6:14 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 7:50
protectorHeath Stewart9-Oct-04 7:50 
GeneralRe: Add dropdownlist to datalist Pin
macsgirl9-Oct-04 8:04
macsgirl9-Oct-04 8:04 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 11:43
protectorHeath Stewart9-Oct-04 11:43 
GeneralNDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 5:12
Kevin McFarlane9-Oct-04 5:12 
GeneralRe: NDoc 1.2 Problems Pin
Colin Angus Mackay9-Oct-04 5:49
Colin Angus Mackay9-Oct-04 5:49 
GeneralRe: NDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 6:43
Kevin McFarlane9-Oct-04 6:43 
GeneralRe: NDoc 1.2 Problems Pin
Heath Stewart9-Oct-04 7:41
protectorHeath Stewart9-Oct-04 7:41 
Generalhide form from close button Pin
Mridang Agarwalla9-Oct-04 3:40
Mridang Agarwalla9-Oct-04 3:40 
GeneralRe: hide form from close button Pin
Colin Angus Mackay9-Oct-04 3:56
Colin Angus Mackay9-Oct-04 3:56 

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.