Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: select domain name part of a url saved in a string Pin
Ryan Bost6-Apr-08 5:22
Ryan Bost6-Apr-08 5:22 
GeneralRe: select domain name part of a url saved in a string Pin
Farhad Eft8-Apr-08 5:59
Farhad Eft8-Apr-08 5:59 
GeneralSoapFormatter: Ignore missing fields Pin
Roger Alsing5-Apr-08 23:24
Roger Alsing5-Apr-08 23:24 
QuestionHow to change caption text in default ColorDialog ? Pin
eslange5-Apr-08 23:03
eslange5-Apr-08 23:03 
GeneralPublish XNA Project (Please?) [modified] Pin
MasterSharp5-Apr-08 12:03
MasterSharp5-Apr-08 12:03 
GeneralRe: Publish XNA Project (Please?) Pin
MarkB7775-Apr-08 17:22
MarkB7775-Apr-08 17:22 
GeneralRe: Publish XNA Project (Please?) Pin
MasterSharp6-Apr-08 3:33
MasterSharp6-Apr-08 3:33 
QuestionTaking a screen shot of a control Pin
nike_arh5-Apr-08 11:24
nike_arh5-Apr-08 11:24 
Hi. I need to take a screen shot of a control - the control is plotterForm.expressionPlotter. I am using the following code:
<br />
private Bitmap GetBitmap()<br />
        {<br />
            Bitmap bmp = new Bitmap(plotterForm.expressionPlotter.Width, plotterForm.expressionPlotter.Height);<br />
            Graphics g = Graphics.FromImage(bmp);<br />
            Screen screen = Screen.FromControl(plotterForm.expressionPlotter);<br />
            g.CopyFromScreen(new Point(screen.Bounds.Location.X, screen.Bounds.Location.Y), Point.Empty, plotterForm.expressionPlotter.Size);<br />
            return bmp;<br />
        }

The problem is that the location of which the screen shot is always the upper left corner of the desktop, not the upper left corner of the control.
In other words the screen.Bounds.Location is a point which is always (0;0). When i added MessageBox.Show(screen.ToString()); i received the following message:
Screen[Bounds={X=0,Y=0,Width=1024,Height=768} WorkingArea={X=0,Y=0,Width=1024,Height=739} Primary=True DeviceName=\\.\DISPLAY1
As if the screen hasn't captured the control. How can i fix this???

Still learning...

GeneralRe: Taking a screen shot of a control Pin
nike_arh5-Apr-08 11:36
nike_arh5-Apr-08 11:36 
GeneralRe: Taking a screen shot of a control Pin
Matthew Butler5-Apr-08 11:41
Matthew Butler5-Apr-08 11:41 
GeneralRe: Taking a screen shot of a control Pin
Anthony Mushrow5-Apr-08 12:50
professionalAnthony Mushrow5-Apr-08 12:50 
GeneralRe: Taking a screen shot of a control Pin
nike_arh5-Apr-08 22:57
nike_arh5-Apr-08 22:57 
GeneralRe: Taking a screen shot of a control Pin
Anthony Mushrow6-Apr-08 0:32
professionalAnthony Mushrow6-Apr-08 0:32 
GeneralRe: Taking a screen shot of a control Pin
PIEBALDconsult5-Apr-08 16:26
mvePIEBALDconsult5-Apr-08 16:26 
GeneralRe: Taking a screen shot of a control Pin
Roger Alsing5-Apr-08 23:31
Roger Alsing5-Apr-08 23:31 
GeneralRe: Taking a screen shot of a control Pin
nike_arh6-Apr-08 0:15
nike_arh6-Apr-08 0:15 
GeneralRe: Taking a screen shot of a control Pin
nike_arh6-Apr-08 1:05
nike_arh6-Apr-08 1:05 
GeneralRe: Taking a screen shot of a control Pin
Guffa6-Apr-08 18:02
Guffa6-Apr-08 18:02 
GeneralRe: Taking a screen shot of a control Pin
GuyThiebaut6-Apr-08 2:37
professionalGuyThiebaut6-Apr-08 2:37 
QuestionError: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 9:51
sgeorgije5-Apr-08 9:51 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 10:00
sitebuilderLuc Pattyn5-Apr-08 10:00 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 11:05
sgeorgije5-Apr-08 11:05 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 11:20
sitebuilderLuc Pattyn5-Apr-08 11:20 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 12:08
sgeorgije5-Apr-08 12:08 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 13:11
sitebuilderLuc Pattyn5-Apr-08 13:11 

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.