|
A PictureBox is not a control that holds an editable value. This means that it's only there to display things, and that's why it can't get focus.
Is there a reason why you are bound to a picturebox, or can you swap it for a UserControl? You can set a background-picture on those too, if I'm not mistaken
I are troll
|
|
|
|
|
 Thanks for the help
Here is the result
Public Class DiagonalDoubleTextBox
#Region "Declare"
Enum eDirection
LeftUp2rightDown
RightUp2LeftDown
End Enum
Dim _Direction As eDirection = eDirection.RightUp2LeftDown
Dim _clrDiaLine As Color = Color.Red
Dim _text() As String = {"U", "A"}
Dim _activeCell As Integer = 1
Dim _BackColor1 As Color = Color.White
Dim _Forecolor1 As Color = Color.Black
Dim _ForeColor0 As Color = Color.White
Dim bm00, bm10, bm01, bm11 As Bitmap
#End Region
#Region "Propertys"
Property BackColor1() As Color
Get
Return _BackColor1
End Get
Set(ByVal value As Color)
_BackColor1 = value
MyBase.Invalidate()
End Set
End Property
Property ForeColor0() As Color
Get
Return _ForeColor0
End Get
Set(ByVal value As Color)
_ForeColor0 = value
MyBase.Invalidate()
End Set
End Property
Property ForeColor1() As Color
Get
Return _Forecolor1
End Get
Set(ByVal value As Color)
_Forecolor1 = value
MyBase.Invalidate()
End Set
End Property
Property Direction() As eDirection
Get
Return _Direction
End Get
Set(ByVal value As eDirection)
_Direction = value
MyBase.Invalidate()
End Set
End Property
Property ColorDiagonalLine() As Color
Get
Return _clrDiaLine
End Get
Set(ByVal value As Color)
_clrDiaLine = value
MyBase.Invalidate()
End Set
End Property
Property Tekst(ByVal Index As Integer) As String
Get
Return _text(Index)
End Get
Set(ByVal value As String)
If value.Length > 1 Then value = value.Remove(2, value.Length - 1)
_text(Index) = value
MyBase.Invalidate()
End Set
End Property
#End Region
#Region "Handles"
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static b As Boolean
b = Not b
Select Case _activeCell
Case 0
Select Case b = True AndAlso Me.Focused
Case True
Me.BackgroundImage = bm01
Case False
Me.BackgroundImage = bm00
End Select
Case 1
Select Case b AndAlso Me.Focused
Case True
Me.BackgroundImage = bm11
Case False
Me.BackgroundImage = bm10
End Select
End Select
End Sub
Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
Me.Size = New Size(30, 30)
Me.BackColor = Color.Black
Me.BorderStyle = Windows.Forms.BorderStyle.Fixed3D
' Add any initialization after the InitializeComponent() call.
End Sub
#End Region
#Region "Protected Sub"
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
_text(Math.Abs(Not -_activeCell)) = e.KeyChar
MyBase.OnKeyPress(e)
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
Me.Width = Me.Height
MyBase.OnResize(e)
End Sub
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.PageDown Or e.KeyCode = Keys.PageUp Then
_activeCell = Math.Abs(Not -_activeCell)
End If
MyBase.OnKeyDown(e)
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim b As Bitmap = Me.BackgroundImage
Dim c As Color = b.GetPixel(e.X, e.Y)
If c.A = BackColor.A AndAlso c.B = BackColor.B AndAlso c.R = BackColor.R AndAlso c.G = BackColor.G Then
_activeCell = 1
Me.BackgroundImage = bm10
Else
_activeCell = 0
Me.BackgroundImage = bm00
End If
MyBase.OnMouseDown(e)
End If
Me.Focus()
End Sub
Protected Overrides Sub OnMarginChanged(ByVal e As System.EventArgs)
MyBase.Refresh()
MyBase.OnMarginChanged(e)
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
bm00 = sMakePictures(0, 0)
bm01 = sMakePictures(0, 1)
bm10 = sMakePictures(1, 0)
bm11 = sMakePictures(1, 1)
MyBase.OnPaint(e)
End Sub
#End Region
#Region "Functions"
Function sMakePictures(ByVal nCel As Integer, ByVal nBlinkOn As Integer) As Bitmap
Dim i As New Bitmap(Me.Width, Me.Height)
Dim g As Graphics = Graphics.FromImage(i)
If _Direction = eDirection.LeftUp2rightDown Then
Dim p() As Point = {New Point(0, 0), New Point(Me.Width - 2, 0), New Point(Me.Width - 2, Me.Height - 2)}
g.FillPolygon(New SolidBrush(_BackColor1), p)
p(1) = New Point(0, Me.Height - 2)
g.FillPolygon(New SolidBrush(Me.BackColor), p)
Else
Dim p() As Point = {New Point(0, 0), New Point(Me.Width - 2, 0), New Point(0, Me.Height - 2)}
g.FillPolygon(New SolidBrush(_BackColor1), p)
p(0) = New Point(Me.Width - 2, Me.Height - 2)
g.FillPolygon(New SolidBrush(Me.BackColor), p)
End If
Dim s As String = _text(_activeCell)
Dim SF As SizeF = g.MeasureString(s, Me.Font)
Dim r0 As Rectangle
Dim r1 As Rectangle
Select Case _activeCell
Case 1
If _Direction = eDirection.RightUp2LeftDown Then
r1.X = Me.Width - SF.Width - Me.Margin.Right
r1.Y = Me.Height - SF.Height - Me.Margin.Bottom
Else
r1.Y = Me.Width - SF.Height - Me.Margin.Right
r1.X = Me.Margin.Top
End If
Case 0
If _Direction = eDirection.RightUp2LeftDown Then
r0.Y = Me.Margin.Top
r0.X = Me.Margin.Left
Else
r0.Y = Me.Margin.Top
r0.X = Me.Width - Me.Margin.Right - SF.Width
End If
End Select
r0.Width = SF.Width
r0.Height = SF.Height
r1.Width = SF.Width
r1.Height = SF.Height
If _Direction = eDirection.RightUp2LeftDown Then
g.DrawLine(New Pen(_clrDiaLine), Me.Width - 1, 0, 0, Me.Height - 1)
g.DrawString(_text(1), Me.Font, New SolidBrush(_Forecolor1), Me.Margin.Left, Me.Margin.Top)
g.DrawString(_text(0), Me.Font, New SolidBrush(_ForeColor0), Me.Width - g.MeasureString(_text(1), Me.Font).Width - Me.Margin.Right, Me.Height - g.MeasureString(_text(1), Me.Font).Height - Me.Margin.Bottom)
Else
g.DrawLine(New Pen(_clrDiaLine), 0, 0, Me.Width - 1, Me.Height - 1)
g.DrawString(_text(0), Me.Font, New SolidBrush(_ForeColor0), Me.Margin.Left, Me.Height - g.MeasureString(_text(0), Me.Font).Height - Me.Margin.Bottom)
g.DrawString(_text(1), Me.Font, New SolidBrush(_Forecolor1), Me.Width - g.MeasureString(_text(1), Me.Font).Width - Me.Margin.Right, Me.Margin.Top)
End If
If nCel = 0 Then
g.DrawRectangle(New Pen(_clrDiaLine), r0)
If nBlinkOn = 1 Then g.FillRectangle(New SolidBrush(_clrDiaLine), r0)
Else
g.DrawRectangle(New Pen(_clrDiaLine), r1)
If nBlinkOn = 1 Then g.FillRectangle(New SolidBrush(_clrDiaLine), r1)
End If
Return i
End Function
#End Region
End Class
I'm not complete finish but this gives an idee
|
|
|
|
|
Looking good, I guess you're almost done?
Cool
I are troll
|
|
|
|
|
Now comes the big part: reversing the original code (already in vb.net 2003) with normal textboxes into this control
its a competition program AllPlayAll in a scare ex: 15 players agains each other that 225 controls for 30 players thats 900 controls plus all the labels normal textboxes and menus
download Here[^]">
My website
Again thanks for the help
|
|
|
|
|
|
Hi to all,
in my vb.net project i have so many flash files within the form (using axShockwave)
Currently I am running them by giving the full path.
But to make it run after the installation of my project also, what need to be done with the file path? I know I have to use application.startpath. But to which folder should I copy the files. and what should be the path exactly?
Same way can I do for my Crystal report files too?
Thanks a lot in advnance
I am a beginner
|
|
|
|
|
Now, there is a bit of a clue in the name application.startpat. Could it possibly be where the application starts from? Which is where you have installed it.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
thanks
But which folder I need to copy the files during deployment?
I am a beginner
|
|
|
|
|
How about the "Application Folder"??
|
|
|
|
|
I have a blog http://moviexbox.blogspot.com[^] I want to use mail 2 blogger feature to mail Images and content to It can any suggest a e-mail component in VB.Net that can help, I don't want to use SMTP Server and application should be able to work behind proxy/firewall.
|
|
|
|
|
Rajeev Dhiman wrote: I don't want to use SMTP Server
Then how is your mail supposed to get out into the world?? Without SMTP servers, you're pretty much out of business. Every library I've ever seen uses an SMTP server.
|
|
|
|
|
Rajeev Dhiman wrote: I mean, like .Net SMTP Component uses local SMTP Server
It uses whatever SMTP server you tell it to use, but it MUST use one. Every component/library I've seen requires an SMTP server somewhere in order to use it.
Rajeev Dhiman wrote: there are some alternates like chilkat components
It still has to put it's mail on a server somewhere (using SMTP) in order for the client to pick it up.
|
|
|
|
|
i am doing a project on keylogger in vb.net and i need help to make my user interface very nice to see.My colleagues have got very nice gui. As i'm new to vb.net i dont knw much about the flashing or other splash like things to do rather than basic controls.so please someone help me on this.
|
|
|
|
|
Use WPF[^]. You can build some great UI with it.
|
|
|
|
|
hello everybody..........I want to make a project in VB6.As input i will get a shape file (for eg. map of delhi etc.),longitude, latitude of any place on that map.I have to plot a point on that particular lon/lat.Can anybody help me in this regard........this is a totally new project to me so i need help in detail.....please help me .........
|
|
|
|
|
|
Look into Microsoft's Virtual Earth SDK. It might do what you want, but I don't know for sure, because I've never used it.
|
|
|
|
|
i want code click button and call dll file
in vb.net application
|
|
|
|
|
what is the problem? Elaborate your problem in detail
I think you want to call the function(or method) of a dll on the click event of button.
simply add the reference of dll to your project and use it.
|
|
|
|
|
JAS GIRI wrote: i want code
No spoon feeding is done here.
Try out something and if you get stuck then ask.
Time is the best teacher; unfortunately it kills all of its students.
जय हिंद
|
|
|
|
|
First, you haven't asked a question. You also haven't described any kind of problem, or provided any detail into what you have, and what's you've done.
If you want to call a function in a .DLL, there's two basic methods of going about it. Which one you use depends on the type of .DLL you're talking about.
If it's a normal library .DLL, you have to use P/Invoke. This means you better have the documentation on the .DLL so you can create a correct function header to use. Google for "Pinvoke vb.net" for millions of examples.
If it's a COM-based .DLL, it has to be registered properly, the you can open your project properties, click on the References tab, then add a COM reference to the .DLL. You can then use the objects exposed by that library just like you would normal .NET classes.
|
|
|
|
|
I want, I want, I want... can't hear it any more. Everyday the same morons coming here, saying "I want" like little children. I want you to go away and never come back!
Moron.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Hi All ,
I'm trying to develop a application in vb.net,
to send any file from my PC to any bluetooth enabled mobile,
in coverage area of bluetooth dongle(connect with my usb port).
(More then 1 mobile via loop in 1 go)
Is there any class or library in .net is available.
If you can give me some sample code or link of any article...that will be very helpful for me.
Thnx.........
Vijay Jain
|
|
|
|
|
...
Time is the best teacher; unfortunately it kills all of its students.
जय हिंद
|
|
|
|
|
|