Click here to Skip to main content
15,898,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating a Database Connection with C# Pin
Guffa17-Jun-06 11:45
Guffa17-Jun-06 11:45 
AnswerRe: Creating a Database Connection with C# Pin
Colin Angus Mackay17-Jun-06 10:02
Colin Angus Mackay17-Jun-06 10:02 
GeneralRe: Creating a Database Connection with C# Pin
v3nn17-Jun-06 10:58
v3nn17-Jun-06 10:58 
QuestionEnter and Tab key Pin
sandi antono17-Jun-06 9:04
sandi antono17-Jun-06 9:04 
AnswerRe: Enter and Tab key Pin
LongRange.Shooter17-Jun-06 18:19
LongRange.Shooter17-Jun-06 18:19 
GeneralRe: Enter and Tab key Pin
sandi antono18-Jun-06 1:29
sandi antono18-Jun-06 1:29 
QuestionUSB devices connect Hook -- ??? Pin
Vasya - dragon17-Jun-06 7:37
Vasya - dragon17-Jun-06 7:37 
QuestionYikes, anyone want to help me optimize this graphics task? [modified] Pin
ThisIsMyUserName217-Jun-06 7:13
ThisIsMyUserName217-Jun-06 7:13 
I'm trying to emulate the Magnify tool except it's a bit more limited. I only want to monitor a specific region of the desktop and zoom at a set %.

Here's the code I have so far...
private void GetSnapShot()
{
    Bitmap bmp = new Bitmap(273, 273);
    Graphics g = Graphics.FromImage(bmp);

    g.CopyFromScreen(formLocationX, formLocationY, 0, 0, new Size(273, 273));

    picDisplay.Image = bmp;

    g.Dispose();
    bmp = null;
}


I dropped this in a timer's tick event, and it's such a ram slob. It'll use up 4-10mb of ram, then go back down, but it seems so inefficient because it's cycling the ram every 3 seconds or so. The windows magnify tool doesn't use that much ram. I've downloaded a few magnify tools (just to see how they operate) and they don't either.

What can I do to make this better?

The 273 hardcoded values are the size of the picture box. I figured it would be better to hardcode the values rather than get the height/width of the picture box everytime. formLocationX and formLocationY is the area it's monitoring.

I haven't figured out how to zoom in it yet. I set the scale transform and that didn't seem to do anything. I'd much rather get this optimized before worrying about the zoom part though (but if it's a simple task that I am overlooking, feel free to let me know).

-- modified at 13:16 Saturday 17th June, 2006

It just dawned on me that I'm creating a new bitmap everytime. I moved that out of there as well as setting it to null at the end. This stopped the ram from going nuts, I still wouldn't mind any possible ideas on how to make it better though.
AnswerRe: Yikes, anyone want to help me optimize this graphics task? Pin
Ed.Poore17-Jun-06 10:03
Ed.Poore17-Jun-06 10:03 
GeneralRe: Yikes, anyone want to help me optimize this graphics task? Pin
ThisIsMyUserName217-Jun-06 11:30
ThisIsMyUserName217-Jun-06 11:30 
AnswerRe: Yikes, anyone want to help me optimize this graphics task? Pin
Guffa17-Jun-06 11:51
Guffa17-Jun-06 11:51 
AnswerRe: Yikes, anyone want to help me optimize this graphics task? Pin
LongRange.Shooter17-Jun-06 18:22
LongRange.Shooter17-Jun-06 18:22 
GeneralRe: Yikes, anyone want to help me optimize this graphics task? Pin
ThisIsMyUserName218-Jun-06 1:09
ThisIsMyUserName218-Jun-06 1:09 
Questionhow to handle history (Edit>Undo Redo) Pin
Susuko17-Jun-06 4:54
Susuko17-Jun-06 4:54 
AnswerRe: how to handle history (Edit>Undo Redo) Pin
Colin Angus Mackay17-Jun-06 5:03
Colin Angus Mackay17-Jun-06 5:03 
AnswerRe: how to handle history (Edit>Undo Redo) Pin
Jun Du17-Jun-06 5:32
Jun Du17-Jun-06 5:32 
AnswerRe: how to handle history (Edit>Undo Redo) Pin
LongRange.Shooter17-Jun-06 18:23
LongRange.Shooter17-Jun-06 18:23 
Questioncrystal report help!! Pin
ersinsivaz17-Jun-06 4:23
ersinsivaz17-Jun-06 4:23 
AnswerRe: crystal report help!! Pin
vernchen17-Jun-06 6:16
vernchen17-Jun-06 6:16 
QuestionAdding option box to user control Pin
BRShroyer17-Jun-06 3:46
BRShroyer17-Jun-06 3:46 
AnswerRe: Adding option box to user control Pin
Robert Rohde17-Jun-06 11:09
Robert Rohde17-Jun-06 11:09 
QuestionA question for the Experts! :p i think Pin
TheBeginner7717-Jun-06 2:50
TheBeginner7717-Jun-06 2:50 
AnswerRe: A question for the Experts! :p i think Pin
WillemM17-Jun-06 3:08
WillemM17-Jun-06 3:08 
QuestionDevice interface Pin
bannapradeep17-Jun-06 2:50
bannapradeep17-Jun-06 2:50 
AnswerRe: Device interface Pin
Dave Kreskowiak17-Jun-06 16:55
mveDave Kreskowiak17-Jun-06 16:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.