Hi all,
I got Solution.
I like to share with you all, hope it will be helpful to them who are facing this kind of problem.
It was really strange that in one form that code was simply runs fine & in other form it was not working properly, It was showing only left & top border of control so, Finally I have to do some process like below.
I have do it in tow steps,
step 1.
get Image of control without Border.
step 2.
Add border in that image externally.
c.BorderStyle = BorderStyle.None
Dim bmp As New Bitmap(c.ClientSize.Width, c.ClientSize.Height)
scc.DrawToBitmap(bmp, New Rectangle(0, 0, c.ClientSize.Width, c.ClientSize.Height))
bmp = AppendBorder(bmp, 1)
bmp.Save("E:\Cur.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
Private Function AppendBorder(ByVal original As Image, ByVal borderWidth As Integer) As Image
Dim borderColor As Color = Color.Gray
Dim mypen As New Pen(borderColor, borderWidth * 2)
Dim newSize As Size = New Size(original.Width + borderWidth * 2, original.Height + borderWidth * 2)
Dim img As Bitmap = New Bitmap(newSize.Width, newSize.Height)
Dim g As Graphics = Graphics.FromImage(img)
g.DrawImage(original, New Point(borderWidth, borderWidth))
g.DrawRectangle(mypen, 0, 0, newSize.Width, newSize.Height)
g.Dispose()
Return img
End Function
I got this AppendBorder function from site http://vbcity.com/forums/t/163882.aspx
Happy Coding!
:)