|
Hello Friends,
I want to save text in a image format it may be JPG or BMP
I have three labels at form now what i want that whatever written of these three labels will save in a single image.
like
''''''''''''''''''''''''''''''''''
Hello-------Label1
Dikshant----Label2
Hi----------Label3
''''''''''''''''''''''''''''''''''
These three labels are in this form so please tell me how can i save these three labels data in a single image...
|
|
|
|
|
Use the DrawToBitmap method of the form to draw the form on a Bitmap object. You can then use the Save method of the Bitmap object to save it in the file format you like.
If you want less than the entire form, put the controls in a Panel , and use the DrawToBitmap method of the Panel .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello sir,
Thanks for Answering my Question....
As i am new in C#.NET can you please send me a sample code so i can easily understood..
Thanks in Advance
|
|
|
|
|
The code is basically:
using (Bitmap b = new Bitmap(form1.Width, form1.Height)) {
DrawToBitmap(b, new Rectangle(0, 0, form1.Width, form1.Height));
b.Save(fileName, ImageFormat.Png);
}
You can check the parameters to use in the documentation:
MSDN Library[^]
Tip: search for drawtobitmap method or bitmap class.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Create an instance of the bitmap class, and draw on it the text and then use Bitmap.Save
|
|
|
|
|
I have an application which use update application block 2.0 to update. Everything works fine on the staging server. But when i move my update package on to the production server. I got error : The requested URL does not exist on the server. when applying an update.
Below is the detail i cut from the error log:
Summary for :
======================================
--> MachineName: WAXIANGZ
--> TimeStamp: 2008-2-22 7:36:11
--> FullName: Microsoft.Practices.EnterpriseLibrary.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
--> AppDomainName: EMSWindowsClient.exe
--> WindowsIdentity: ASIAPACIFIC\waxiangz
Exception Information Details:
======================================
Exception Type: Microsoft.ApplicationBlocks.Updater.Downloaders.BitsDownloadErrorException
Code: -2145844844
Context: 5
ContextDescription: The error occurred while the remote file was being processed.
Message: The requested URL does not exist on the server.
Protocol: http
LocalFileName: C:\Program Files\HPInvent\EMS\UAB\downloader\{215E1AD7-9ABA-432f-A952-24BABA556850}\5e4b3b14-30a5-47a5-bdcc-7a0fc173c3ac\updaterconfiguration.config1
RemoteFileName: http://g2w0293.austin.hp.com/EMSUpdateTest/config/updaterconfiguration.config1
TargetSite: Void LogAndThrowException(System.String, System.Exception)
HelpLink: NULL
Source: Microsoft.ApplicationBlocks.Updater
StackTrace Information Details:
======================================
at Microsoft.ApplicationBlocks.Updater.Logger.LogAndThrowException(String message, Exception ex)
at Microsoft.ApplicationBlocks.Updater.Logger.LogAndThrowException(Exception ex)
at Microsoft.ApplicationBlocks.Updater.Downloaders.BitsDownloader.OnJobError(UpdaterTask task, IBackgroundCopyJob pJob, IBackgroundCopyError pError, Exception ex)
at Microsoft.ApplicationBlocks.Updater.Downloaders.BitsDownloader.WaitForDownload(UpdaterTask task, IBackgroundCopyJob backgroundCopyJob, TimeSpan maxWaitTime)
at Microsoft.ApplicationBlocks.Updater.Downloaders.BitsDownloader.Download(UpdaterTask task, TimeSpan maxWaitTime)
Any one have ideas???
|
|
|
|
|
And sometimes got error: The job is not making headway. The server may be misconfigured. Background Intelligent Transfer Service (BITS) will try again later.
|
|
|
|
|
The error code under BitsDownloadErrorException code is 0x80190194 in hex. Windows error codes are defined in WinError.h (which you can find under vc\PlatformSDK\include under Visual Studio's install folder, if you installed the C++ tools). Error codes are grouped into 'facilities' to allow codes to be allocated independently. The 'facility' part is the second byte of four, here it's 0x19 = 25 decimal. Facility number 25, according to WinError.h is FACILITY_HTTP, so it's an error defined by the WinHttp APIs.
I can't find where this is actually used, but the last 16 bits are always the specific error. 0x194 hex = 404 decimal, which is of course the 'not found' HTTP status code.
Assuming that you've copied the files to the right location, I'd check that your web server is configured to send that type of file. IIS 6.0 only sends files that it knows the MIME type for, in contrast to earlier versions. The Updater Application Block 2.0 FAQ mentions this and how to fix the issue at http://msdn2.microsoft.com/en-us/library/ms978569.aspx#updaterfaq_deploytopic5[^].
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
|
Hi,
I want to make some simple OCR actions using C#.
All I want is a DLL. I'll give him an image, it will return a string.
Can you give me such dll please?
Thanks
|
|
|
|
|
OCR is not trivial. Atalasoft have a commercial library, I don't know of any others.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I know it's not trivial but in my case I need a simple OCR functionality - only recognize numbers.
I forgot to say - I want free DLL, not commercial.
Thanks
|
|
|
|
|
I guessed that. You're not very likely to find one, sorry.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This[^] company does a freeware product using the Tesseract engine[^] which is open source so it may be a good starting point?
Dave
|
|
|
|
|
Am developing An application in C# and picking data from the database.
I have a bit data type to act as a flag.In the datagridview it displays a checkbox(good for me) but then I have failed to handle the click events of each row clicked to flag off the row so that it is not displayed again.
Need some help or a good article handling this.
Give the world the best you have, And the best will come your Way
|
|
|
|
|
Following is my issue.
-------------------------------------------
I have a unmanaged application ( C++ , .exe ) which has a class CMyClass
with a public member fMyFunct(). You can assume this C++ application is built with /clr option.
I need to instantiate CMyClass in a different managed ( C# ) application and call fMyFunct().
Many thanks if any of you can send me a sample which demonstrate above things ( Remember I can't manipulate C++ application apart from project settings. But you can do anything in C# application )
----------------------------------------------------
|
|
|
|
|
If it's an application ( not a dll ) then if you can't change the app, you're basically screwed. Your best bet would be to abstract the class/method out into a dll, so your C# application can construct an instance and call it. I don't think you can add a reference to an exe in a .NET app.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
namespace JSearchBar_Jason<br />
{<br />
public partial class JSearchBar : UserControl<br />
{<br />
<br />
public delegate void JSearchEventHandler(object sender, JSearchEventArgs e);<br />
public event JSearchEventHandler SearchButtonClickHandle;<br />
<br />
public JSearchBar()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void JSearchBar_Load(object sender, EventArgs e)<br />
{<br />
JSearchLayout();<br />
}<br />
<br />
#region Layout<br />
<br />
private void JSearchLayout()<br />
{<br />
this.BackColor = Color.Transparent;<br />
<br />
this.toolStrip1.Dock = DockStyle.Fill;<br />
<br />
int w = this.Width - ButtonSearch.Width;<br />
this.TextSearch.Width = w;<br />
}<br />
<br />
private void JSearchBar_Resize(object sender, EventArgs e)<br />
{<br />
int w = this.Width - ButtonSearch.Width;<br />
this.TextSearch.Width = w;<br />
}<br />
<br />
#endregion<br />
<br />
private void ButtonSearch_ButtonClick(object sender, EventArgs e)<br />
{<br />
JSearchEventArgs jsearchEA = new JSearchEventArgs(this.TextSearch.Text, "web", "web");<br />
<br />
if (null != SearchButtonClickHandle)<br />
SearchButtonClickHandle(this, jsearchEA);<br />
}<br />
<br />
private void ButtonSearchFreeSite_Click(object sender, EventArgs e)<br />
{<br />
JSearchEventArgs jsearchEA = new JSearchEventArgs(this.TextSearch.Text, "web", "localweb");<br />
<br />
if (null != SearchButtonClickHandle)<br />
SearchButtonClickHandle(this, jsearchEA);<br />
}<br />
<br />
private void ButtonSearchDesktop_Click(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("???????");<br />
}<br />
<br />
}<br />
<br />
public class JSearchEventArgs : EventArgs<br />
{<br />
private string searchKeyWords = string.Empty;<br />
private string sourceType="web"; <br />
private string searchArea="web";<br />
<br />
public JSearchEventArgs(string keyWords, string type, string area)<br />
{<br />
searchArea = area;<br />
searchKeyWords = keyWords;<br />
sourceType = type;<br />
}<br />
<br />
public string SearchKeyWords<br />
{<br />
get{return searchKeyWords;}<br />
}<br />
public string SourceType<br />
{<br />
get{return sourceType;}<br />
}<br />
public string SearchArea<br />
{<br />
get{return searchArea;}<br />
}<br />
}<br />
<br />
}
"int w = this.Width - ButtonSearch.Width;
this.TextSearch.Width = w;
" of upwards code, it was not contributing.
who can tell me why?
Thanks.
|
|
|
|
|
Sorry, you posted way too much code for anyone to bother reading it all.
Did you try setting a break point here and on any other code that sets that width of your control ? Does the control have a minimum or maximum width set in it's properties ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have setted a point there. the code was executed and value of "w" is right.but seem "TextSearch.Width" was not set value with "w".
TextSearch is TextBox, not has a minimum or maximum width properties.
|
|
|
|
|
What if you set that same size in the designer ? And, have you made sure no other code sets the size to something else ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am sure, not set same size and no other code set it.
I create a UserControl, it contain a ToolStrip.
the TextBox and SplitButton are in ToolStrip.
The SplitButton's Width is fix.
I resizing TextBox when ToolStrip resize.
Is the reason about ToolStrip ?
|
|
|
|
|
I find out the reason.
TextBox's autosize property default value is true.
set it false then ok.
thank you help again.
|
|
|
|
|
Strange - I thought of that but checked in a winforms app and couldn't see an AutoSize property. At least we got there, that's great.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ToolStripTextBox has AutoSize
|
|
|
|