|
Jose Vicente wrote:
lso, In the obj directorie, I found the outfut file of the project and the PDB file. I don't know why this directory is created. I would like to avoid this to be created.
It's created during the compile of your project and used for linking various parts of your project together in the final steps of creating your target executables. No, you can't stop it from being created.
Jose Vicente wrote:
Also I'm not sure where is placed really the ouput of the project, in the bin directorie, in the obj or in both.
In the bin folder, under either Debug or Release, depending on what configuration your compile is set for.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I've been working on a graphics editor application, and so far it's working nicely with 32bit bitmaps. The problem I'm getting now is that I'm stumped as to what to do with indexed images
The following code works happily with 32bit images:
Graphics G = Graphics.FromImage(xBmp);
Pen xPen = new Pen(xCurrentColor);
G.DrawLine(xPen, xStart, xEnd);
G.Dispose();
But fails on the first line with an indexed image (as apparently Graphics doesn't support indexed images)
Is there something alternate I can use, or am I going to have to implement something myself from scratch?
I've thought about making an internal copy of the bitmap that is 32bit, and then just converting it down to an indexed image when necessary, but I'd much rather work directly on the indexed image itself
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
According to MSDN you cannot use the FromImage method on a index image...
If the image has an indexed pixel format, this method throws an exception with the message, "A Graphics object cannot be created from an image that has an indexed pixel format."
What you can do is create a new image that is the same size as the index image, paint the index image into the nonindex image (u open the index image by using the Image.FromFile static method), make modifications, then save to indexed again.
|
|
|
|
|
Hi,
I'm trying to set up a POS (receipt) printer (Epson TM-T88III Thermal). Epson has a windows driver for it. I don't know too much about programming POS printers (new to C# too). Using Windows fonts are slow with this printer. How would I send text (use ANSI??) to the printer driver so that the internal (default) printer font would be used?
thanks,
Ron
|
|
|
|
|
|
Thanks Dave!
I really appreciate your help. Your link works great! Sorry about needing to be hand held here... if I want to send a ASCII command to the printer (ESC E 1) how would I do this. Add it to the string? Do I need to use <> or \ for the command?
this does not work:
string s = "<ESC E 1> Hello, this is a test";
thanks,
Ron
|
|
|
|
|
There is no translation done to the string that you send to the printer. This means that you cannot use any c# escape sequences and expect them to translate properly in your string. You'll have to build your print ESC sequences something like this:
StringBuilder EscE = new StringBuilder( {(char)27, "E"c, "1"c } );
String stringToSend = EscE.ToString() + "Hellow World!";
This code is NOT tested and not guaranteed to compile, but, you should get the idea from it. The first line constructs a new StringBuilder object from an array of 3 char values. The first, 27, is the ASCII code for ESC. The second line builds the string to send to the printer by prepending the text you want to send with the formatting command the printer uses. I used a StringBuilder in this example simply because it's a versatile solution when you have to start appending long strings of parameter values to your printer commands, such as binary data.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
anybody knows how i could create instances of controls (or usercontrols) at designtime.
At runtime its no problem, but i want to create instances at designtime (like the index value in visual basic)
thanks
mike
|
|
|
|
|
Your going to have to be a bit more clear as to what you mean.
At design-time, all you do is add your custom control to the Toolbox, then drag it to the Form as many times as you need.
To add your control, right-click in the Toolbox and pick "Add/Remove Items..."
There is no such thing as a control array in the .NET Framework. It must be simulated, but can only be done at run-time, not design-time. See Creating Control Arrays in Visual Basic .NET and Visual C# .NET[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you for reply and sorry my bad english,
i have about 60 controls in a form (its a touchscreen application) and i want to load values for different styles (backgroundcolor,...) from a mysql database.
my problem is to assign this database values to the controls. I think the easiest way ist to create a database with a id-number, and each id number (= control index) has a value for backcolor, textsize,.... and this values are loaded at startup in my control-array.
But the position and size of the controls should be set in design-time, because its much easier to create a good layout.
Or is it possible to access the control attributes and methods through a string variable, so i could use a database like this:
Name;color;textsize
button1;red;10
button2;blue;12
button2;green;10
......
Thanks
Mike
|
|
|
|
|
Wow, 60?! It can be done using the Form.Controls collection. You can specify the index on that collection, but your going to run into a couple of problems.
First, if you make change to the visual properties of most of your controls, you'll find that the method you want to use will be slow. Actually, any method will be slow... So try out your method first before you dump alot of time into depending on it. See if the performance is going to be acceptable for you.
Second, your database that hold all the changes in not going to be linked directly to your controls, so ANY changes to the controls on the form, like accidently deleting and readding a control, will change the index of the control. This will make future versions of your application a [explitive deleted] to write.
Instead of relying on the index of the control, what you might want to do is add data to the .Tag property of your controls that uniquely identifies each of them. Then, use that as an indentifier in your database with the changes to be made to them. When you need to make changes, you'll have to iterate through the controls, checking each controls .Tag property for the ID of the control you want, then make the change to it. This will be even slower that using the index method, but will be far more reliable when making changes to your form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you,
i think i try it with the tag property
greetings
mike
|
|
|
|
|
I have a ComboBox and I’m giving it a Class cCompany not just a string.
public class cCompany
{
public string sz_Name;
public string sz_Address;
public cCompany(string Name, string Address)
{
sz_Name = Name;
sz_Address = Address;
}
public cCompany(cCompany obj)
{
sz_Name=obj.sz_Name;
sz_Address = obj.sz_Address;
}
public override string ToString()
{
return sz_Name;
}
}
In the ComboBox one types the name of the company and there is a TextBox where one types the address.
My way of thinking is that this line
this.cbToCompany.Items[index].sz_Address=this.tbToAddress.Text;
should compile but the .sz_Address gives this error:
'object' does not contain a definition for 'sz_Address'
I’m a beginner C# programmer and until now I’ve found the language very intuitive. Pleas help.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
|
|
|
|
|
See u have sz_Address in the class onl. But that property not exist in the combobox item[index] property.
U can find it out more easyly. After tying this.cbToCompany.Items[index] whne u will press "." after that did u find sz_Address. if u'r finding it is ok. If not place
this.cbToCompany.Items[index].add=this.tbToAddress.Text;
i think this may work out.
Bye
Arun Kumar Sabat
|
|
|
|
|
The ComboBox.Items property is a ObjectCollection, so that this code snippet this.cbToCompany.Items[index] returns an instance of type Object. To use it the way you want you'll have to cast the instance first:
( (cCompany) this.cbToCompany.Items[index]).sz_Address=this.tbToAddress.Text;
If you use this be sure your ComboBox contains only instances of type cCompany cause otherwise an exception will be raised.
www.troschuetz.de
|
|
|
|
|
Thanks,
That worked perfactly!
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
12029 45 Street N.W.
Edmonton, Alberta, Canada T5W 2T7
Res. Ph: (780) 695.5589
Email: rhahn82@telus.net
|
|
|
|
|
Hi~
Can I export a class written in C++ in dll to C#? That means can I use the class C++ dll to declare objects in C#?
Thanks
|
|
|
|
|
Yes you can. This[^] should get you up to speed.
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
Actually it won't. Interop'ing native classes (i.e., not COM components) is not covered in the tutorial. There is some vague documentation in the CallingConvention enumeration, though.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
Next question is:
I found some stuff to enumerate the GAC, but what I want is something that looks more like VS's Add Reference dialog. There are two interesting things going on in this list:
1. It shows the path to the installed assembly, not the GAC path
2. It only shows assemblies relevant to the current compiler version.
How the heck does it do that? I've looked around for a couple months, off and on, and have never found the answer!
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
It has nothing to do with the GAC. See the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Stewart wrote:
See the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders.
I hope I'm not asking a really dumb question here--I have entries in that registry key, but there's no "data"--only folders with the names of the assemblies.
So, the question is, how do I take that information and obtain the actual assembly path?
Thanks!
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
Enumerate the sub-keys and grab the default value of each sub-key. Enumerate each directory to load the assemblies:
using System;
using System.IO;
using Microsoft.Win32;
class Test
{
static void Main()
{
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(
@"Software\Microsoft\.NETFramework\AssemblyFolders"))
{
foreach (string key in rk.GetSubKeyNames())
{
using (RegistryKey af = rk.OpenSubKey(key))
{
string dir = (string)af.GetValue(null);
if (Directory.Exists(dir))
{
Console.WriteLine("Enumerating \"{0}\"...", dir);
foreach (string file in Directory.GetFiles(dir, "*.dll"))
{
Console.WriteLine(file);
}
Console.WriteLine();
}
}
}
}
}
} If you want to check the version of the runtime the assembly uses, you could load it and see which version of mscorlib.dll is required. If this application will be running for a while (like Visual Studio), then you should consider creating a new AppDomain to do this since you cannot unload assemblies and don't want to have all those assemblies loaded for no reason.
Instead of loading the assemblies, you could also load the PE/COFF images and determine the information yourself. You could use IL Reader[^] (from Lutz Roeder, creator of .NET Reflector) to inflect what that could be and not load the assembly into an AppDomain at all.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|