|
Hey guys
How would I go about saving an image of a control? Lets say for instance I'm drawing something on a panel using GDI+, I need to save that drawing to JPEG. Been googling around but no joy.
Any help will be appreciated
Thanks
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Control.DrawToBitmap is the general answer, some Controls (such as RTB) need a bit more effort though.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
DrawToBitmap doesn't works for ActiveX controls like WebBrowser.
You would better use Graphics.CopyFromScreen but It works for active window only.
Life is a stage and we are all actors!
|
|
|
|
|
What I do in my screen grabber applet is...
Define a bitmap of the appropriate size:
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap
(
this.pPanel.Width
,
this.pPanel.Height
) ;
Get a Graphics object for the bitmap:
using ( System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage ( bitmap ) )
Copy the area of the screen that the Panel covers to the bitmap:
gr.CopyFromScreen
(
this.pPanel.PointToScreen ( new System.Drawing.Point ( 0 , 0 ) )
,
new System.Drawing.Point ( 0 , 0 )
,
this.pPanel.Size
) ;
Save the bitmap to a file (I prefer PNG):
bitmap.Save ( sw.BaseStream , System.Drawing.Imaging.ImageFormat.Png ) ;
(Details left as an exercise.)
|
|
|
|
|
Hello,
I've a timer that run every 1 second (and do some check),
how can i insert it to a thread? because it interrupt to my application.
can someone please help me here?
|
|
|
|
|
tamir101 wrote: I've a timer that run every 1 second (and do some check),
Is that a System.Windows.Forms.Timer or System.Threading.Timer ? First one runs on the main thread and second one runs on a pooled thread.
If you are using Forms.Timer , consider changing to Threading.Timer . This[^] MSDN article will help.
|
|
|
|
|
Hi,
Can you please explain me how to use it?
I can't understand how i need to do it...
|
|
|
|
|
i want to stored the image which i have in a picturebox to be stored in sqldatabase. and which datatype i should use in sql
|
|
|
|
|
|
You can place your own contol in the dropdownlist of a combobox, see here:
http://www.codeproject.com/KB/combobox/CustomComboBox.aspx
modified 27-May-14 5:28am.
|
|
|
|
|
If I want to grab a DataRowView I use:
DataRowView arrangement = (DataRowView)BindingContext[debtorDataSet, "Debtor.FK_PaymentArrangements_Debtor"].Current;
How can I get a DataRowView for the previous position without changing the position to do so please?
|
|
|
|
|
BindingContext[debtorDataSet, "Debtor.FK_PaymentArrangements_Debtor"].Position will give the current position. Get the table from debtorDataSet and take the row at position - 1.
|
|
|
|
|
Hi all,
Is is possible to add the result of two anonymous LINQ queries together (when the data is gathered from two different data sources), to form a variable that one foreach loop can iterate on. For example:
var query1 = from x in dataCollection
select new
{
name = x.Name,
surname = x.Surname
};
var query2 = from x in xmlCollection
select new
{
name = x.Name,
surname = x.Surname
};
foreach (var result in .....
Many thanks in advance,
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Ravi Mori wrote: You have to post this question in Linq Forum..
Your right ... sorry about that
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
If I open a web page (http://www.google.co.in/) on Mozilla firefox, How can I save to a specific Path (e.g., "C:\New Folder\WebPage.html")?
How to do this using c#
|
|
|
|
|
Check this link^
Might help you out..
|
|
|
|
|
hi,
i have many text boxes on my web page,
how can i get which text box is focused.
Thank You
|
|
|
|
|
foreach (Control c in Controls)
{
if (c.Focused)
{
MessageBox.Show(c.Text);
}
}
Remember to check if it is a TextBox, as buttons etc can also have the focus.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
i am receiving error-
Cannot convert method group "Focus" to non delegate type 'bool'
|
|
|
|
|
Have you had a look at the TexBox Class[^]?
Maybe you can find something there...
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Something like this should work:
foreach (Control ctrl in Page.Controls)
{
if (ctrl is TextBox && ctrl.Focused)
{
((TextBox)(ctrl)).Text = "FOUND YOU!!";
}
}
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Controls have an event that's triggered when they get focus, so you could just hook into this on every control, and store the last focused item yourself
|
|
|
|
|
You would probably get better responses on the Web Development Forum, but for what it's worth in Windows Forms there is the ActiveControl property. Is that also available For ASP?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|