Notifications
Clear all

[Closed] FlowLayoutPanel scoll limitation?

 PEN

So I have a FlowLayoutPanel that has a label in it. This label can get very very long. We are talking 100,000 pixels wide. Now as it gets wider I can horizontally scroll the FLP up until a point. At a certain point, not sure where that is yet, the scroll bar stops getting smaller and I can’t scroll the bar far enough to be able to get to the end of the label. Any idea if I can over ride this?

19 Replies
 PEN

And here is something else that is wacky. I just went back to that simple example of the gantt chart that I posted. It uses a label and it works where the flowLayoutPanel fails. How ever, when I drag my mouse along on of the labels that I’m using as a row and get the value of the position of the mouse in x it returns the values up to 32,767 and then become -32,768 and starts to go down as I continue to move to the right. It is like there is a limit to the position of what the mouse will return.

Any solution?

 PEN

Just did a test on the first issue and it tied to the second issue. I just set up a mouseMove eventHandler on the label that I’m scaling up to 100000 pixels. And where the scroll bar is stoping is at 32,767 when I place my mouse over the most right side of the label that I can scroll to.

So is this a 32 bit limit? Would 64 get me further? And as it turns on in my simple test I am using a FLP and it is allowing me to scroll all the way to the end. How ever I’m setting it up differently. It is being added directly to a rollout using dotNetControl and not being created as a dotNetObject and added to a tab panel as it is in my final example.

I’ll I’m getting is issues with this project. Killing me. I need a C# or VB programmer that can help me out here and some how get past these limits for me. Any takers? as I don’t have time to learn it well enough.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

32767 (short) is a limit for width and height of controls in Windows. It’s not a NET issue. 64-bits will not help you. C# or VB will not help you either. You have to work around. Create a new control with location or size over 32767, copy any properties from old to new, delete old, and add new. It’s only one way that I see.


rollout testRoll "TEST" width:520
(
	dotNetControl flp_testFLP "flowLayoutPanel" width:500 height:100
	
	ON testRoll OPEN DO
	(
		flp_testFLP.autoScroll = true
		
		local theLabel = dotNetObject "Windows.Forms.Label"
		theLabel.width = 100000
		theLabel.backColor = (dotNetClass "System.Drawing.Color").goldenRod
		flp_testFLP.controls.add theLabel
		
		fn printMousePos =
		(
			print (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x
		)
		
		dotNet.addEventHandler theLabel "mouseMove" printMousePos
	)
)
createDialog testRoll

That works as expected over here, the listener prints out 100000 when I get to the end of the label. I’m on Vista 64 bits and tried with max 2009 and 2010. However doing a quick search on google I found this:

http://www.eggheadcafe.com/forumarchives/NETFrameworkNETWindowsFormscontrols/Oct2005/post24408825.asp

 PEN

That is the end of the label not the position of the mouse over the label.
I think it has some thing to do with unitConvertions.

1 Reply
(@marcobrunetta)
Joined: 11 months ago

Posts: 0

Well… the event is called when I move the mouse over the label, and it prints out the coordinates of the mouse in relation to the label control. It goes all the way from 1 to 100000 as I traverse the label.
The pointToClient method “Computes the location of the specified screen point into client coordinates”.

 PEN

Ah, I didn’t look that close, it must be doing the conversion differently. Works here as well in 32bit. Thanks. I’m thinking that I can do it using the getProperty asDotNetObject:true as well and do the conversion to a long but I haven’t quite got that working yet.

 PEN

Now the next problem, the scroll bar will not work correctly in my case as the FLP is not a dotNetControl but a dotnetObject that has been added to a splitContainer that is in another flp.

Any solutions to that?

 PEN

I’m not having any luck converting the value, complains that the value is to small when I’m in the negative.

 PEN

Well this just isn’t getting better.

I’m adding a label into the label that we are clicking on. If I set the bounds and then add the label all is fine and it is added any where you click. If I try to move the new label I can’t move it past 32767 again and any that are created past that value will pop back to it as soon as you try to set the value. I have tried bounds and location. Interesting thing is you can set the size without a problem.

Any ideas?

Try and move it afterwards by setting the location property on it to a number higher then 32767


rollout testRoll "TEST" width:520
(
	dotNetControl flp_testFLP "flowLayoutPanel" width:500 height:100
	
	ON testRoll OPEN DO
	(
		flp_testFLP.autoScroll = true
		
		theLabel = dotNetObject "Windows.Forms.Label"
		theLabel.width = 100000
		theLabel.backColor = (dotNetClass "System.Drawing.Color").goldenRod
		flp_testFLP.controls.add theLabel
		
		fn printMousePos =
		(
			print (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x
		)
		fn mouseDown sender arg=
		(
			lb=dotNetObject "label"
			lb.backColor=(dotNetClass "system.drawing.color").red
-- 			lb.size=dotNetObject "System.Drawing.Size" 10 10
-- 			lb.location=dotNetObject "system.drawing.point" (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x 1
			lb.bounds=dotNetObject "system.drawing.rectangle" (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x 1 10 10
			flp_testFLP.controls.item[0].controls.add lb
		)
		
		dotNet.addEventHandler theLabel "mouseMove" printMousePos
		dotNet.addEventHandler theLabel "mouseDown" MouseDown
	)
)
createDialog testRoll

--Use after clicking and adding a label in the yellow label.
testRoll.flp_testFLP.controls.item[0].controls.item[0].location.x=35000
print testRoll.flp_testFLP.controls.item[0].controls.item[0].location.x


Damn I’m stucked too. The only think I can think off would be to take a “virtual” approach and create/remove controls within the limited space giving the impression of a larger flowLayoutPanel. Of course just thinking about that gives me nightmares.

Page 1 / 2