Hi there, I am new to C# WinForm development.
I have a picturebox to preview solidworks(a CAD software) parts,
but this code cannot view the large-size files. For example, I can preview a 1,684k file smoothly. However, when I was trying to preview a 3,165k file the following EXCEPTION message poped up.
I don't know whether I express myself clearly, but please feel free to ask me if you have further questions. I can send my code to you for debugging.
Cheers!
--------------------My C# WinForm Code--------------------------------
private void Preview_Click(object sender, EventArgs e)
{
textBox3.Text = dataGridView1.SelectedCells[3].Value.ToString();
string STORAGE_NAME = textBox3.Text;
CompoundFile cf = new CompoundFile(STORAGE_NAME);
CFStream st = cf.RootStorage.GetStream("PreviewPNG");
byte[] buffer = st.GetData();
var ms = new MemoryStream(buffer.ToArray());
pictureBox1.Image = Image.FromStream(ms);
}
--------------------Exception Details--------------------------------
OpenMcdf.CFItemNotFound was unhandled
Message=Cannot find item [PreviewPNG] within the current storage
Source=OpenMcdf
StackTrace:
at OpenMcdf.CFStorage.GetStream(String streamName)
at CustomisedDesign.Form1.Preview_Click(Object sender, EventArgs e) in C:\Users\Bomiao\Documents\Visual Studio 2010\Projects\CustomisedDesign\CustomisedDesign\Form1.cs:line 519
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at CustomisedDesign.Program.Main() in C:\Users\Bomiao\Documents\Visual Studio 2010\Projects\CustomisedDesign\CustomisedDesign\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: