PDA

View Full Version : چگونگی درست کردن کامپوننت نشان دهنده درجه



Raha323
سه شنبه 19 اردیبهشت 1391, 16:27 عصر
من میخوام کامپوننتی داشته باشم با گرافیک بالا برای نمایش درجه و به جای عقربه اش از عکس استفاده کنم یعنی عکس نشانگره درجم باشه ممنون
لطفا کمکم کنید

omidamiry
سه شنبه 19 اردیبهشت 1391, 21:35 عصر
اگه منظورت وولومه من تو همین سایت دیدم و نمونه مثال دوستان گذاشتن.
والا توضیح بشتر بده

ali_up1
سه شنبه 19 اردیبهشت 1391, 21:49 عصر
دوست عزیز شما ظاهرا ی Custom User Control میخوایید
باید علاوه بر تسلط کامل C# باید Mathematics drawing و GDI بلد باشی
در کل چیز گران قیمتی میخوای باید واسش وقت بزاری
System.Windows.Form.UserControl

mrbm_2007
چهارشنبه 20 اردیبهشت 1391, 01:27 صبح
سلام
با این کد میتونی عکس رو بچرخونی
حالا اگر عکس رو توی یه pictureBox بذاری می تونی image اش رو که می تونه عقربه باشه بچرخونی


/// <summary>
/// method to rotate an image either clockwise or counter-clockwise
/// </summary>
/// <param name="img">the image to be rotated</param>
/// <param name="rotationAngle">the angle (in degrees).
/// NOTE:
/// Positive values will rotate clockwise
/// negative values will rotate counter-clockwise
/// </param>
/// <returns></returns>
public static Image ImageRotate(Image img, double rotationAngle)
{
//create an empty Bitmap image
Bitmap bmp = new Bitmap(img.Width, img.Height);

//turn the Bitmap into a Graphics object
Graphics gfx = Graphics.FromImage(bmp);

//now we set the rotation point to the center of our image
gfx.TranslateTransform((float)bmp.Width / 2, (float)bmp.Height / 2);

//now rotate the image
gfx.RotateTransform((float)rotationAngle);

gfx.TranslateTransform(-(float)bmp.Width / 2, -(float)bmp.Height / 2);

//set the InterpolationMode to HighQualityBicubic so to ensure a high
//quality image once it is transformed to the specified size
gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;

//now draw our new image onto the graphics object
gfx.DrawImage(img, new Point(0, 0));

//dispose of our Graphics object
gfx.Dispose();

//return the image
return bmp;
}

Raha323
چهارشنبه 20 اردیبهشت 1391, 10:21 صبح
ممنون از دوستان نه من یه gauge میخوام کامپوننت دوبعدی پیدا کردم ولی می خوام سه بعدی باشه؛ خودم طراحی کنم تو #C ولی اونم دیدم دو بعدی داره
و اگه تو روتیت عکس کمکه بیشتری کنید ممنون میشم میخوام عکسم یک درجه یک درجه بچرخه و مقداره درجه چرخشش رو من براش تععین کنم
مثلا زاویه120 یا 122 یا 45 pointeramروی ایتن درجه ها قرار بگیره
ممنون از کمک دوستان