Nicosa

Hello Guys,
Does somebody know HOW to create a window which appearance not the magnification same as
window at windows magnifier program use visual basic


regards


Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Hello Guys,
Does somebody know HOW to create a form which appearance same as
form at windows magnifier program


regards




Re: Visual Basic Language How to make form same as magnifier windows

Ajay K. Singh

There are a cople of properties of form which you will need to set in order to get the similar appearance.

Try setting following properties 每

------------------------Code Start-----------------------------------------

Dim pt As Point

pt.X = 0

pt.Y = 0

Me.Location = pt

Me.StartPosition = FormStartPosition.Manual

Me.ControlBox = False

Me.TopMost = True

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None

--------------Code End---------------------------------------------------------

I hope this helps.

-Ajay

--------------------------------------

www.componentone.com

-------------------------------------





Re: Visual Basic Language How to make form same as magnifier windows

John Oliver (UK)MSP, VSIP

Hi Ajay,

I think the OP may also want to know how to create a magnifier type of window.

Regards,

John






Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Dim pt As Point
pt.X = 0

message error with blue cursor at 0(null)
compiled error :
invalid outside procedure

hello Ajay, i need your advice for that matter!!!!

thank you




Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Hello John,

no, i donot wanto to know how to create magnifier but concern with how to create the frame/window that appear make all icon on desktop drag down so the icon do not close with the window. do you know how, Jhon

regards




Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Ajay K. Singh wrote:

There are a cople of properties of form which you will need to set in order to get the similar appearance.

Try setting following properties 每

------------------------Code Start-----------------------------------------

Dim pt As Point

pt.X = 0

pt.Y = 0

Me.Location = pt

Me.StartPosition = FormStartPosition.Manual

Me.ControlBox = False

Me.TopMost = True

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None

--------------Code End---------------------------------------------------------

I hope this helps.

-Ajay

--------------------------------------

www.componentone.com

-------------------------------------



Dim pt As Point

pt.X = 0

message error with blue cursor at 0(null)
compiled error :
invalid outside procedure

hello Ajay, i need your advice for that matter!!!!

thank you




Re: Visual Basic Language How to make form same as magnifier windows

Riquel Dong 每 MSFT

Hi Nicosa,

I am not surely that I understand your question. Just based on your post, I think that you need to have magnifier functionality in your form.

You can create a customized control. It inherits from the Panel control. We override the CreateParams property so that we can set the control's style. For magnification, this control uses very simple logic as , whenever you draw an image of small size on bigger canvas, it looks like magnified although the quality is not very good. Here is the code snippet to create a control with magnifier functionality. You can drag and drop this control to the form, but you need to ensure that that form has a background image. This control comes from the Writing Movable Transparent control with Magnifier functionality. I convert it to vb.net code and make a little change. You need to use vbc.exe to compile this file as a dll. Hope this helps.

Code Block

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Windows.Forms
Namespace TransControl
Public Class TransControl
Inherits System.Windows.Forms.Panel
Private components As System.ComponentModel.Container = Nothing
Private topBorder As New Label()
Private leftBorder As New Label()
Private bottomBorder As New Label()
Private rightBorder As New Label()
Public XOffset As Integer = 0
Public YOffset As Integer = 0
Private MagnificationFactor As Integer = 1
Public Property pMagnificationFactor() As Integer
Get
Return MagnificationFactor
End Get
Set(ByVal value As Integer)
If (value >= 1) Then
MagnificationFactor = value
End If
End Set
End Property

Private x As Integer
Private y As Integer
Private pleft As Integer
Private ptop As Integer
Private isMouseDown As Boolean = False
Public Sub New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If components IsNot Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or 32
'WS_EX_TRANSPARENT
Return cp
End Get
End Property

#Region "Component Designer generated code"
Private Sub InitializeComponent()
Me.Name = "TransControl"
Me.Controls.Add(topBorder)
Me.Controls.Add(rightBorder)
Me.Controls.Add(leftBorder)
Me.Controls.Add(bottomBorder)
AddHandler Me.MouseDown, AddressOf this_MouseDown
AddHandler Me.MouseMove, AddressOf this_MouseMove
AddHandler Me.MouseUp, AddressOf this_MouseUp
AddBorders()
End Sub
#End Region

Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
AddBorders()
End Sub

Protected Overloads Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
pevent.Graphics.DrawImage(Me.Parent.BackgroundImage, New Rectangle(0, 0, Me.Width, Me.Height), New Rectangle(Me.left + XOffset, Me.top + YOffset, Me.Width / MagnificationFactor, Me.Height / MagnificationFactor), GraphicsUnit.Pixel)

End Sub

Protected Sub this_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
If isMouseDown Then
Me.left = Me.left + (e.X - x)
Me.top = Me.top + (e.Y - y)

'Refresh the parent to ensure that whatever is behind the control gets painted
'before we need to do our own graphics output.
Me.Parent.Refresh()
End If
End Sub

Protected Sub this_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
x = e.X
y = e.Y
pleft = Me.Left
ptop = Me.Top
isMouseDown = True
Me.Cursor = Cursors.SizeAll
End Sub
Protected Sub this_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
isMouseDown = False
Me.Cursor = Cursors.Default
Me.Refresh()
End Sub
Private Sub AddBorders()

topBorder.Location = New Point(0, 0)
topBorder.Size = New Size(Me.Width, 10)
topBorder.BackColor = Color.Black

leftBorder.Location = New Point(0, 0)
leftBorder.Size = New Size(1, Me.Height)
leftBorder.BackColor = Color.Black

rightBorder.Location = New Point(Me.Width - 1, 0)
rightBorder.Size = New Size(1, Me.Height)
rightBorder.BackColor = Color.Black

