Hey man I did not mean anything by it. I think AUGI is a great place and it would be great if everyone learning AutoCAD's API were all at the same place, but each fourm has a certian feel or vibe to it due to the member's and administraitor's. And people perfer certain one's
I know how annoying it is to find information on the API, a little snag that stops a project, or finding what to P/Invoke etc....... And most of the time it is from something simple but you can not find any documentation on it.
From your post It easy to tell that you eager and motivated to learn, and it was the wrong to go about it and i apoligize, but it was basiclly to tell you that if you can't get a answer here come ask it at the swamp, and there are plenty of people who would be glad to help out. Same goes for people at the Swamp I am sure when they can not find a answer there they come here because each forum is full of smart guys and gals.
Again I apologize and I will make sure you are able to get a image on a PictureBox because that is what is about helping each other learn.
Also I have messed around with Standard details library that fills a Listview on a tool pallete. Basiclly it will fill the Listview(if you are not fimiliar with a listview a generic way of explaining it would be the right side window of window explorer) and names the images by drawing name(minus the extension) and groups them under a title named by each Sub-Directory Name. You chose different views list,details etc....
When you double click it on a pic it will bring in all entities from that drawing in etc... with different settings to choose from. If this is something that would help.
I am not sure what type of applacation this is for but I would be glad to help out if need it because I will learn things from you and it is always better to get other's input.
I am not sure if you have VS2010 but I will load it up here. It would be Simple to change to VS2008
This would not be considered anything worth using for any buisness application due to no error handleing or that way it get's the files.....etc it was just to quickly fill a picture box with an image.
Anyways here is code behind the form. It is very basic. 95% of the code is handling the right click menu. And the bottom half is thumbnail reader class that fills another picture box.
You can use the thumbnail reader class outside of AutoCAD to get the Thumbnail. AutoCAD does not have to be installed to get Bitmap.
There are some other tricks to grabbing them so you can go another route
This will only work if you have the same name and settings on a form
Please reply back with anything you need help with
Code:
Imports System.IO
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.ApplicationServices.Application
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports System.Drawing
Public Class FillPictureBoxForm
Private Sub FillPictureBoxForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FillCombo()
End Sub
'Fills the Combo Box
Private Sub FillCombo()
''Because this method is called for differnt reasons
''and if you change
cboFileNmae.Items.Clear()
Dim rootFolder As String = My.MySettings.Default.RootFolder
If Directory.Exists(rootFolder) Then
If My.MySettings.Default.SearchSub Then
For Each dwgFile As String In Directory.GetFiles(rootFolder, "*.dwg", SearchOption.AllDirectories)
cboFileNmae.Items.Add(dwgFile)
Next
Else
For Each dwgFile As String In Directory.GetFiles(rootFolder, "*.dwg")
cboFileNmae.Items.Add(dwgFile)
Next
End If
End If
End Sub
'When the comboBox Changes It Changes the File Preview
Private Sub cboFileNmae_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFileNmae.SelectedIndexChanged
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''This gets the filename from the combobox
''Which is a terrible way to do it there are better ways
Dim fName As String = cboFileNmae.Text
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''This is the code that fills the pictureBox
Dim db As Database = New Database(False, False)
db.ReadDwgFile(fName, FileOpenMode.OpenForReadAndReadShare, False, "")
Dim tmbNail As Bitmap = db.ThumbnailBitmap
picBoxThumbnail.Image = tmbNail
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''' This is a call to the thumbnail reader you would need this one if you did not have autocad runnig
picBoxJGR.Image = ThumbnailReader.GetThumbnail(fName)
' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
#Region "ContextMenu" ''Code for Right Click Menu
'' Handle the the True and False Check Status whenever it is Opening
Private Sub ContexMenu_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContexMenu.Opening
TrueToolStripMenuItem.Checked = My.MySettings.Default.SearchSub
FalseToolStripMenuItem.Checked = Not TrueToolStripMenuItem.Checked
End Sub
''Code for Selecting Root Folder to Look in Dwgs
Private Sub SelectFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFolderToolStripMenuItem.Click
'' Save the settings this way so they persist and will save what
''folder you chose to be used next time you run autocad
If FBD.ShowDialog = Windows.Forms.DialogResult.OK Then
My.MySettings.Default.RootFolder = FBD.SelectedPath
My.MySettings.Default.Save()
FillCombo()
End If
End Sub
''If you set to true then will search all sub Directories of Root Folder
Private Sub TrueToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrueToolStripMenuItem.Click
My.MySettings.Default.SearchSub = True
My.MySettings.Default.Save()
TrueToolStripMenuItem.Checked = True
FalseToolStripMenuItem.Checked = False
FillCombo()
End Sub
''If you set to false then will not search all sub Directories of Root Folder
Private Sub FalseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FalseToolStripMenuItem.Click
My.MySettings.Default.SearchSub = False
My.MySettings.Default.Save()
TrueToolStripMenuItem.Checked = False
FalseToolStripMenuItem.Checked = True
FillCombo()
End Sub
#End Region
'''''''''''''''''''''''''''''''''''''''''''''''''''
End Class