|
|
Thanks, I was doing something similar to this. I was wondering if there was a more generic way. For example, is there some way to match any image type without actually having to specify the extention for each one? Someone told me doing "*/images" would work. Has anyone tried this?
|
|
|
|
|
Haven't tried that, but AFAIK it won't work. There is a way to search for different extensions, something like Directory.GetFiles("c:\test", "*.jpg;*.png") or something. Search google or codeproject, I'm sure it's listed somewhere.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
I don't think there is any way of identifying whether a file is an image file or not unless we know the datastructures used to save each type of the file. Images are just binary files. Graphic applications which support multiple image types know this. But such a component may not be available in the public domain. You may check GIMP project. But it will be a touch job.
|
|
|
|
|
Is there a way to alter the grid in a ListView to display multiline data. If I have something that is too large to display in the cell of the ListView grid is there a method of expanding the verticle size of the row displaying the data in a multilined format?
Frag
Try, Fail..Fail, Succeed
Tool Developer
Michigan, USA
|
|
|
|
|
You're not limited to just a single line. You'll have to create a custom class or derivative of an existing class to do what you want. You'll then need to override the OnPaint, OnPaintBackground, and OnSizeChanged methods. Use your own code to draw your custom item however you see fit.
|
|
|
|
|
Jiminy Xmas thanks.
I was hoping to find something in ListView instead of creating my own derived control. I guess it will work, but I will have to take a look at it. As I recall rewriting drawing methods is quite low level and fairly complex. Thanks for your idea. I will check it out.
Frag
Try, Fail..Fail, Succeed
Tool Developer
Michigan, USA
|
|
|
|
|
It's not "that" complex, really. And surely not "low level"
Google (and CodeProject) is your friend! You should be able to find the code you need somewhere.
|
|
|
|
|
Carl thanks. I will look for custom versions of the control that are available throuhg CodeProject. My biggest problem is that I am doing this as a favor to a coworker and they need some solution tomorrow. Thank you for your time.
Frag
Try, Fail..Fail, Succeed
Tool Developer
Michigan, USA
|
|
|
|
|
I am using:
Visual Studio 2003
C#
.NET
I have a program which uses a standard ListBox to display a list of text strings that are dynamically generated by the program, using data pulled from a database and export to a csv file, and also echoed to the listbox. Under certain circumstances, the text strings are so long that I get what looks like "word wrap" in the list box and the horizontal scroll bar positions incorrectly when I scroll horizontally beyond about half way across. When I debug, the text length in one case shows the longest text line length being loaded into the listbox as 8222 characters and the "MeasureString()" width value for it is 82596 px. Loading this value into the HorizontalExtent property seems to make no difference.
1. what could be happening here? Is it something that can be adjusted or is it a limitation of the listbox?
2. is there a limit to the maximum text line length displayable in a listbox?
3. if so, is this limit adjustable?
|
|
|
|
|
Hi,
I have an area on a form represented by a Rectangle, in this area i need to draw a piece of text which fills the area.
No problem so far, but here is the tricky bit, only the width of the area will get bigger when the form is re-sized, so when a form is resized the text font needs to get wider for each character but no bigger in height.
Is this possible, and if so what function, class do i need to use? I can't find anything.
Thanks in advance
Si
|
|
|
|
|
Simon Wren wrote:
Is this possible, and if so what function, class do i need to use?
You can use a Matrix transform before drawing the text. Eg to get text twice as wide.
g.Transform = new Matrix(2,0,0,1,0,0);
g.DrawText("foo");
Remeber to reset the matrix, if you want to do some further drawing.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
An easier solution is to use:
g.ScaleTransform(2, 1); this will resize the text drawn to 200% horizontally.
|
|
|
|
|
Hi. I have a project in vs 2003 (c#) and a class library that I developed in vs 2005 express (c#). I want to import the dll into my project but I can't.
When I try to import the dll I get "This is not valid assembly or com component..." and when I try to import the tlb file I get "Converting the type library to a .Net assembly failed. ...type library was exported from a CLR assembly and can not be re-imported...".
I've tried to build the library with "register for com interop" option but no change. I understand that this may be asking to much, but is it possible to use this library in a vs 2003 project?
|
|
|
|
|
|
Hi,
is there any way in c# to load a windows control library dll dynamically?
the purpose is that i want to make a view of some datamodel replaceable without recompiling the whole program, i.e. that you can specify the dll to use in a config file and the program automatically loads the new library instead of the orginal one.
of course all these libraries are inherited from the same interface, but i don't know how the concrete implementations and DLLs will look like, yet...
(just like LoadLibrary / GetProcAddress but for c# user controls)
thx!
daniel.
|
|
|
|
|
Look at the Assembly class. Specifically, Assembly.Load, LoadFIle, and LoadFrom. Beware that LoadWithPartialName is deprecated in .NET 2.0.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
I just had to do the same in VB.net, so here is a sample code:
<br />
Dim GUIAssembly As System.Reflection.Assembly<br />
Dim GUIType As Type<br />
<br />
'Get access to GUI assembly<br />
GUIAssembly = System.Reflection.Assembly.LoadFrom("YourdllNameHere.dll")<br />
GUIType = GUIAssembly.GetType("Namespace.ClassName") 'ClassName is a class derived from "YourBaseControl" (see below).<br />
'Create User Interface Object<br />
Dim userInterfaceControl As YourBaseControl<br />
userInterfaceControl = Activator.CreateInstance(GUIType)<br />
StoreControl(userInterfaceControl)<br />
|
|
|
|
|
Hello gurus,
I'd like to know if there is a method somewhere that check if a give path as a String is valid or not?
Best regards.
There is no spoon.
|
|
|
|
|
Why can't you just put it in a try/catch block
try
{
OpenPath(string p);
}
catch(System.FileNotFoundException e)
{
MessageBox.Show("Incorrect path,try another ?");
}
catch(System.Exception e)
{
MessageBox.Show(e.Message);
}
|
|
|
|
|
If you mean something like a file path, you could use:
if(System.IO.Directory.Exists([path string]))<br />
{<br />
}
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Try the following to see if the string could be a valid path:
using System.IO;
string folderPath = @"c:\windows\test;;;;;invalid\";
if(folderPath.IndexOfAny(Path.InvalidPathCharacters) != -1)
{
}
Then use
Directory.Exists(folderPath);
to see if the path exists on disk.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
Thank you very much
Exactly what I needed
Best regards.
There is no spoon.
|
|
|
|
|
Like are their any dll's i can import that have some function to do this.
|
|
|
|
|
I’m trying to make a cast between two classes like this
AcadEntity entity;<br />
…<br />
Autodesk.AEC.Interop.ArchBase.AecWall wall = (AecWall)entity;
First time I run this an TypeLoadException is thrown. The second time I run these lines it works and the wall instance works perfect. How come it fails the first time?
The Exception message looks like this:
Could not load type Autodesk.AutoCAD.Interop.Common.IAcadObjectEvents from
assembly Autodesk.AEC.Interop.ArchBase, Version=4.5.202.0, Culture=neutral,
PublicKeyToken=d672471c03b2c408
_____________________________
...and justice for all
APe
|
|
|
|