Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ChingYen  
#1 Posted : Sunday, March 16, 2008 9:14:13 AM(UTC)
ChingYen

Rank: Advanced Member

Groups: Member
Joined: 3/3/2008(UTC)
Posts: 185

Thanks: 8 times
Hi,

I load the picture into bitmap viewer during runtime, and each of the image might have different size.

I already set the RectangleRubberband.Resize mode to Proportional, where i would like to always keep the ratio of the image.

And during runtime when image is load, i add in the code where
_RectangleRubberband.Ratio = _bmViewer.Bitmap.Width / _bmViewer.Bitmap.Height

Now, here is the question. When the user click outside the bitmap viewer bitmap area, the RectangleRubberband will be auto discard. When the user try to make selection again, the ratio will be changed back to 1.

May I know is there anyway to prevent this?

Please advice. Thanks.
Alex Kon  
#2 Posted : Sunday, March 16, 2008 4:47:33 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups:
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi,

Hm, I think that the simplest way is to restore the aspect ratio. Something like that:

Code:

private void Form1_Load(object sender, EventArgs e)
{
	_bv = new BitmapViewer();
	_rectRubberband = new RectangleRubberband();

	_bv.Rubberband = _rectRubberband;
	_rectRubberband.ResizeMode = ResizeMode.Proportional;
	_rectRubberband.RectangleChanged += 
		new RectangleEventHandler(_rectRubberband_RectangleChanged);
}


void _rectRubberband_RectangleChanged(object s, RectangleEventArgs e)
{
	_rectRubberband.Ratio = <your_ratio_value>;		
}

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.