Hi,
I am having trouble with a timer application i am making. I need to make the form central to the x axis, wahtever the resolution, but the y axis must always be at "0".
Also, i would like to change the blinking cursor which you type from in a text box to a green square instead of the traditional line. any helop on this would be appreciated.
Any Help would be good
Thanks
Jamie

Form Questions
maverick_majnoo
If e.KeyCode = Keys.Enter Then
'--- Verify if contents are OK, something like this:
If IsNumeric(TextBox1.Text) Then Me.Close()
End If
End Sub
YMaod
I see what you mean, I have set up the timer but the trouble is that in the code above, where it says mcaretbmp=, I have used a picture from My Resources because that was easier for me to get it how I wanted at the time, however is I have to use the original method that is fine...
So I was just wondering, using what I have, if you could give me a bit more info on what to put in the tick event, and also if I need to use the other method, how to do it this way in a bit more depth.
Thanks
Jamie
MJAnderson
Thank you for all your help with all of the questions, I just have one other:-
Above you helped me to make the cursor into a green square - I was wondering if there was any way to make it fade in instead of just appear - its probably not possible but I was just wondering ---
Thanks for all your help
Jamie
Mark Macumber
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = New Point((Screen.PrimaryScreen.Bounds.Width - Me.Width) \ 2, 0)
End Sub
Q2:
Declare Function CreateCaret Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal hbmp As IntPtr, ByVal width As Integer, ByVal height As Integer) As Boolean
Declare Function ShowCaret Lib "user32.dll" (ByVal hwnd As IntPtr) As Boolean
Private mCaretBmp As Bitmap
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
With TextBox1
Dim blob As Size = TextRenderer.MeasureText("X", .Font)
mCaretBmp = New Bitmap(blob.Width, blob.Height)
Dim gr As Graphics = Graphics.FromImage(mCaretBmp)
Dim br As New SolidBrush(Color.FromArgb(255, 255, 0, 255))
gr.FillRectangle(br, mCaretBmp.GetBounds(GraphicsUnit.Pixel))
CreateCaret(TextBox1.Handle, mCaretBmp.GetHbitmap, blob.Width, blob.Height)
ShowCaret(TextBox1.Handle)
br.Dispose()
gr.Dispose()
End With
End Sub
Put the mCaretBmp creation code in the FormLoad event for efficiency...
ihackdw
Thanks alot, that really helped, just one other question...
I would like to be able to press any return button on a form and it will check if the text box has the right phrase in it, and then close the form, so basically, i want the text box to submit, like it would with an ok button, but without a button and just when you press enter, if you know what i mean!
bola shokry
MsgBox(
"Test was part of the text") Me.Close() End If End If End SubBurt Harris
tradle
Thibaud
ClaudiaHelpOnVSTO
This should work for your 1st question.
Public
Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim r As Rectangle = My.Computer.Screen.WorkingArea Dim m As Integer = CInt((r.Width / 2) - Me.Width / 2) Me.Location = New Point(m, 0) End SubEnd
Class