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

تغيير خلفية سطح المكتب

مغلق
بدأه albahr في 24 ديسمبر 2007 · 0 رد · 593 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكم ورحمة الله وبركاته ،،،

في المواضيع المطروحة من قبل في هذا الموضوع لم أجد الخيار الذي يتيح وضع الصورة في سطح المكتب من حيث

هل تكون الصورة في كامل الشاشة أم في الوسط أم تكرارها فهل من حل لهذه المشكلة .

هذا هو الكود المستخدم في تغيير خلفية سطح المكتب (إذا كان هناك كود آخر أرجو إتحافي به)

Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2

Private Declare Auto Function SystemParametersInfo Lib "user32.dll" ( _
	ByVal uAction As Integer, ByVal uParam As Integer, _
	ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer

' change this to whatever filename you want to use
Const WallpaperFile As String = "MovieCollectionImage.bmp"

''' <SUMMARY>
''' Sets the background of your Windows desktop.  
''' The image will be saved in MyPictures and the background 
''' wallpaper updated.
''' </SUMMARY>
''' The image to be set as the background.
''' <REMARKS></REMARKS>
Friend Sub SetWallpaper(ByVal img As Image)
	Dim imageLocation As String
	imageLocation = My.Computer.FileSystem.CombinePath( _
		My.Computer.FileSystem.SpecialDirectories.MyPictures, WallpaperFile)
	Try
		img.Save(imageLocation, System.Drawing.Imaging.ImageFormat.Bmp)
		SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imageLocation, _
			SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
	Catch Ex As Exception
		MsgBox("There was an error setting the wallpaper: " & Ex.Message)
	End Try
End Sub

ولكم جزيل الشكر

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

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