|
Don't post the same question multiple times. It'll just piss people off and get you ignored.
|
|
|
|
|
This works:
<br />
<br />
Private Sub cmdPlay_Click()<br />
Const ksBSlash As String = "\"<br />
Dim sFilespec As String<br />
<br />
' Note: This code requires the: WindowsMediaPlayer activex (wmp.dll)<br />
' first add it to resorces then add it to a form as an activex componet.<br />
<br />
' cboTuneLU has these fields:<br />
' ID <br />
' Filename<br />
' Path<br />
<br />
On Error GoTo ERR_cmdPlay_Click<br />
<br />
' Get the path & filename from cboTuneLookup<br />
sFilespec = Me.cboTuneLU.Column(2) & ksBSlash & Me.cboTuneLU.Column(1)<br />
Me![WindowsMediaPlayer7].openPlayer sFilespec<br />
<br />
EXIT_cmdPlay_Click:<br />
Exit Sub<br />
ERR_cmdPlay_Click:<br />
'Debug.Print CStr(Err) & " " & Err.Description<br />
ShowError "frmLyrics.cmdPlay_Click"<br />
Resume EXIT_cmdPlay_Click<br />
<br />
End Sub<br />
|
|
|
|
|
Hi guys, i just started to learn some things on VB, so now i came up with this question, i'll appreciate your help.
|
|
|
|
|
Considering you can't "run" data, you're question doesn't make any sense.
You might want to describe in more detail exactly what you're trying to do.
What application type are you talking about? Windows Forms? WPF? ASP.NET? MVC?
|
|
|
|
|
I'm making this project for school class, it's like an online store, where you have videogames, movies or smartphones to buy, and i wanted to play a music while the program is running, is that possible ?
|
|
|
|
|
Yeah, you already have the code to do it.
But keep this in mind. How many sites have you gone to that are worth anything that have background music playing all the time?? NONE! It just pisses people off.
Also, does it add any value to your application that will give you a better grade? Probably not...
|
|
|
|
|
with out WAV file.using text how to generate voice in visual basic6.0 please tel the coding
|
|
|
|
|
|
|
Search for Microsoft Agent, and text to speech engine
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
I have been banging my head on this for several days now. I wanted to have a better looking flat combobox and be able to change the button color. I also wanted to remove the highlighting that occurs after an item is selected. What I came up with works, until visual styles is enabled. When visual styles are enabled, the text in the textbox area of the combobox either gets painted over, or not drawn at all. I could disable visual styles, but I would rather not have to do that as it just seem like a band-aid to fix an issue that I feel should not be happening. I tried disabling visual styles using SetWindowTheme, but that does not seem to work. I was hoping someone out there might notice what I am doing wrong.
Here is the code:
Public Class UMSComboBox : Inherits ComboBox
Friend Declare Unicode Function SetWindowTheme Lib "UxTheme.dll" _
(ByVal hwnd As IntPtr, _
ByVal pszSubAppName As String, _
ByVal pszSubIdList As String) As Integer
Public Property ButtonColor() As Color
Get
Return _ButtonColor
End Get
Set(ByVal Value As Color)
_ButtonColor = Value
Me.Invalidate()
End Set
End Property
Private _ButtonColor As Color = SystemColors.Control
Public Property HighlightColor() As Color
Get
Return _HighlightColor
End Get
Set(ByVal Value As Color)
_HighlightColor = Value
Me.Invalidate()
End Set
End Property
Private _HighlightColor As Color = SystemColors.Highlight
Public Sub New()
MyBase.New()
Me.DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
SetStyle(ControlStyles.ResizeRedraw, True)
SetStyle(ControlStyles.Selectable, True)
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
SetStyle(ControlStyles.UserPaint, True)
End Sub
Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
g.FillRectangle(New SolidBrush(Me.BackColor), Me.ClientRectangle)
ControlPaint.DrawBorder(g, Me.ClientRectangle, Me.ForeColor, ButtonBorderStyle.Solid)
Dim rect As Rectangle = New Rectangle(Me.Width - 12, 0, 12, Me.Height)
g.FillRectangle(New SolidBrush(_ButtonColor), rect)
ControlPaint.DrawBorder(g, rect, Me.ForeColor, ButtonBorderStyle.Solid)
Dim pth As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath()
Dim TopLeft As PointF = New PointF(Me.Width - 10, CSng((Me.Height - 5) / 2))
Dim TopRight As PointF = New PointF(Me.Width - 3, CSng((Me.Height - 5) / 2))
Dim Bottom As PointF = New PointF(Me.Width - 6, CSng((Me.Height + 2) / 2))
pth.AddLine(TopLeft, TopRight)
pth.AddLine(TopRight, Bottom)
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
g.FillPath(New SolidBrush(Me.ForeColor), pth)
End Sub
Protected Overrides Sub OnDrawItem(e As System.Windows.Forms.DrawItemEventArgs)
If e.Index < 0 Then Exit Sub
Dim rect As Rectangle = e.Bounds
If Me.DroppedDown Then
If CBool(e.State And DrawItemState.Selected) Then
e.Graphics.FillRectangle(New SolidBrush(_HighlightColor), rect)
Else
e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), rect)
End If
Else
e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), rect)
End If
Dim itemtext As String = Me.Items(e.Index).ToString
Dim b As New SolidBrush(Me.ForeColor)
e.Graphics.DrawString(itemtext, e.Font, b, e.Bounds, StringFormat.GenericDefault)
End Sub
Protected Overrides Sub OnHandleCreated(e As System.EventArgs)
MyBase.OnHandleCreated(e)
Me.FlatStyle = Windows.Forms.FlatStyle.System
SetWindowTheme(Me.Handle, String.Empty, "COMBOBOX")
End Sub
End Class
|
|
|
|
|
Hello !
I have a control ( for example a button , or a textbox ... or something else ) that has the focus.
I want to detect when the user click outside this control.
The click may be :
- On another control that can get focus ( for example a textbox... ).
- On another control that can't get focus ( for example a panel...)
- On the form.
Is there any general method to detect this scenario : A control has the focus, the user click outside.
Thank you !
|
|
|
|
|
|
any of these event doesn't do what I want.
Because if a control has the focus , and user for example click to a panel that can't get focus , the control remain focused , so I can't use any of these events.
|
|
|
|
|
You could add a click handler to every control on the form and then you would know whenever any control is clicked outside of the one that has the focus.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'm thinking that is there any general way to capture a mouse click ( not click events for a control ) and to calculate if was not inside a specific control ?
|
|
|
|
|
Not everything is that easy.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
How about the events MouseEnter and MouseLeve, I'm sure you can build some logic you want out of that.
|
|
|
|
|
Well, it is not easy to see what problem you are trying to solve. Maybe you should write some test code with all these events wired up and see which comes closest to doing what you want.
|
|
|
|
|
what about windows Messages to intercept the click ? it's possible this ?
the problem I want to solve is this :
When a control has focus and the user click outside , I want to run some code related to the control.
|
|
|
|
|
It depends where the user clicks, which is why you have those events. You really need to study the documentation a bit more, and also do what I suggested and try some testing of your own. And remember, all these events are triggered by mouse move, click, keyboard, etc., in the first place.
|
|
|
|
|
dilkonika wrote: what about windows Messages to intercept the click ? it's possible this ? You cannot intercept clicks in other applications. Another application would also be "outside the control". You'd need a mouse-hook.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm interesting only about clicks outside the control but inside my application.
|
|
|
|
|
dilkonika wrote:
I'm interesting only about clicks outside the
control but inside my application. Aight, next problem; you won't get any mouse-events on the forms that are currently showing a modal form. You can only get the ones for the active forms (active modal and modeless).
It feels like adding an "end of editing" event - but the default way to do so is by checking the focus, not where the user clicks. Can you provide more context?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
ok but how to resolve the problem when user click on a control that can't get focus , so the control doesn't loose the focus , but the user has clicked outside ?
|
|
|
|