|
How do I get the image width and height of a bitmap image?
tony-yeyo
|
|
|
|
|
Look at here: MSDN
Use Width and Height properties of the Bitmap class.
|
|
|
|
|
Hi,
I have got reportviewer working fine with a simple 5 line report BUT when I click on Print, the Windows Print Dialog box shows and then a variety of situations open up:-
The Page Range details don't show in the radio buttons section viz all pages selected pages.
Click Print and nothing happens.
Change printers back and forth then you get Printing Page 1 and then Page 2 of 2 - there's only one page and nothing gets printed anyhow.
Click Cancel and wait a few seconds and it cancels.
Try to Print the document again (not necessarily after any combination of the above) - works perfectly.
Any ideas?
Glen Harvy
|
|
|
|
|
Hi!
I have created a simple server application and now I'm trying to create
sensible UI for it. The problem is that I don't know how to send log-messages
from other classes(Server,ConnectionProcessor etc) to be printed in a
multiline textbox in the main form(ServerForm, which starts the server-thread and so on).
I have tried some things with delegates but without success. Here's a little
example of what I have tried:
public class Server{
public delegate void printMessage(string message);
public printMessage print;
public void test(){
print = new printMessage(new ServerForm().printMessage);
print("Message printed via delegate");
}
}
public class ServerForm{
//Some code...
public void printMessage(string message){
serverLogTextBox.Text = message;
}
}
Any ideas, suggestions and possible solutions are hugely appreciated.
Thanks in advance.
-K-
|
|
|
|
|
TikkuTakku wrote: print = new printMessage(new ServerForm().printMessage);
This means there's a ServerForm somewhere that will get this message, but it won't be the one you're using. You need to do this in reverse. The main form should set the delegate to a method in itself. Either way, you need to set it to the same instance of the class that you're actually running.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I still don't quite get it. Sorry
I mean, how do I get the other classes to use printMessage-method of that particula instance of ServerForm
-- modified at 8:23 Tuesday 22nd August, 2006
|
|
|
|
|
Either you need to pass this Object of UI to ur server. or create an even in the server class and register it in UI. so whenever server get some message trigger the event, in UI capture the event and print the message using eventarguments.
|
|
|
|
|
When you call new, you create a NEW class instance, and THAT class instance has a delegate attached to it. But it's NOT the instance that is being used by your program. You need to hook the delegate to the instance that is in use. You probably need to read up on what new does and what a class instance is, or at least how they relate to delegates ( a delegate gets hooked to one instance, not to all instances automatically )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
How to read a single element in DataGrid ?
Thanks in advance
|
|
|
|
|
try out
datagrid1[rowindex,columnindex].ToString();
rahul
|
|
|
|
|
How do I view a 2 pictures in 2 different windows at the same time?
tony-yeyo
|
|
|
|
|
place a picturebox on each window and use the "Image" property to select your picture.
All the best
Martin
|
|
|
|
|
Make them modeless ( show instead of showdialog ) so they are both responsive. More detailed info than what you've been given in the two responses you have would require more info about your situation.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have done a project in .net. I want that when a user tries to run the .exe, if it is already running then the same instance should be focused and no new instance should be creaed.
what to do please let me know
|
|
|
|
|
check out this code
string aModuleName = system.Diagnostics.Process.GetCurrentProcess.MainModule.ModuleName;
string aProcName = System.IO.Path.GetFileNameWithoutExtension(aModuleName);
if (system.Diagnostics.Process.GetProcessesByName(aProcName).Length>1)
{
Application.Exit();
}
Navin
|
|
|
|
|
You can use a Mutex. Here is a piece of code that shows how to do it:
In program.cs:
<pre>
private static System.Threading.Mutex _mutex;
private const string _mutexName = "Company_Product_MUTEX";
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Allow only one instance for this app to be active
try
{
//try to open existing mutex
_mutex = System.Threading.Mutex.OpenExisting(_mutexName);
if (_mutex != null)
return; //exit program;
}
catch
{ //There was no existing mutex so create mutex
try
{
_mutex = new System.Threading.Mutex(true, _mutexName);
}
catch { };
}
Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
/// do rest of the code, like Application.Run() etc.
}
static void Application_ApplicationExit(object sender, EventArgs e)
{
//Release Mutex
if (_mutex != null)
{
_mutex.ReleaseMutex();
}
}
</pre>
That should do the trick.
|
|
|
|
|
Create a Mutex in the very first instance and if it already exists, then just quit your application. Some pseudocode:
if(!Mutex.Exists("SomeName"))
{
Mutex.Create("SomeName");
}
else
{
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Single Instance[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
hi
i want to access the serial port to send or read data from that.
in this case i want to use Win API in my application.
my application is written in C#.net and .Net frame work version is 1.1
in this version the namespace SerialPort is not worked.
thatway i want use Win API's to communicate the serial ports.
and also list of Win API which are useful to communicates the serial ports in C#.Net
or any one can send some example programs the serial ports in c#.
plz help
G.Prem Kamal
|
|
|
|
|
You could download Reflector, search for the SerialPort class, and check (or copy / paste) the work Microsoft has done on the new class.
|
|
|
|
|
What's wrong with the answers you got below ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
They weren't serfed up on a golden platter.
|
|
|
|
|
I want to implement a chess game in C# and make it interoperable in J2EE too.
|
|
|
|
|
I look forward to reading your CP article. It will be interesting to say the least. J2EE is a web framework, and Java is a different language. How do you hope to achieve it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I want to write some Program which can control the behavior of Windows, things like Disabling Ctrl+Alt+Delete, hiding start menu. this stuff
so anyone can help me in this, or tell me where shall i start searching
|
|
|
|