Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping
Form Mirroring, Flipping Form Mirroring, Flipping
Form Mirroring, Flipping
Go Back  Xtreme Visual Basic Talk > > > Form Mirroring, Flipping


Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2013, 01:31 AM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Question Form Mirroring, Flipping


Hi all, I would like to ask how to Horizontally flip a Vb form.

I'm developing a Visual Acuity System which required a mirror to reflect whatever shows on the screen. I wanna change all the contents on the forms to be horizontally inverted so that when using a mirror, everything will be readable.
The problem here is how to flip the forms. I did flipping PicBoxes, Labels, Images and etc. but still not ideal.

hope you guys could provide some ideas.

Thank you:
Reply With Quote
  #2  
Old 07-05-2013, 06:58 AM
AtmaWeapon's Avatar
AtmaWeaponForm Mirroring, Flipping AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Many video cards have this feature. It will be far easier to configure your computer to do this than to make Windows Forms do it.

On the other hand, it's /possible/ this is a built-in (but probably not intended) feature of WPF. I can't remember if there's a reflection transform, but there could be.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 07-05-2013, 08:42 AM
PlausiblyDamp's Avatar
PlausiblyDampForm Mirroring, Flipping PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

I think WPF will allow you to scale the Y axis by -1 to flip something vertically, I know this works with a VisualBrush but never tried it with an entire window.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #4  
Old 07-07-2013, 08:21 PM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Default

Quote:
Originally Posted by AtmaWeapon View Post
Many video cards have this feature. It will be far easier to configure your computer to do this than to make Windows Forms do it.

On the other hand, it's /possible/ this is a built-in (but probably not intended) feature of WPF. I can't remember if there's a reflection transform, but there could be.
thank you for the idea. my project going to be used in hospital, i have to find a way to display it horizontally inverted. FYI, NOT all the pages need mirror reflection, and this application is going to be made into a installation file. Hospitals do not use visual studio, my project going to be a software which is able to install and uninstall.
Reply With Quote
  #5  
Old 07-07-2013, 08:26 PM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Default

Quote:
Originally Posted by PlausiblyDamp View Post
I think WPF will allow you to scale the Y axis by -1 to flip something vertically, I know this works with a VisualBrush but never tried it with an entire window.
thank you for the idea but I want horizontally flip. I didn't use or try WPF before and I think WPF is not able to change the setting of this software permanently. BTW The hospital wants a complete installation file they expected the software to be fully functional.
Reply With Quote
  #6  
Old 07-08-2013, 12:32 AM
Gruff's Avatar
GruffForm Mirroring, Flipping Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Do you want to toggle from standard to mirror image and back?
Do you want this for any screen displayed?
If this is only one screen what makes up the window exactly? What controls are you using?
Can this be just an image or do the controls actually have to work in mirror mode?

Depending on your answers we can offer better advice.

One simple idea is to use a physical solution. flip your monitor around and point it at a mirror. Your patient looks in the mirror but has the keyboard and mouse facing him directly. Not high tech, but it would work. You could even build it into a box with both elements tilted at 45 degrees.

Another is to use a webcam. Many have a mirror image option.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 07-08-2013 at 12:44 AM.
Reply With Quote
  #7  
Old 07-08-2013, 01:57 AM
PlausiblyDamp's Avatar
PlausiblyDampForm Mirroring, Flipping PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Quote:
Originally Posted by WangCH View Post
thank you for the idea but I want horizontally flip. I didn't use or try WPF before and I think WPF is not able to change the setting of this software permanently. BTW The hospital wants a complete installation file they expected the software to be fully functional.
Horizontally would just be a matter of scaling the X axis by -1, this is a simple setting that could be changed either at design time for a particular window or at runtime - it wouldn't require visual studio to be installed for this to work.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #8  
Old 07-08-2013, 02:06 AM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Default

