Click here to Skip to main content
15,892,674 members
Home / Discussions / C#
   

C#

 
Generaloledbcommand Pin
K4reem4-Aug-03 13:14
K4reem4-Aug-03 13:14 
GeneralRe: oledbcommand Pin
Ista4-Aug-03 17:58
Ista4-Aug-03 17:58 
GeneralRe: oledbcommand Pin
K4reem5-Aug-03 3:53
K4reem5-Aug-03 3:53 
GeneralRe: oledbcommand Pin
Ista5-Aug-03 9:33
Ista5-Aug-03 9:33 
GeneralRe: oledbcommand Pin
K4reem5-Aug-03 9:51
K4reem5-Aug-03 9:51 
GeneralRe: oledbcommand Pin
Ista5-Aug-03 9:57
Ista5-Aug-03 9:57 
GeneralScrolling and drawing with GDI+ and Windows Forms Pin
Arun Bhalla4-Aug-03 12:38
Arun Bhalla4-Aug-03 12:38 
GeneralRe: Scrolling and drawing with GDI+ and Windows Forms Pin
Furty4-Aug-03 15:12
Furty4-Aug-03 15:12 
While I can't discuss issues specific to the Panel control, I can give you some insight into problems I overcame when extending the ListView to provide control container functionality - perhaps it can help.

In my control, I needed to get the actual pixel location of each ListViewItem's SubItem in the ListView - taking into account the current scroll position. I'm guessing that your situation is similar.

The first task was to find each controls location, relative to it's container:

// find this control's position relative to it's container<br />
			int x = Left;<br />
			for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
			{<br />
				if (thisParent.Parent != null && thisParent.Left > 0)<br />
					x += thisParent.Left;<br />
			}<br />
<br />
			int y = Top;<br />
			for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
			{<br />
				if (thisParent.Parent != null && thisParent.Top > 0)<br />
					y += thisParent.Top;<br />
			}


Once you've done this, you should have a good reference to everything, and can paint your lines etc. The only other thing you'll need to is is get notified of scroll events so you can repaint everything properly. For the ListView control, I was forced to override the WndProc method to get my notifications:


private const int WM_HSCROLL = 0x114;<br />
private const int WM_VSCROLL = 0x115;<br />
<br />
protected override void WndProc(ref Message msg)<br />
{<br />
	// Look for the WM_VSCROLL or the WM_HSCROLL messages.<br />
	if ((msg.Msg == WM_VSCROLL) || (msg.Msg == WM_HSCROLL))<br />
	{<br />
		// Do something to update your control <br />
	}<br />
	// Pass message to default handler.<br />
	base.WndProc(ref msg);<br />
} 


Naturally this could all be irrelevant to the Panel control (something I've never bothered to base a new control off), But I hope it helps anyway.
GeneralRe: Scrolling and drawing with GDI+ and Windows Forms Pin
Arun Bhalla5-Aug-03 6:00
Arun Bhalla5-Aug-03 6:00 
Generalget rows returned from data adapter Pin
mikemilano4-Aug-03 11:46
mikemilano4-Aug-03 11:46 
GeneralRe: get rows returned from data adapter Pin
Alexander Kojevnikov4-Aug-03 22:15
Alexander Kojevnikov4-Aug-03 22:15 
GeneralRe: get rows returned from data adapter Pin
mikemilano5-Aug-03 3:47
mikemilano5-Aug-03 3:47 
GeneralSmall C#, VS2003, CheckedListBox, Intellisense question Pin
Robert L. Edwards4-Aug-03 11:05
Robert L. Edwards4-Aug-03 11:05 
Generalregex functions Pin
mikemilano4-Aug-03 9:40
mikemilano4-Aug-03 9:40 
GeneralRe: regex functions Pin
Eric Gunnerson (msft)4-Aug-03 9:54
Eric Gunnerson (msft)4-Aug-03 9:54 
GeneralRe: regex functions Pin
mikemilano4-Aug-03 10:27
mikemilano4-Aug-03 10:27 
GeneralBest Practice for client/server app Pin
morefire4-Aug-03 9:16
morefire4-Aug-03 9:16 
GeneralRe: Best Practice for client/server app Pin
Heath Stewart4-Aug-03 9:34
protectorHeath Stewart4-Aug-03 9:34 
GeneralRe: Best Practice for client/server app Pin
morefire4-Aug-03 13:24
morefire4-Aug-03 13:24 
GeneralRe: Best Practice for client/server app Pin
Eric Gunnerson (msft)4-Aug-03 12:02
Eric Gunnerson (msft)4-Aug-03 12:02 
GeneralRe: Best Practice for client/server app Pin
morefire4-Aug-03 13:32
morefire4-Aug-03 13:32 
GeneralRe: Best Practice for client/server app Pin
Ista4-Aug-03 18:06
Ista4-Aug-03 18:06 
GeneralMessage Closed Pin
5-Aug-03 7:21
mittencode5-Aug-03 7:21 
GeneralRe: Best Practice for client/server app Pin
Ista5-Aug-03 9:45
Ista5-Aug-03 9:45 
GeneralMessage Closed Pin
5-Aug-03 10:20
mittencode5-Aug-03 10:20 

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.