You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > IMClient Class > IMClient Methods > IMClient.UpdateDisplayPicture Method
MessengerYouLike
IMClient.UpdateDisplayPicture Method

This Method Allows Users Change there Display Picture and Update all Online friends with it

C#
public UpdateDisplayPicture(String ImagePath, int Width, int Height);
Visual Basic
Public Sub UpdateDisplayPicture(ByVal ImagePath As String, ByVal Width As Integer, ByVal Height As Integer)
Parameters 
Description 
ByVal ImagePath As String 
The Display Picture path on Local System 
ByVal Width As Integer 
Width of Picture ( Should be the Size of the Picture Container(eg :Picture box) ) 
ByVal Height As Integer 
Height of Picture ( Should be the Size of the Picture Container(eg :Picture box) ) 

When This Methods is called the Image is Compressed and re sized with Supplied parameters and then all online Friends are updated with this Display picture 

 

As Large Pictures may Take some time so when the compression is completed and pictures is saved in the location set by the property IMSDK.IMClient.DisplayPicturesSavePath and event IMSDK.IMClient.OnDisplayPictureUpdated is raised after this event is raised then all Online Friends starts updating the Display picture 

 

when a Online Friend receives a new display picture of the user the property IMSDK.Friends.MFriend.DisplayPicturePath is Updated and event IMSDK.IMClient.OnFriendDisplayPictureUpdated is fired 

 

the users DisplayPicture is saved in the database so that developers can show that on web

[Visual Basic]
 
'Create a new IMClient
Dim MC as new IMSDK.IMClient
 
 
 
'Call the Listen Sub
MC.Listen()
 
 
 
'Now Try to login
MC.BeginLogin(TxtUsername.Text,TxtPassword.Text)
 
 
 
'if username and password is valid then
Private Sub MC_OnLoggedin(ByVal UserObject As IMSDK.User) Handles MC.OnLoggedin
    Debug.WriteLine("Username logged in : " & MCUser.Username & " , " & MCUser.Password)
End Sub
 
 
 
'if username or password is invalid then
Private Sub MC_OnUsernameOrPasswordInvalid(ByVal Username As String, ByVal Password As String) Handles MC.OnUsernameOrPasswordInvalid
  Debug.WriteLine("Username password invalid : " & Username & " , " & Password)
End Sub
 
 
 
 
'Change Display picture
MC.UpdateDisplayPicture(FileDlg.FileName, PB.Width, PB.Height)
 
 
 
 
'When Completes Event is fired
    Private Sub MC_OnDisplayPictureUpdated(ByVal ImagePath As String) Handles MC.OnDisplayPictureUpdated
       Debug.WriteLine("On Display Picture Updated :" & ImagePath)
    End Sub

 

Copyright (c) 2007. All rights reserved.