|
Hi Mick,
actualy I must say, that I did no use the library myself, just googled it for you as an idea to easier find your way...
Probably you can try the .NET bindngs here[^] it says, that it is a continuation of the work on code project...
Good luck: Didi
P.S. Wo in Deutschland wohnst Du? Ich bin aus der Schweiz...
|
|
|
|
|
|
With some strong support I figured out the necessary changes. Here they are for others who might be interested:
1. The displayImage function has to be slightly changed: The former function 'MakePixelArray' has been replaced by a function that returns a byte array, holding 3 bytes for each pixel (RGB). As a consequence, the PixelFormat has to be adapted:
Public Sub DisplayImage(ByVal PicFile As FileInfo, ByVal ImageOffset As UInteger, ByVal Width As UInteger, ByVal Height As UInteger)
Dim arrayImage() As Byte = MakeRGBArray(PicFile, ImageOffset) <--- changed routine
Dim gch As GCHandle = GCHandle.Alloc(arrayImage, GCHandleType.Pinned)
Dim pBuf As IntPtr = gch.AddrOfPinnedObject
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
PictureBox1.Image = New Bitmap(Width, Height, 3 * Width, Imaging.PixelFormat.Format24bppRgb, pBuf) <--- changed pixel format
gch.Free()
End If
End Sub
2. MakeRGBArray reads a UInteger for each Pixel and swaps the bytes first. With a bit-mask and a bit-shifting operation, the padding of the Uinteger (32 bits for 3 * 10 bits RGB) is eliminated, the 10-bit-values read and converted to 8-bit:
Private Function MakeRGBArray(ByVal PicFile As FileInfo, ByVal ImageOffset As UInteger) As Array
Dim ft As FileStream = New FileStream(PicFile.FullName, FileMode.Open)
Dim brh As BinaryReader = New BinaryReader(ft)
ft.Position = ImageOffset ' start with first pixel after the header
Dim RGBArray(CInt((PicFile.Length - ft.Position) / 4 * 3) - 1) As Byte
For i = 0 To (RGBArray.Length - 1) Step 3
Dim buff As UInt32 = SwapDWORD(brh.ReadUInt32)
' bit-shifting operation
RGBArray(i) = (buff And &HFFC) >> 4
RGBArray(i + 1) = (buff And &H3FFFFC) >> 14
RGBArray(i + 2) = (buff And &HFFFFFFFC) >> 24
Next i
ft.Close()
brh = Nothing
ft = Nothing
Return RGBArray
End Function
Maybe it helps someone else. Special thanks to Moreno for the basic idea and perfect offline support!
|
|
|
|
|
hi guys,
im trying to develop an application in which i used a combobox and datagridview in visual basic. I want to clear old content of datagridview before i populate with new ones when combobox.selecteditem changes.i add data to datagridview manually(programmatically). I don't use datagridview datasource property.
when i tried to use datagridview1.rows.clear or dataset.tables.clear, it doesnot clear. rather it duplicates data by adding old and new data to datagridview.i searched on web but i couldn't find an answer, any help? thank you so much in advance for any help. My sample code looks like the following
DataGridView1.Rows.Clear()
c.da = New SqlDataAdapter(userdata,userconn)
c.da.Fill(c.ds, "usertable")
'c.ds.GetChanges()
c.custView = New DataView(c.ds.Tables("usertable"), "", "studid", DataViewRowState.CurrentRow For c.rowIndex = 0 To c.ds.Tables("usertable").Rows.Count - 1
Dim row0 As String() = {c.custView(c.rowIndex)("column1").ToString, c.custView(c.rowIndex)("column2").ToString, c.custView(c.rowIndex)("colum3").ToString, c.custView(c.rowIndex)("colum4").ToString}
With Me.DataGridView1.Rows
.Add(row0)
End With
Next
modified on Thursday, August 6, 2009 10:25 AM
|
|
|
|
|
Set the DataSource of the DataGridView to null.
You should update the Filter property of the BindingSource in the SelectedIndexChanged event of the ComboBox if you you have a single datasource and filtering out the records to display on the basis of the user selection.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
hi d@nish
i am not setting the data source of datagridview using the datasource property, rather i am setting manually(programmatically), so i can't use bindingsource control. sorry may be 'cause i am stupid.
|
|
|
|
|
Try Remove method of the datagridview row.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
thank u guys,
i got the solution to my problems
|
|
|
|
|
I was Completed my program. when I try to build setup package then below error was appeared now I can't run program please help me.
I copied from Error list Clip board. It not mention Line and Column.
The "ResolveComReference" task failed unexpectedly.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Server stack trace:
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Build.Framework.ITask.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
|
|
|
|
|
In my experience the quickest solution to problems like this, is to delete the setup project from your solution, and add a new one.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi All,
I have a question for Monitoring E-Mail Account (like : Gmail,Yahoo etc).
I wanaa try to monitor my E-mail Account and other Email account. How can it possible pls suggest ?
Thanks
If you can think then I Can.
|
|
|
|
|
What do you mean by monitor?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Here's a start[^]
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Hello everyone
this is my first time here and i am very new to VB
I have a temperature Sensor and i got that to work
but my question is how can i have it disply 1 number after the deciaml like this 25.5oC insted of 25.345oC
i have been all day on this and i just cant get this one please help
Thare is my code for the Temp Sensor
Private Sub phidgetIFK_SensorChange(ByVal sender As Object, ByVal e As Phidgets.Events.SensorChangeEventArgs) Handles phidgetIFK.SensorChange
Dim temperature As String
phidgetIFK.sensors(0).Sensitivity = 2 '
temperature = ((phidgetIFK.sensors(0).Value * 0.2222) - 61.111)
txtNumSensors.Text = temperature.ToString()
End Sub
Thanks in advance
Y
|
|
|
|
|
You can use the Format method on the string class to specify how many decimal places to use.
Dim strPrice As String = dblPrice.ToString("0.0")
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks for your help Christian
but i get a blue line under dblprice ???
do i put that with the code for the sencor or the text box code ??
i am usin Visual Basic 2008
Thanks
Y
|
|
|
|
|
Christian was just giving you an example. The blue line is because you apparently just copied the example code, but never determined the variable dblprice .
Anyway, forget that example, and adapt txtNumSensors.Text = temperature.ToString() in your own code to txtNumSensors.Text = temperature.ToString("0.0") , and Dim temperature As String to Dim temperature As Double
My advice is free, and you may get what you paid for.
|
|
|
|
|
I got My problem Solved
I want to Thanks Christian and Johan for your help
like i sayd i am very new to this but i have to start someware
i am almost done my Dummy book hehehe but i was getting frustrated
with this one
Agine Thanks Guys
Y
|
|
|
|
|
You're welcome.
The question you posted is exactly the kind of thing we are here to help with. If you are using a book (even VB for Dummies), and trying, then don't hesitate to ask any questions here on this board, even if you think they might be "stupid" questions (which they aren't).
Good luck.
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi,
I have a arraylist full of paths and want to show them in a treeview( like in Konqueror )
but I do not manage it.
An example:
Dir1/
Dir1/SubDir1/SubDir2/
Dir1/SubDir1/AnotherSubDir1/
Dir1/SubDir3/SubDir4/Subdir5/
Dir1/AnotherSubdir2/SubDir5/
They are no real directories
Please help!
Thanky very much!!!
modified on Wednesday, August 5, 2009 9:33 AM
|
|
|
|
|
Hi,
for each entry in the list, you must locate or create the items in the listview.
Here is the logic, with an example:
adding "Dir1/SubDir3/SubDir4/Subdir5/"
is Dir1 in the top level of the listview? yes, since you already did some entries.
is SubDir3 in the Dir1 level of the listview? no, so create it
is SubDir4 in the Dir1/SubDir3 level? no, so create it
etc.
Classes you will need include the System.IO.Path class to get path parts (alternatively you could use string.Split)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanky for your answer
but do you really write "listview"?
i guess you/i mean a treeview...
could you please give a piece of code
because i have some trouble finding the node where i have to add the new node
|
|
|
|
|
Hi,
I'm making an application which is supposed to be able to print sales statistics.
Any ideas on how to display the results from the query?
Ideally, the results shouldn't even be displayed in the application itself, only when the PrintPreviewDialog component is activated.
I could just input the results into a DataGridView but that doesn't look to good and I need to have the total sum of each column at the bottom of the column. I was thinking of exporting it to Excel but there must be a smoother way.
Any ideas?
All the best
|
|
|
|
|
If it is just for sake of prepare reports like thing, you can use SSRS.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
The thing is, I need to do it through the application, because the person using it will only be able to use the app, and not the DB.
|
|
|
|
|