Quote:
Originally Posted by Gruff View Post
Do you want to toggle from standard to mirror image and back?
Do you want this for any screen displayed?
If this is only one screen what makes up the window exactly? What controls are you using?
Can this be just an image or do the controls actually have to work in mirror mode?

Depending on your answers we can offer better advice.

One simple idea is to use a physical solution. flip your monitor around and point it at a mirror. Your patient looks in the mirror but has the keyboard and mouse facing him directly. Not high tech, but it would work. You could even build it into a box with both elements tilted at 45 degrees.

Another is to use a webcam. Many have a mirror image option.
thank you Gruff.
This project consists of physical and programming design. I'm doing the Programming Part which is based on the physical design. This Project uses only one Monitor which places at the knee level of the patient, facing the mirror. The mirror is 2 meters away from the table where the monitor is placed and the patients seat behind it. There is an angle in their physical design, I think it was 30 degree to achieve a distance of 4 meters from patients eye to the screen itself. The Requirement was given by the Hospital as the Visual Acuity Room has limited space.

On my screen, there are logos, Titles, Instructions and images. I could only Flip the PiCBox so far. Doing Researches of flipping Label controls, Text Boxes etc.

The Idea is to inverse everything horizontally that showing on the screen, through a mirror that everything will be right and readable for the patients.
The Patient should read everything from the mirror instead of the screen.

the Attachment is an example of an inverted page for reference
Attached Images
File Type: bmp Inverse.bmp (909.7 KB, 10 views)
Reply With Quote
  #9  
Old 07-08-2013, 10:53 AM
Gruff's Avatar
GruffForm Mirroring, Flipping Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Sounds like WPF technology is what you want to use then. Winforms cannot do what you want out of the box.

The Microsoft Magnification API. (Which was written in WPF) can be full screen or a window. It can be set to a scale of 1:1. Its initialization requres a transform matrix.
My assumption is that you could alter the matrix to filp the image left to right.
http://msdn.microsoft.com/en-us/libr...spx#Initialize


It also has a cursor transform matrix so clicking can be mapped to the original screen. Be prepared for a lot of reading in the following link.

http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

I am not sure whether this would work or that it might turn out to be more trouble than just writing your app in WPF as others have suggested.

The last idea i had was a video hardware box that can flip your monitor left to right but they run about $ 1,000 US.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 07-08-2013 at 11:03 AM.
Reply With Quote
  #10  
Old 07-10-2013, 03:50 AM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Default

Thank you again Gruff!

I've tried to flip the buttons, images, and Labels separately. Re-orientate the locations to match the mirror image.

Here comes another problem, how to flip a text box and its input words?

I'll show some codes of how I flipped those picBox, buttons, and Labels.

For Buttons:

Private Sub Btn_Yes_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Btn_Yes.Paint
e.Graphics.ScaleTransform(-1, 1)

e.Graphics.DrawString("Yes", New Font("Arial", 36.0!, FontStyle.Bold), Brushes.Black, -175, 0)
End Sub

For PicBox: (Just the last line does the Flipping)

Me.PictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(((Screen_Width - 1280) / 2), 0)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size((Width_Ratio * 1280), (Height_Ratio * 260))
Me.PictureBox1.TabIndex = 36
Me.PictureBox1.TabStop = False
'added flip PictureBox1 by WCH on 9Jul13
Me.PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)

For Labelsinitialize the Label sizes and Input some Spaces for it to show, using _Paint event to input the word of the Labels)

