How to open an image in Photoshop using vb.net

 
In this article we will see that how we can open an image in photoshop application using vb.net.
The following example requires two button control named Button1 and Button2 and need to add reference of ‘Adobe Photoshop object Library’ in the application. With the help of this code we can open an image on the click of Button1 control, see below:

    Dim PhotoshopApp As Photoshop.Application
    Dim photoshopDoc As Photoshop.Document
    Dim curLayer As Photoshop.ArtLayer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PhotoshopApp = New ApplicationClass
        PhotoshopApp.DisplayDialogs = PsDialogModes.psDisplayNoDialogs
        PhotoshopApp.PlaybackDisplayDialogs = PsDialogModes.psDisplayNoDialogs
        photoshopDoc = PhotoshopApp.Open("C:\Users\Administrator\Pictures\imgage1.jpg")
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        photoshopDoc.ResizeImage(5, 5)
        photoshopDoc.Close()
        PhotoshopApp.Quit()
    End Sub

How to draw scroll button on a scroll bar control on windows form in vb.net

 
You can draw a scroll button on a scroll bar control in the specified state, on the specified graphics surface, and within the specified bound with the help of ControlPaint.DrawScrollButton Method using vb.net

You can use ControlPaint.DrawScrollButton Method like as :

Public Shared Sub DrawScrollButton ( _
graphics As Graphics, _
rectangle As Rectangle, _
button As ScrollButton, _
state As ButtonState _
)

Example

Following example draw a scroll button on windows form:

Private Sub Form1_Paint(ByVal sender As System.Object, _
                            ByVal e As System.Windows.Forms.PaintEventArgs) _
                            Handles MyBase.Paint
        ControlPaint.DrawScrollButton(e.Graphics, _
                                      New Rectangle(10, 180, 20, 20), ScrollButton.Left, ButtonState.Normal)
        ControlPaint.DrawScrollButton(e.Graphics, _
                                      New Rectangle(50, 180, 20, 20), ScrollButton.Max, ButtonState.Pushed)
End Sub

How to draw 3D border on windows form in vb.net

 
You can draw a three-dimensional style border on the specified graphics surface and within the specified bounds on a control with the help of ControlPaint.DrawBorder3D Method using vb.net

You can use ControlPaint.DrawBorder3D Method like as :

Public Shared Sub DrawBorder3D (grp As Graphics,rect As Rectangle)

Example

Following example draw a 3D style border on windows form:

Private Sub Form1_Paint(ByVal sender As System.Object, _
                            ByVal e As System.Windows.Forms.PaintEventArgs) _
                            Handles MyBase.Paint
        ControlPaint.DrawBorder3D(e.Graphics, New Rectangle(10, 10, 200, 200))
End Sub

Draw ComboButton on the windows form using vb.net

 
You can draw a drop-down button on a combo box control in the specified state, on the specified graphics surface, and within the specified bounds with the help of ControlPaint.DrawComboButton Method using vb.net

You can use ControlPaint.DrawComboButton Method like as :

Public Shared Sub DrawComboButton ( grp As Graphics, rect As Rectangle, state As ButtonState )

Example

Following example draw a drop-down button on a combo box control on windows form:

Private Sub Form1_Paint(ByVal sender As System.Object, _
                            ByVal e As System.Windows.Forms.PaintEventArgs) _
                            Handles MyBase.Paint
        ControlPaint.DrawComboButton(e.Graphics, New Rectangle(50, 50, 20, 20), ButtonState.Checked)
End Sub