|
Hello all,
Quick problem. I've got a Bitmap.
Bitmap bit = new Bitmap(this.GetType(),"bitmap.bmp");
This loads the bitmap ok. Now, I wanna add some text to it and save the added text to the bitmap itself for later use. I can't use OnPaint or anything like that.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Jonny Newman wrote:
Now, I wanna add some text to it and save the added text to the bitmap itself for later use.
By "save it for later use", do you mean physically save it back to disk in the file or just modify it for late use in the currently running instance of your program? I do not think you can modify a resource and then save it back into the executable or DLL on the fly. But I suppose I could be wrong, it has happened before
If you only wish to modify for use during the current instance and lose all changes when you shut your app down, you can use the Graphics class and its paint methods.
Example:
Bitmap bit = new Bitmap(this.GetType(),"bitmap.bmp");
using(Graphics g = Graphics.FromImage(bit))
{
g.DrawString("Some String Here",myFont,myBrush,myPointF);
}
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Nathan Blomquist wrote:
If you only wish to modify for use during the current instance and lose all changes when you shut your app down, you can use the Graphics class and its paint methods.
Thats the one I meant
Nathan Blomquist wrote:
g.DrawString("Some String Here",myFont,myBrush,myPointF);
This doesn't work, I don't know why....it only load up the original bitmap...
Rectangle rect = new Rectangle(this.Location.X + 87,this.Location.Y + 11,150,36);
string show = author.ToString();
g.DrawString(show,new Font("Arial",13),new SolidBrush(Color.Red),rect);
...
this.img = bit;
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Never mind, i've fixed it now.
Cheers anyway.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
In our application, we use system environment variables in our project properties in order to redirect our output files. It is done this way so not every developer and the build machine are bound to have the same absolute path.
We do this, for C++ projects, the following way: In the Project Properties, we set Configuration Properties -> General -> Output Directory to $(MyBuildDir)\Debug, for instance, and MyBuildDir resolves to c:\MyBuilds. This works very well with C++ projects, using VS.NET.
Recently, we added a C# project to our build process for this application. But setting the Ouput Directory with an environment variable, the environment variable does not get expanded and it creates a directory literally named $(MyBuidDir)\Debug under the project directory and puts the files there.
Why does this does not work like with VC++.NET? Is it because environment variables don't work with C# builds?
|
|
|
|
|
Hi Michel,
have you found a solution? We're facing the same problem
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
in my application i would like to get the PID of the current process, does any one know how i can do this?
Thanks
Tim
|
|
|
|
|
System.Diagnostics.GetCurrentProcess().Id
|
|
|
|
|
i dont have GetCurrentProcess in the Diagnostics namespace.
Any ideas why its not there? am i calling it from the wrong place?
|
|
|
|
|
System.Diagnostics.Process.GetCurrentProcess().Id
|
|
|
|
|
Thanks very much thats got it
|
|
|
|
|
I have the Struct:
public struct Base
{
public string Name;
public string Phone;
}
public struct Operator
{
public int ID;
public Base[] OperatorData;
}
I want to populate a repeater with 2 collumns(Nome,Phone).
The following code doesn´t work.
rpt.DataSource = Operator.Dados;
rpt.DataBind();
In aspNet
<%# DataBinder.Eval(Container.DataItem,"Name") %>
<%# DataBinder.Eval(Container.DataItem,"Phone") %>
Please, help me.
How can I populate the repeater with a array of Struct ?
Thanks.
Pablo Rodrigo
|
|
|
|
|
(Hello Paresh! I'm sure you will answer...)
For simple things, DataBinding is a cool thing; Now I saw that there is a easy property to bind a DataSource with a key in the datatable:
list.DataSource=m_workset.Projekte;
list.DisplayMember="projekttext";
list.ValueMember="projektid";
Looks good but I didn't find how to get then this Value out of an item - say by double-click on an item.
Does anybody knows hot to get this valuemember out of an listboxitem?
Thanks!
Stefan
|
|
|
|
|
I hope this is wath you mean...
textBox1.Text = list.SelectedValue; or...
textBox1.Text = list.SelectedValue.ToString();
now you have 'list.ValueMember' in textBox1 or any other control or variable you may have, i hope this helps.
Signature hmmmmm.....
I look for it at home.... tomorrow.
|
|
|
|
|
Thank you. Yes, was what I meant.
|
|
|
|
|
Does anyone know how to reference to an assembly which is generated in memory from another assembly also generated in memory (compilerParameters.GenerateInMemory = true)?
|
|
|
|
|
Hi!
I have a multi file assembly that exists of two modules and a .dll that contains the manifest. If I add a reference to the manifest dll into my c# project, I can access the types within the modules, however they are not shown in the intellisense window.
Is there any way to make them appear in the intellisense window?
Thanks in advance!
- Andre
|
|
|
|
|
Hmm... they are shown for me... are you adding the projects to the same solution? I am
|
|
|
|
|
Huh? Which version are you using?
I have two c# module that I compile from the command line using /target:module, lets say part1.module and part2.module. Then I use al.exe to create a manifest for these two modules (foo.dll).
If I add foo.dll to the references list (only the file foo.dll, no projects), I don't see any of the types of the modules. However, I can use the types and compile the program.
I got a post in microsoft.public.dotnet.languages.csharp that this is a known limitation (or bug if you want so).
It would have been *sooo* nice
- Andre
|
|
|
|
|
I have the following problem :
- I devellop new inheriteded forms (visulally) , from a base form. The base form already contains some controls , among others some buttons. This works fine, but when I try to resize the new form , and I build the project, the Visual Studio designer just moves my bottons to the right . If I relocate the buttons, the same happes : they just don't want to stay put.
Different people told me they have the same problem , but didn't find a solution. Can anyone help ?
|
|
|
|
|
I need to compare content of two data fields of the same "unknown" type.
Here's the code example that doesn't work because it compare objects instead of data fields.
protected bool CompareRows(DataTable WorkDataTable, int ColumnIndex, int RowIndex_A, int RowIndex_B)<br />
{<br />
if (WorkDataTable.Rows[RowIndex_A][ColumnIndex] == WorkDataTable.Rows[RowIndex_B][ColumnIndex]) return true;<br />
else return false;<br />
}
So what I need is explicit type casting, but as the data type of the column is unknown it must be done on the runtime.
Therefore my question is: Is it possible to cast types on the fly?
Can I use DataType property of the DataColumn for type casting? How?
Any suggestions (other than .ToString() conversion)?
|
|
|
|
|
Thomas,
The Convert.Equals() method should do the trick for you here. As in the following:
DataTable Table = new DataTable();
Table.Columns.Add(new DataColumn("Test1", System.Type.GetType("System.DateTime")));
Table.Columns.Add(new DataColumn("Test2", System.Type.GetType("System.DateTime")));
DateTime s = DateTime.Now;
DataRow r = Table.NewRow();
r["Test1"] = s;
r["Test2"] = s;
Table.Rows.Add(r);
bool s = Convert.Equals(Table.Rows[0][0], Table.Rows[0][1]);
if(s)
{
return true;
}
else
{
return false;
}
Hope this helps.
|
|
|
|
|
Thanks Don
It works fine for current purpose.
But would still wanna know if it's possible to cast types on the fly using Sytem.Type object or some adequate property.
If someone know the asnwer please share it.
Thanks.
|
|
|
|
|
We intend to give our Assembly out side our group and it'll be used in any .NET application including ASPX and ASMX.
To restrict unauthorized use of this Assembly, it will demand a X509 certificate through PublisherIdentityPermission.
We want to handle distribution process in the following way.
1. Sign the Assembly which we want to give out side our group with a Certificate.
2. We will also sign caller assembly/application with the same Certificate, there by authorizing them to use our assembly.
3. Callers will Assert PublisherIdentityPermission before making actual call to our assembly (to stop the stack-walk as any upstream apps do not need to be signed), See sample code at the end.
As far as the choice between PublisherIdentityPermission Vs StrongNameIdentityPermission, we decided to go with PublisherIdentityPermission.
Because we felt it’s easy to work with certificates.
If someone could validate our thoughts, that would be great.
Sample Code Snippets
OurAssembly.dll Code
namespace Microsoft.MSCOM.MemberServices.Samples.PublisherIdentityAssembly {
[PublisherIdentityPermissionAttribute(SecurityAction.Demand, CertFile="ramCertificate.cer")]
public class ModuleClass {
public void ModuleMethod() {
Console.WriteLine("PONG: from ModuleMethod in myModule.");
}
}
}
CallerAssembly.dll Code
namespace Microsoft.MSCOM.MemberServices.Samples.PublisherIdentityCaller {
public class CallerAssemblyClass {
public void AssemblyMethod() {
X509Certificate cert = X509Certificate.CreateFromSignedFile("CallerAssembly.dll");
PublisherIdentityPermission pip = new PublisherIdentityPermission (cert);
pip.Assert();
ModuleClass mod = new ModuleClass();
mod.ModuleMethod();
Console.WriteLine("Reverting Assert.");
CodeAccessPermission.RevertAssert();
}
}
}
|
|
|
|
|
How do I create a XML as an attribute or component of a object in C#?
|
|
|
|