|
What Michael suggested is IMO the right approach:
1. create an empty Bitmap of the required size (alternatively load a background image from
a file)
2. get a Graphics object that provides access to that Bitmap
3. draw whatever you like to that Graphics (exactly as if you were painting to a window,
but this Graphics represents the memory-based bitmap)
4. finally save the Bitmap
If you want to show the final result on screen, you could use a PictureBox (set its Image
property) or just do Graphics.DrawImage() in the Paint handler of your Form, or some
other Control on it (I would use a Panel, I don't like PictureBox at all).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
JoeRip wrote: or do I still need to use a Graphics object, just to composite my text onto my background?
Yes
using (Bitmap newAlbumArt = new Bitmap(width, height, PixelFormats.Format24bppRgb))
{
using (Graphics gfx = Graphics.FromImage(newAlbumArt))
{
gfx.FillRectangle(Brushes.White, newAlbumArt.Width, newAlbumArt.Height);
gfx.DrawString("Album Title", x, y);
}
newAlbumArt.Save(path, ImageFormats.Jpeg);
}
|
|
|
|
|
Dear All i have a problem with .NET IDE that is all of my control i placed on my forms in ASP.NET web pages, they all are floating control means i could place them any where like control on VB.Net , and if i want to insert control with in a container then also the control behaves like the individuals. so plz help how to i solve the prob.
Thanks you
|
|
|
|
|
There's a property of the page which you can changed from Grid layout to Flow layout which will do what you want. But I can't remember what it's called.
|
|
|
|
|
|
I belive that the runtime is mostly C++, as for the base class libaries they are all C#.
|
|
|
|
|
Are you're looking for what technologies are used inside the framework? If so, there are a lot of different things being used.
The underlying "core" of the runtime (the JIT (Just In Time) compiler, global assembly cache (GAC), assembly loader (Fusion), the garbage collection system (GC) and memory management, plus some others) are all written in C/C++.
The Base Class Library (BCL) and Common Type System (CTS) are all written using managed code. However, a lot of these classes eventually make platform invoke (P/Invoke) calls into unmanaged code (generally the Win32 APIs). This is true even of the Windows Forms classes. This does mean that there is still some COM that ends up getting used, but I believe that it is not a lot.
|
|
|
|
|
I have written a class that allows our application to manipulate the default printer of a workstation. The code below works perfectly on WinXP but not on Win2000...
ManagementObjectSearcher search = new ManagementObjectSearcher("select deviceid from win32_printer where default = TRUE");
Any suggestions?
|
|
|
|
|
I can't seem to find anything on the net about how IPC remoting works. What is the role of the server? What is the role of the client? How does each get/set data in the shared class? What are the criteria for access? What is the meaning of liquid soap?!
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
So, john, which version are you using? VS2005/.net3.0 pretty much replaced the VS2003/Net2.0 remoting infrastructure with the WCF framework. The earlier remoting framework was more tightly coupled than WCF.
Generally speaking the server would be the class factory for the remoted class instances: clients would get remote instances from the server. (in WCF/SOA talk the server would provide services that the client was interested in using, rather than act as a class factory).
SOAP is just a protocol for messaging between web (or WCF) servers. The WCF uses a binary infoset implementation, previous (and all non-ms frameworks) use xml infoset based SOAP.
|
|
|
|
|
It's .Net 2.0, so no WCF. I'm going to try using a IPChannel.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm not sure this will answer your questions, but here goes.
Remoting works, more or less loosely described, by creating a proxy class as defined by an interface. Through a complicated .NET process, you can intercept the call to a method or property getter/setter (which are methods) and pretty much do anything you like, including serializing the object between a client and a server and executing the method remotely, as if the object were actually local to the client.
The role of the server is to instantiate one (and only one, in singleton mode) object, or, one (and every time one) object in "per call instance" mode. You have to be careful with these, as neither does what you want, usually, which is to have multiple instances for the lifetime of your choice. You therefore typically have a singleton factory class at the server that creates objects as you request them.
The data gets shared typically using .NET's binary formatter. Be careful of that. It's not meant for heavy work. It's slow and consumes lots of memory for large objects.
There are no restrictions to access, you just have to have the methods and getters/setters defined in an interface, and you work with the interface at the client.
Beware of problems with breaking the connection. It can take the OS up to 3 minutes to realize the port is no longer in use. In the meantime, you'll get "port is in use" exceptions if you try to restart the server.
You might look at my article on remoting[^] as it covers a lot of things.
Liquid soap? You mean "Simple Object Access Protocol"? Well, here's an article.[^] Maybe that helps. SOAP is used primarily by web services, I believe, over port 80. .NET remoting is not restricted to HTTP nor port 80.
Marc
|
|
|
|
|
The two apps will be on the same computer, so I was planning on just using a IPCChannel. The communication will be between an windows app (the server) and a service (the client). The server will post a delimited string, and the client will be checking the shared object every 5 seconds or so for a new string (comparing it against the last one it processed). My needs are (in my eyes) simple.
I just found a sample project on Tech Republic that I'm gonna check out.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: The communication will be between an windows app (the server) and a service (the client).
Hmmm. Usually, one uses the terms "service" and "server" together, and the terms "client" and "windows app" together. A remoting server is often implemented as a service. Are you sure you have these ideas right?
John Simmons / outlaw programmer wrote: My needs are (in my eyes) simple.
Yeah, that's quite simple, however, you're mixing concepts here. Remoting does not use shared memory. What you're describing sounds like you're thinking you could just set up a shared memory object between the two apps.
If you use remoting, then the delimited string would most likely use a property setter. In the implementing class, you could have an event fire to process the string, rather than using a timer to check if it's changed.
Marc
|
|
|
|
|
I was going to describe the processing logic and came to the realization that the service doesn't have to be (and maybe should NOT be) a service. It could be a GUI app or a console app.
In any case...
1) The server app waits for a file to be written.
2) When the file is done being written, the server app posts a delimited string in the shared object.
3) The service (or client app) polls the shared object until the string it retrieves in different from the last one it processed.
4) It processes the string, and then returns to polling the shared object.
Items of note:
The client processes the string (much)faster than the server can indicate that a new file is written (we're talking anywhere from 4-50gb file sizes).
The client needs to be able to handle the server not running at any given time.
I have some code written, but the server and client don't seem to be talking to each other. I'm going to move away from the client "service" paradigm for easier debugging and see what happens. Running as a service introduces security concerns on Vista that I may not be handling correctly.
I'll start a new message thread if I can't get it working.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: 1) The server app waits for a file to be written.
Not sure if I will be correct since the "where, how, by what, in response to what", a file is written I do not know, but...
John Simmons / outlaw programmer wrote: 2) When the file is done being written, the server app posts a delimited string in the shared object.
3) The service (or client app) polls the shared object until the string it retrieves in different from the last one it processed.
4) It processes the string, and then returns to polling the shared object.
It does not strike me that Remoting is the most appropriate solution for that scenario. Have you considered using message queues?
|
|
|
|
|
John Simmons / outlaw programmer wrote: polls the shared object
To reiterate, this doesn't seem like remoting is the right solution if you're using a shared object.
John Simmons / outlaw programmer wrote: I'm going to move away from the client "service" paradigm for easier debugging and see what happens.
Definitely. Setting something up as a service is the last thing on the todo list. Write is a console app or a winform app, as you suggested.
Marc
|
|
|
|
|
Well I am far from an expert, and worked only in 2.0 version, no WFC experience, but...
The server has the "real" object and the client gets a proxy. The framework takes care of all all the networking and marshaling. The only parts you have to take care of are authoring the class to inherit System.MarshalByRefObject and configuration and maybe a server process (you can use IIS to host as server). Unfortunately there are many choices which complicates trying to get your head around it. I followed the Remoting Chapter in a book that started with the simplest and worked up through I think all of them in complete executing examples.
So like the first example goes something like this:
1) you create a MarshalByRefObject class in an assembly project. (very little code)
with a simple method.
here is what I used
public string GetTime(string sid)
{
string sret = String.Format("{0}@{1}", sid, DateTime.Now.ToUniversalTime().ToString());
Console.WriteLine("NetTime.GetTime: {0}", sret);
return sret;
}
2) you create a Server process project (Console) that references the assembly from step #1,
sets up the Channel(s) (port and/or protocol)
and registers the class. (very little code)
and does ???? to keep executing of course.
3) you create or use a client process project to reference the assembly
the client code asks for the proxy instance by providing the Channel information. (very little code)
and finally having the proxy object, calls the method.
That example has all the channel information hard coded, then you do one that uses a config file to contain the channel information then you do one that uses IIS to host as the Server. All of these require very little code.
The book was "Professional C# 2005"
|
|
|
|
|
i am having problem while installing vs.net 2005 and sqlserver 2005. Problem is that vs installs dotnet framework 2.0 and after installation of that when i tried to install sqlserver 2005 that installs dotnet framework 2.0 beta. they both conflict with each other.
2ndly plz tell me how to check whether sqlserver 2000 is correctly installed because when i run my application it always gives sql connectivity error i.e under default setting sql server doesn't allow remote connections. i am using win xp service pack 2.
|
|
|
|
|
hi friend
what u have written confilict it is not possible
remove your sqlserver in your control panel and install the sqlserver 2005
it work perfectly
|
|
|
|
|
i am having problem while installing vs.net 2005 and sqlserver 2005. Problem is that vs installs dotnet framework 2.0 and after installation of that when i tried to install sqlserver 2005 that installs dotnet framework 2.0 beta. they both conflict with each other. 2ndly plz tell me how to check whether sqlserver 2000 is correctly installed because when i run my application it always gives sql connectivity error i.e under default setting sql server doesn't allow remote connections. i am using win xp service pack 2.
|
|
|
|
|
ManiMughal wrote: sqlserver 2005 that installs dotnet framework 2.0 beta
Then you are using a beta version of SQL Server 2005 - Please don't.
ManiMughal wrote: how to check whether sqlserver 2000 is correctly installed
I thought you said it was SQL Server 2005. SQL Server 2000 does not install any .NET framework.
ManiMughal wrote: when i run my application it always gives sql connectivity error
If you are giving the machine name in the connection string then you must enable TCP/IP connections.
|
|
|
|
|
Can i get/set the comments on latest version of VSSItem(Visual Source Safe Item(File), I know there is an interface "IVSSItem" through that i can checkin/checkout/label etc, but I couldn't find a way to get/set the comments of the latest version, is there any way?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
hi
how can I execute .Net programing on an OS that doesn't have .NetFramework!?
like win98!
|
|
|
|
|
Install .Net? .Net will install on windows 98.
There are commercial packages around that will allow you to run .Net apps without the framework installed but I belive these wont work on OS's that .Net doesn't support.
|
|
|
|