|
Sorry, no idea. As I said you need to talk to the person who wrote the code.
|
|
|
|
|
Ok thanks ...i will try..i just would like to know how to select the input source device...i think is just what misses in my new project....now im trying to make a sound recording..but i would like to record mic,line in and if possible desktop sounds..
|
|
|
|
|
I took also a look onto the Code and I can't aslo not find a Property like requested by you.
For me the posted Code is incomplete and also not able to make any recording.
So you really have to ask the person who has written this code for a complete Code ... or you should look anywhere else for Code which matches to your requirement ...
|
|
|
|
|
hey guys...can anyone tell me how to chnage the highlight color for my listbox?
i tried some google snippets but no luck...
Thanks!!
|
|
|
|
|
|
hi..yes im using this code:
<pre> Private Sub ListBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ListBox1.DrawItem
If ListBox1.SelectedItem <> "" Then
e.DrawBackground()
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
e.Graphics.FillRectangle(Brushes.Red, e.Bounds)
End If
Using b As New SolidBrush(e.ForeColor)
e.Graphics.DrawString(ListBox1.GetItemText(ListBox1.Items(e.Index)), e.Font, b, e.Bounds)
End Using
e.DrawFocusRectangle()
End If
End Sub
but it seems that the items text are not appearing in the right color..only when i click them...
this is hard to explain...
|
|
|
|
|
I have just tried it with the MSDN code in the link I gave you and it seems to work - with one correction. The following block:
If ((e.State And DrawItemState.Selected) = DrawItemState.Selected) Then
e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.Bounds)
Else
is missing the parentheses around e.State And DrawItemState.Selected .
|
|
|
|
|
i changed the color to white and it shows only white rectangles but no text!!!..i wish i can put an image or video..sometimes one image worths more than a thousand words!!
|
|
|
|
|
OK..i went a bit foward..it is formating but when i load my files they do not appear in the listbox..i have to click the listbox to show the files loaded..
|
|
|
|
|
When i load the files into the listbox nothing shows but if i click where the items should be they appear with the formated style
|
|
|
|
|
i think is because im starting with an empty listbox...as i said...when i load the files they do not show..but..if i click where they were supposed to be they show with the different highlight color (red for ex)...
|
|
|
|
|
Here is a complete sample to do what you need:
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing
Module FormMain
Public Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New LbForm)
End Sub
End Module
Public Class LbForm
Inherits System.Windows.Forms.Form
Private Sub InitializeComponent()
ListBox1 = New System.Windows.Forms.ListBox()
TextBox1 = New System.Windows.Forms.TextBox()
CopyBtn = New System.Windows.Forms.Button()
SuspendLayout()
ListBox1.Name = "ListBox1"
ListBox1.Location = New System.Drawing.Point(33, 44)
ListBox1.Size = New System.Drawing.Size(200, 200)
ListBox1.TabIndex = 0
ListBox1.FormattingEnabled = True
ListBox1.ItemHeight = 16
ListBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple
ListBox1.Sorted = True
ListBox1.BorderStyle = BorderStyle.FixedSingle
ListBox1.DrawMode = DrawMode.OwnerDrawVariable
ListBox1.ClearSelected()
TextBox1.Name = "TextBox1"
TextBox1.Location = New System.Drawing.Point(253, 44)
TextBox1.Size = New System.Drawing.Size(200, 200)
TextBox1.TabIndex = 2
TextBox1.Multiline = True
CopyBtn.Name = "CopyBtn"
CopyBtn.Location = New System.Drawing.Point(206, 272)
CopyBtn.Size = New System.Drawing.Size(75, 23)
CopyBtn.TabIndex = 1
CopyBtn.Text = "Copy"
CopyBtn.UseVisualStyleBackColor = True
AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Font = New System.Drawing.Font("Calibri", 10.0)
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Name = "LbForm"
ClientSize = New System.Drawing.Size(486, 314)
Controls.Add(ListBox1)
Controls.Add(TextBox1)
Controls.Add(CopyBtn)
Text = "ListBox Sample"
ResumeLayout(False)
PerformLayout()
End Sub
Private WithEvents ListBox1 As ListBox
Private WithEvents TextBox1 As TextBox
Private WithEvents CopyBtn As Button
Public Sub New()
InitializeComponent()
GetFileNames()
End Sub
Private Sub GetFileNames()
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = ".\"
openFileDialog1.Filter = "VB.NET Files (*.vb)|*.vb|All files (*.*)|*.*"
openFileDialog1.FilterIndex = 1
openFileDialog1.Multiselect = True
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
For Each fname in openFileDialog1.SafeFileNames
ListBox1.Items.Add(fname)
Next
End If
End Sub
Private Sub CopyBtn_Click(sender As Object, e As EventArgs) Handles CopyBtn.Click
Dim lblist As StringBuilder
lblist = New StringBuilder
For Each name As String In ListBox1.SelectedItems
lblist.AppendLine(name)
Next
ListBox1.ClearSelected()
TextBox1.Text = lblist.ToString()
End Sub
Private Sub ListBox1_DrawItem(ByVal sender As Object, _
ByVal e As DrawItemEventArgs) Handles ListBox1.DrawItem
If ((e.State And DrawItemState.Selected) = DrawItemState.Selected) Then
e.Graphics.FillRectangle(Brushes.Yellow, e.Bounds)
Else
e.Graphics.FillRectangle(Brushes.Beige, e.Bounds)
End If
e.Graphics.DrawRectangle(Pens.Blue, e.Bounds)
e.Graphics.DrawString(ListBox1.Items(e.Index), Me.Font, _
Brushes.Black, e.Bounds.X, e.Bounds.Y)
e.DrawFocusRectangle()
End Sub
Private Sub ListBox1_MeasureItem(ByVal sender As Object, _
ByVal e As MeasureItemEventArgs) Handles ListBox1.MeasureItem
e.ItemHeight += 5
End Sub
End Class
I took some of the code from the link to the MSDN documentation that I provided in an earlier message. The basic idea is that it gets a list of filenames and populates the ListBox with them. You can then test the selection of individual items, and how to process the resulting set.
|
|
|
|
|
~well...theres a lot of code here i do not need...i guess im gonna quit this highlight thing..i cannot make it work..Thanks anyway!
|
|
|
|
|
All you need to do is copy the code for the ListBox1_DrawItem subroutine, since that will work for any ListBox. But more importantly you should work on actually understanding the code, rather than just using Copy and Paste, as I already suggested.
|
|
|
|
|
so..i used the code for draw item and it returns this error
System.ArgumentOutOfRangeException:
Nome do parâmetro: index
in this line
e.Graphics.DrawString(ListBox1.Items(e.Index), Me.Font, _
Brushes.Black, e.Bounds.X, e.Bounds.Y)
like i said i think is because im using an empty listbox...it does not finds the index
|
|
|
|
|
OK, I did not code for that. Just add the following at the beginning of the DrawItem subroutine:
If (e.Index < 0)
Exit Sub
End If
Just another example of why you need to understand the basics and not just rely on blindly using Copy & Paste.
|
|
|
|
|
It worked.. thanks..i now apply the same code to the combobox but the button for dropdown list seems to be different...is there a way to customize it?
|
|
|
|
|
Sorry, I don't understand what you mean.
|
|
|
|
|
The combobox dropdown button changes style when i set the draw mode to ownerdrawfixed/variable....i wish to know if there is a way to change its style or color? Thanks....
I do not remember these properties in Visual Basic 6...but i do not code since 2004
|
|
|
|
|
I don't know I am afraid. Maybe the documentation will help.
|
|
|
|
|
Ok thanks...is already good as it is
|
|
|
|
|
I would like to show you my app...but the forums do not allow images nor videos much less links to exe files....
|
|
|
|
|
Member Alienoiz wrote: but the forums do not allow images nor videos And for very good reasons. There is already far too much spam dumped here.
|
|
|
|
|
Well...i think the thing is complete...its an mp3 tagger..loads and saves the most common tags in mp3s..it has save and clear tags features...you can choose which tag you want to write...it also has a mass edit option and i added file operations like rename, copy, move and delete file!!
|
|
|
|
|
im using gray for my forecolor...but it seems it only displays gray color when i click the list item..is like they were hidden..if i click an item then the forecolor will be gray and the back highlight color red...else the items do not show gray color..
|
|
|
|