bottomBorder.Location = New Point(0, Me.Height - 1)
bottomBorder.Size = New Size(Me.Width, 1)
bottomBorder.BackColor = Color.Black
End Sub
End Class
End Namespace

Best regards,

Riquel






Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Riquel Dong 每 MSFT wrote:

Hi Nicosa,

I am not surely that I understand your question. Just based on your post, I think that you need to have magnifier functionality in your form.

You can create a customized control. It inherits from the Panel control. We override the CreateParams property so that we can set the control's style. For magnification, this control uses very simple logic as , whenever you draw an image of small size on bigger canvas, it looks like magnified although the quality is not very good. Here is the code snippet to create a control with magnifier functionality. You can drag and drop this control to the form, but you need to ensure that that form has a background image. This control comes from the Writing Movable Transparent control with Magnifier functionality. I convert it to vb.net code and make a little change. You need to use vbc.exe to compile this file as a dll. Hope this helps.

Code Block

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Windows.Forms
Namespace TransControl
Public Class TransControl
Inherits System.Windows.Forms.Panel
Private components As System.ComponentModel.Container = Nothing
Private topBorder As New Label()
Private leftBorder As New Label()
Private bottomBorder As New Label()
Private rightBorder As New Label()
Public XOffset As Integer = 0
Public YOffset As Integer = 0
Private MagnificationFactor As Integer = 1
Public Property pMagnificationFactor() As Integer
Get
Return MagnificationFactor
End Get
Set(ByVal value As Integer)
If (value >= 1) Then
MagnificationFactor = value
End If
End Set
End Property

Private x As Integer
Private y As Integer
Private pleft As Integer
Private ptop As Integer
Private isMouseDown As Boolean = False
Public Sub New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If components IsNot Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or 32
'WS_EX_TRANSPARENT
Return cp
End Get
End Property

#Region "Component Designer generated code"
Private Sub InitializeComponent()
Me.Name = "TransControl"
Me.Controls.Add(topBorder)
Me.Controls.Add(rightBorder)
Me.Controls.Add(leftBorder)
Me.Controls.Add(bottomBorder)
AddHandler Me.MouseDown, AddressOf this_MouseDown
AddHandler Me.MouseMove, AddressOf this_MouseMove
AddHandler Me.MouseUp, AddressOf this_MouseUp
AddBorders()
End Sub
#End Region

Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
AddBorders()
End Sub

Protected Overloads Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
pevent.Graphics.DrawImage(Me.Parent.BackgroundImage, New Rectangle(0, 0, Me.Width, Me.Height), New Rectangle(Me.left + XOffset, Me.top + YOffset, Me.Width / MagnificationFactor, Me.Height / MagnificationFactor), GraphicsUnit.Pixel)

End Sub

Protected Sub this_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
If isMouseDown Then
Me.left = Me.left + (e.X - x)
Me.top = Me.top + (e.Y - y)

'Refresh the parent to ensure that whatever is behind the control gets painted
'before we need to do our own graphics output.
Me.Parent.Refresh()
End If
End Sub

Protected Sub this_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
x = e.X
y = e.Y
pleft = Me.Left
ptop = Me.Top
isMouseDown = True
Me.Cursor = Cursors.SizeAll
End Sub
Protected Sub this_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
isMouseDown = False
Me.Cursor = Cursors.Default
Me.Refresh()
End Sub
Private Sub AddBorders()

topBorder.Location = New Point(0, 0)
topBorder.Size = New Size(Me.Width, 10)
topBorder.BackColor = Color.Black

leftBorder.Location = New Point(0, 0)
leftBorder.Size = New Size(1, Me.Height)
leftBorder.BackColor = Color.Black

rightBorder.Location = New Point(Me.Width - 1, 0)
rightBorder.Size = New Size(1, Me.Height)
rightBorder.BackColor = Color.Black

bottomBorder.Location = New Point(0, Me.Height - 1)
bottomBorder.Size = New Size(Me.Width, 1)
bottomBorder.BackColor = Color.Black
End Sub
End Class
End Namespace

Best regards,

Riquel



Hello Riquel,
Btw thank you for your advice. and may be i have to clear about my question what i want.
i want create the window how it can appear on the desktop (not the magnification functionality ) the window make icon move down so the window doesnot close the icon. please Riquel, i need your help!

Best regards
Nicosa




Re: Visual Basic Language How to make form same as magnifier windows

Riquel Dong 每 MSFT

Hi Nicosa,

Do you mean you need to create a form and this form hasn't the control box If you need to create a form, the form's size can't be changed and the form hasn't the control box. You can set Form.ControlBox = False, Form.MaximumSize = Form.Size and Form.MinimumSize = Form.Size to implement this functionality. If you have any further questions, please tell me.

Best regards,

Riquel






Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

Hi again Riquel,

i will describe step by step about the form what i want to create but i need your participant.
first of all, i wish you use windows for your computer OS, and if you click :
Start>Program>Accessories>accessibility> and finally you run magnifier program, and on the screen we can see
magnifier settings and we can see presentation box, in that box has check boxes (eg.invert colors,start minimized, and SHOW MAGNIFIER). if we check SHOW MAGNIFIER check box we will see a window or a frame (where we can see all object become bigger in that frame or window) appear above the desktop and it make the desktop or screen or monitor hight smaller than before. and if we click and hold it on the frame, it will appear "click and drag the window to make it float.

that window is what i want to create Riquel! and i need your advice please..


sincerely


nicosa




Re: Visual Basic Language How to make form same as magnifier windows

PEng1

Just set the FormBorderStyle = None

Then of course you will have to set the size, location, and background of the form to obtain your desiered result.






Re: Visual Basic Language How to make form same as magnifier windows

Nicosa

hello ALL....
does it create use API direct X