|
The short answer is no, there isn't any way to redirect the chart output to a control in your application.
The long answer is kind of, but it is so over the top complicated as to make it not worth the effort at all. Excel can provide data, but it's horrible at providing graphics.
The best solution is to just get a graphing library and setup the chart in your own application.
|
|
|
|
|
When you copy an Excel chart to the ClipBoard, it gets stored in the ClipBoard using a dozen different formats, including PNG, GIF, Bitmap, and EnhancedMetafile; which means any .NET app can retrieve it as an Image or Bitmap and work with that.
So start by using Office Interop (don't ask me for details, I don't know; Google and CodeProject do know) and have it copy the chart for you. Then write some code to paint the image where you need it.
|
|
|
|
|
I you intention is to display graphs/charts then you can achieve this by using the free library shipped with .Net 4.0. have look
Happy Coding
|
|
|
|
|
I need to write some linq to sql statments for sql server 2008 r2 database that accomplishes the following tasks in a C# 2010 .net application:
1. I need to delete one row from a table where the record I would be deleting is the key to the table called main.
2. I also need to delete records from an associated table (called sub) that has the key to the main table as one of its columns. This table called sub has no foreign key constraints setup as a requirement to the table called main. In the table called sub there can be from 1 to 500 occurences of the reference to the table called main.
3. I am not certain how to setup these two deletes? Would this be separate linqs statements? would I need two separate DeleteOnSubmit statements? Would I wrap the two delete statements into one transaction so that if there is a problem, I can rollback the changes?
Can you tell me and/or point me to a reference on how to complete this task?
|
|
|
|
|
Hi,
Basically I want to press a keyboard combination and have the screenshot sent via http to a server. During my research I was astounded of the complexity of even creating a keyboard shortcut which involved low level programming. Can you point my in the right direction in terms of libraries and technologies? To accomodate the workflow I want to be able to press the key combination anywhere from Windows and the application should then subsequently automatically send the picture via an HTTP POST request to a server.
Regards Anders
|
|
|
|
|
This[^] might help you getting the keyboard hook in place. In order to capture the screen, you might find this[^] helpful.
|
|
|
|
|
And finally you could use the WebRequest class to POST it to a server. Mind you, you probably will need some authentication to avoid the server being susceptible to all kinds of attacks...
There are several articles and tips around here that could help you, like maybe this one: Accessing the secured site using Webrequest[^]
|
|
|
|
|
mupersan wrote: During my research I was astounded of the complexity of even creating a keyboard shortcut which involved low level programming.
- Go to your desktop
- Create a shortcut to "C:\Windows\calc.exe"
- Right-click on the shortcut, select "Properties"
- Type in your favorite shortcut
- Click on the "OK" button
Bastard Programmer from Hell
|
|
|
|
|
yep, that is known as a low level of programming...
|
|
|
|
|
I want to create a method that checks to see if a row or a table is currently locked in SQL Server ..
I want the method to accept a table name and key and then return true or false.
The only thing I can't seem to understand is what code do I write or how do you check to see if a table or row is locked in SQL Server ????
Thanks in advance ..
GBX ..
|
|
|
|
|
The first question is WHY?
The record state can change between the time you look at its state and the time the state is returned back to the client. Every time you look at the record state, the information is already out of date.
|
|
|
|
|
yeah good point .. thanks ..
jon
|
|
|
|
|
It's just not worth the effort.
Simply handle Exceptions when they happen.
|
|
|
|
|
I have an interesting requirement and was wondering if anyone might be able to point me in a direction that could get me started.
I've developed an application that is used on many workstations in the company and all access the same database. From time to time I see little issues in the DB that I can't figure out how a user might have managed to make the particular change. It might be a bug in my code but it's such a difficult issue to debug as I usually can't even replicate the problem.
So I was wondering if it would be possible to write some or other function that is called every time the user clicks on any control on the form. This procedure then stores the name of the control, the date and time and perhaps even the coordinates of the click (or something like that) to a List which can then either be written to a local log file or to some table in the DB. This way I'd be able to see exactly the sequence of clicks that preceded a certain change in the DB.
The problem is, the application is huge and I don't want to go add a line of code that calls this function at the start of every OnClick() event handler. Is there a way I could have my function called for every click that happens on any control in any form in the application before the relevant OnClick() event handler is called?
Any ideas on alternative approaches that might help me track the users' mouse clicks would also be very welcome.
|
|
|
|
|
Dewald wrote: Any ideas on alternative approaches that might help me track the users' mouse clicks would also be very welcome.
To start off; not every user uses the mouse. I'm using a keyboard simply because it's faster to hit a shortcut then it is to find the cursor, point to mouse to a specific region and click twice. And again, because the first mouse-click wasn't registered.
What you'd like to trace, are the methods that are being executed. It sounds like PostSharp[^] could be helpful here.
A lightweight solution would be to iterate through all the components of a form, and register an extra handler for the most interesting events, and log those.
Bastard Programmer from Hell
|
|
|
|
|
OK, that sounds like a good approach. Thanks. I'll investigate that.
|
|
|
|
|
You're welcome
|
|
|
|
|
To start off; not every user uses the mouse.
This is true but buttons and menu items still fire 'click' events even if you select them with the keyboard (and, personally, I'd recommend you do this with any custom controls you write that have an action on click, too).
|
|
|
|
|
BobJanova wrote:
This is true but buttons and menu items still fire 'click' events even if you select them with the keyboard (and, personally, I'd recommend you do this with any custom controls you write that have an action on click, too).
Yup - but I still see a lot of buttons that only react on their Control.MouseClick event - just wanted to touch the subject to ensure that it's not overlooked
Bastard Programmer from Hell
|
|
|
|
|
hi...i am using rdlc report in c#.net 3.5 and vs2008.
i want to enter a page break after a group...plz help me i use page break at end property but its not working fine.report generates blank pages in between.
|
|
|
|
|
hi every one,
I want to get current application windows title and then show it?
through my search,I find out that I should use getforegroundWindow(),but I don't get it how to do that ?
I'd appreciate any help.
|
|
|
|
|
To use C++ functions you need to do some research into P/Invoke.
Here's how to declare the functions you need in C#:
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplicationTest
{
internal static class NativeMethods
{
[DllImport("User32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("User32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
}
}
Usage example:
using System;
using System.Text;
namespace ConsoleApplicationTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Press any key to get text");
Console.ReadKey();
IntPtr handle = NativeMethods.GetForegroundWindow();
if (handle != IntPtr.Zero)
{
StringBuilder builder = new StringBuilder(255);
NativeMethods.GetWindowText(handle, builder, builder.Capacity);
Console.WriteLine(builder.ToString());
}
Console.ReadKey();
}
}
}
I have used a hardcoded max length of 255. You can use GetWindowText[^] to get the length of the text before getting the text so you won;t be wasting memory with your string builder or risk truncating if it's longer than you expect.
I'll leave implementing that (which is simple) as an exercise for you.
modified 18-Jun-12 17:55pm.
|
|
|
|
|
1. I have a binary c++ exe. (Proj1)
2. This exe launches another exe (a c# one).(proj2)
3.I have the source code for proj2.
4. When Proj1 calls Proj2 (click of a button), I want to step into the c# code of proj2.
5. I added a Debugger.Break() as the first line in proj2 c# code.
5. I started proj1 running.
6. FRom Proj2 Debug menu, i tried "Attach to Process" the running process proj1.exe.
It attached.
7. I tried to put a breakpoint on Debugger.Break() line. VS 2008 said breakpoint will not be hit , no executable code is associated with this line.
8. I clicked the button in proj1.exe which launches the c# project (proj2).
9. The gui of proj2 came up but did not step into the source code at all.
Evidently I'm doing something wrong.
My goal is to step into the C# source code of proj2 when the binary exe proj1, launches proj2.
thanks,
sb
|
|
|
|
|
Make sure you're building proj2 in Debug, not Release (because I'm pretty sure debugger stuff is stripped out in Release builds).
|
|
|
|
|
Thanks!
It's definitely built in debug mode.
sb
|
|
|
|