الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Bitmap Zooming problem

مغلق
بدأه mufic_semsem في 18 يونيو 2007 · 3 رد · 529 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

انا عندى فى برنامج بيحتاج ان انا اعمل

zoom in and zoom out

فكل لما اكتر العمليات دى الصورة بتبقى damage

الكود بتاعى اهو و يا ريست اللى عندة اى افكار برمجة او كود تانى يقول

#region Zooming Methods

		/// <summary>
		/// Make the PictureBox dimensions larger to effect the Zoom.
		/// </summary>
		/// <remarks>Maximum 5 times bigger</remarks>

		private void ZoomIn() 
		{

			if ( ( PicBox.Width < ( MINMAX * OuterPanel.Width ) ) &&
				( PicBox.Height < ( MINMAX * OuterPanel.Height ) ) )
			{

				PicBox.Width = Convert.ToInt32 ( PicBox.Width * ZOOMFACTOR );
				PicBox.Height = Convert.ToInt32 ( PicBox.Height * ZOOMFACTOR );
				NewImage(Class1.bmp,PicBox.Width,PicBox.Height);
				PicBox.SizeMode = PictureBoxSizeMode.StretchImage;
				ZOOMINGTIMES++;
			}
		}

		/// <summary>
		/// Make the PictureBox dimensions smaller to effect the Zoom.
		/// </summary>
		/// <remarks>Minimum 5 times smaller</remarks>
		private void ZoomOut() 
		{
			if ( ( PicBox.Width > ( OuterPanel.Width / MINMAX ) ) &&
				( PicBox.Height > ( OuterPanel.Height / MINMAX ) ) )
			{
				PicBox.SizeMode = PictureBoxSizeMode.StretchImage; 
				PicBox.Width = Convert.ToInt32 ( PicBox.Width / ZOOMFACTOR );
				PicBox.Height = Convert.ToInt32 ( PicBox.Height / ZOOMFACTOR );
				NewImage(Class1.bmp, PicBox.Width, PicBox.Height);
				ZOOMINGTIMES--;
			}		
		}

		#endregion

		#region Mouse events

		/// <summary>
		/// We use the mousewheel to zoom the picture in or out
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void PicBox_MouseWheel(object sender, MouseEventArgs e)
		{
			if ( e.Delta < 0 )
			{
				ZoomOut();
			}
			else
			{
				 ZoomIn();
			}
		}


		private void NewImage(Bitmap bmp1, int newWidth, int newHeight)
		{
			iniImg = Class1.bmp;
			changedImg = new Bitmap(iniImg, newWidth, newHeight);
			PicBox.Image = changedImg;
			Class1.bmp = changedImg;
			g = Graphics.FromImage(changedImg);
		}

وفى المرفقات الصورة قبل و بعد

post-30356-1182179483_thumb.jpg

post-30356-1182179495_thumb.jpg

لا اله الا الله .......................................... محمد رسول الله

#3

are u asking

if that

just resize the bmp and the picbox and strach the bmp in the pic box

لا اله الا الله .......................................... محمد رسول الله

#4

??????????????????????

any idea plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

لا اله الا الله .......................................... محمد رسول الله

هذا الموضوع مغلق.

مواضيع مشابهة