PDA

View Full Version : حرفه ای: هم اندازه شدن عکس با فرم



milad.biroonvand
پنج شنبه 17 مرداد 1392, 09:22 صبح
سلام
من میخوام کاری کنم که فرم به شکل همان عکسی بشه که در بک گراند فرم گذاشتم.

راه کار این رو میدونم. در ویندوز 7 جواب میده ولی در ویندوز xp عمل نمیکنه. لازم به ذکر هست من از transprentkey استفاده می کنم.


با تشکر

Fery666
پنج شنبه 17 مرداد 1392, 09:41 صبح
حالت BackgroundImageLayout فرم رو روی Stretch بزارین :چشمک:

در این حالت در هر سیستم عاملی عکس به اندازه کل فرم هستش .

milad.biroonvand
پنج شنبه 17 مرداد 1392, 09:47 صبح
خوب الان یه دایره تو عکس بزار و کاری کن که اون دایره جز فرمت نباشه. اوقت چیکار می کنی. یا به عبارتی کاری کن که فرم بصورت یک درخت باشه.

milad.biroonvand
پنج شنبه 17 مرداد 1392, 09:51 صبح
فک کنم راه خل این باشه.

To work around this bug, programmatically set the BackgroundImage property and the TransparencyKey property. To do this, follow these steps:
Create a sample bitmap file (.bmp) or select a bitmap file that is already available on your computer.
Append the following code in the Form1 class constructor after the InitializeComponent statement.


Microsoft Visual Basic .NET or Microsoft Visual Basic 2005 Code
Dim Img As Bitmap = Bitmap.FromFile("c:\\Example.bmp")
'The color at Pixel(10,10) is rendered as transparent for the complete background.
Img.MakeTransparent(Img.GetPixel(10, 10))
Me.BackgroundImage = Img
Me.TransparencyKey = Img.GetPixel(10, 10)