Private Sub mirror_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Font = New System.Drawing.Font("Arial", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Label1.Location = New System.Drawing.Point(460, 182)
Label1.Name = "Label1"
Label1.Size = New System.Drawing.Size(250, 80)
Label1.TabIndex = 20
Label1.Text = " "
End Sub

Private Sub Label1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Label1.Paint
e.Graphics.ScaleTransform(-1, 1)

e.Graphics.DrawString("ID:", New Font("Arial", 36.0!, FontStyle.Bold), Brushes.Blue, -150, 0)
End Sub
--------------------------------------------------------------------------

Now i'm trying to figure out how to flip the text box and the words in it.

Hope to see suggestions from you guys.
Thank you!!!
Attached Images
File Type: png Flipped Retest View.png (408.2 KB, 6 views)
Reply With Quote
  #11  
Old 07-10-2013, 03:54 AM
WangCH WangCH is offline
Newcomer
 
Join Date: Jul 2013
Posts: 8
Default

Quote:
Originally Posted by Gruff View Post
Sounds like WPF technology is what you want to use then. Winforms cannot do what you want out of the box.

The Microsoft Magnification API. (Which was written in WPF) can be full screen or a window. It can be set to a scale of 1:1. Its initialization requres a transform matrix.
My assumption is that you could alter the matrix to filp the image left to right.
http://msdn.microsoft.com/en-us/libr...spx#Initialize


It also has a cursor transform matrix so clicking can be mapped to the original screen. Be prepared for a lot of reading in the following link.

http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

I am not sure whether this would work or that it might turn out to be more trouble than just writing your app in WPF as others have suggested.

The last idea i had was a video hardware box that can flip your monitor left to right but they run about $ 1,000 US.
Thank you again Gruff!

I've tried to flip the buttons, images, and Labels separately. Re-orientate the locations to match the mirror image.

Here comes another problem, how to flip a text box and its input words?

I'll show some codes of how I flipped those picBox, buttons, and Labels.

For Buttons:

Private Sub Btn_Yes_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Btn_Yes.Paint
e.Graphics.ScaleTransform(-1, 1)

e.Graphics.DrawString("Yes", New Font("Arial", 36.0!, FontStyle.Bold), Brushes.Black, -175, 0)
End Sub

For PicBox: (Just the last line does the Flipping)

Me.PictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(((Screen_Width - 1280) / 2), 0)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size((Width_Ratio * 1280), (Height_Ratio * 260))
Me.PictureBox1.TabIndex = 36
Me.PictureBox1.TabStop = False
'added flip PictureBox1 by WCH on 9Jul13
Me.PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)

For Labelsinitialize the Label sizes and Input some Spaces for it to show, using _Paint event to input the word of the Labels)

Private Sub mirror_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Font = New System.Drawing.Font("Arial", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Label1.Location = New System.Drawing.Point(460, 182)
Label1.Name = "Label1"
Label1.Size = New System.Drawing.Size(250, 80)
Label1.TabIndex = 20
Label1.Text = " "
End Sub

Private Sub Label1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Label1.Paint
e.Graphics.ScaleTransform(-1, 1)

e.Graphics.DrawString("ID:", New Font("Arial", 36.0!, FontStyle.Bold), Brushes.Blue, -150, 0)
End Sub
--------------------------------------------------------------------------

Now i'm trying to figure out how to flip the text box and the words in it.

Hope to see suggestions from you guys.
Thank you!!!
Attached Images
File Type: png Flipped Retest View.png (408.2 KB, 8 views)
Reply With Quote
  #12  
Old 07-17-2013, 09:28 AM
Gruff's Avatar
GruffForm Mirroring, Flipping Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Thought some more about a mirror image textbox...

If you used a mirror image font and set the textbox RightToLeft property to true
You should get a functional mirror image textbox

This will work for all the winform controls that have a RightToLeft property.
Which appears to be most of them.

For those controls which use the right and left arrow keys (Like the textbox.) you would have to override the keydown event and swap them
but that shouldn't be all that difficult.

Speaking of mirror image fonts I could not get any of the TTF files I downloaded to work with Visual Studio controls. Not sure why.

You might end up having to create your own mirrored font.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 07-17-2013 at 09:37 AM.
Reply With Quote
Reply

Tags
flip, forms, invert form, mirror


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping Form Mirroring, Flipping
Form Mirroring, Flipping
Form Mirroring, Flipping
 
Form Mirroring, Flipping
Form Mirroring, Flipping
 
-->