|
instead of this.Controls, loop through the controls in panel.Controls.
Or better yet, if they are dynamically created by you, when putting the checkbox in the panel, put them in a List/ArrayList so that they are easier to be referenced.
|
|
|
|
|
I am using the bitblt() function for printing a bitmap with c#. But the printing quality I am getting in this case is not satisfactory at all. Actually, the type of bitmaps that the 'BitBlt()' function requires are normally in the format of the display driver rather than the printer driver. So I am thinking of using a DIB rather than DDB and for doing this may be StretchDIBits() function can be used.
Please help me with some code sample on how to use the StretchDIBits() function in C#
Thanks in advance
Kamrul Hasan
|
|
|
|
|
You can use StretchDIBits if you want, using P/invoke. However, did you set the stretch blit mode of the graphics object you're using and see if that helped ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Is it possible to backup and restore a MySql Database using C#?
How? Any suggestions?
|
|
|
|
|
Yes, it's possible: Get all tables, foreach table, get all columns and then create the script that will add this table into a Mysql database
|
|
|
|
|
This is somewhat confusing. Could you give me more specifics on what you're suggesting? Are you saying that I backup the database by placing it on another database?
I was thinking more around the grounds of backing up my database on a *.sql file and restoring it from a *.sql file using C#.
|
|
|
|
|
No, I was saying that you should create the sql script by yourself analyzing the structure of the current database
|
|
|
|
|
Ohhh... Hmm... Interesting... Thanks.
|
|
|
|
|
|
string fname = txtFileName.Text;
if (fname == "")
{
MessageBox.Show("Please Enter the File Name!");
return;
}
try
{
btnBackup.Enabled = false;
DateTime backupTime = DateTime.Now;
int year = backupTime.Year;
int month = backupTime.Month;
int day = backupTime.Day;
int hour = backupTime.Hour;
int minute = backupTime.Minute;
int second = backupTime.Second;
int ms = backupTime.Millisecond;
String tmestr = backupTime.ToString();
tmestr = "C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\" + fname + year + "-" + month + "-" + day + "-" + hour + "-" + minute + ".bak";
StreamWriter file = new StreamWriter(tmestr);
ProcessStartInfo proc = new ProcessStartInfo();
string cmd = string.Format(@"-u{0} -p{1} -h{2} {3}", "root", "password", "Server", "dbname");
proc.FileName = "mysqldump";
proc.RedirectStandardInput = false;
proc.RedirectStandardOutput = true;
proc.Arguments = cmd;//"-u root -p smartdb > testdb.sql";
proc.UseShellExecute = false;
Process p = Process.Start(proc);
string res;
res = p.StandardOutput.ReadToEnd();
file.WriteLine(res);
p.WaitForExit();
file.Close();
MessageBox.Show("DataBase Backup Has Been Completed Successfully!");
btnBackup.Enabled = true;
}
catch (IOException ex)
{
MessageBox.Show("Disk full or other IO error , unable to backup!");
}
txtFileName.Text = "";
|
|
|
|
|
Hi,
does anyone knows how to ge the size (area value) of an inregular shape in a bitmap image.
i have a bitmap image with a black background and the shape is all in white, i wonna get the size of the shape and say yes if the shape has rugged edges or no if its more like a circle.
I appreciate any help.
|
|
|
|
|
You could look at my image processing articles for info on direct pixel access, then you could walk the image and see if it has straight edges.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Now, I'm very curious, did you actually find that function name (sig) in a real life application, or it's just a sig?
|
|
|
|
|
It was a method in code someone posted here asking for help.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hi all,
i need set the position for ascii char in richtextbox.
Here is my coding that will show the ascii char in richtextbox.
string hex = "040";
string hex1 = "025";
string hex2 = "023";
string hex3 = "025";
int code = Convert.ToInt32(hex,16);
int code1 = Convert.ToInt32(hex1,16);
int code2 = Convert.ToInt32(hex2,16);
int code3 = Convert.ToInt32(hex3, 16);
richTextBox1.Text = Encoding.Default.GetString(new byte[] {(byte)code,(byte)code1,(byte)code2,(byte)code3});
Now i need arrange all the ascii char in correct position.I hd tried in many ways,but still got errors.pls help me.
Thank you.
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Hi guys,
I feel like stupid, anyway. I have a very common question and please no utfg answers, I've done that.
I'm no able to create a control that can accept dragged items from other windows (e.g. files dragged from windows explorer or icons from desktop). I'm using .NET 2.0 and Vista. Is it just something small that I'm doing wrong?
here is what I'm doing.
- create custom control derived from System.Windows.Control class
- make sure the AllowDrop property is set to true
- override OnDragEnter , OnDragDrop , OnDragOver etc...
my problem is that those events OnDrag... never get raised when dragging anything above my application window/control.
zilo
|
|
|
|
|
I thought you need to also specify in code what file types you accept being dragged ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hi,
i'm trying to filter data withe The Binding Source
the thing is that i have a cloumn that is Set as
DateTime Type.
Now i'd like to Filter Monthly Like : "04/2008"
the Thing is that i've got a DateTimePicker that is in the same Format but i don't know what to put in the Filter
i Started with :
BS_WorkingHours.Filter = "(Date > '" + MinDate + "') AND (Date < '" + MaxDate + "')";
Where MinDate Day is Set To "01" + Current Month and Year And MaxDate is Set To "31" + Current Month and Year
they are Both strings
it Does not Accpet String for Compare so i'll need to Put
The DateTime Object itsef, but the DateTimePicker Value Includs
The Day Which in this case i do not need
AnyOne, THANKS
Have Fun
Never forget it
|
|
|
|
|
half-life wrote: it Does not Accpet String for Compare
Of course it does. You are assigning a string to the Filter property. A string can not contain anything but characters.
You can create DateTime values from the year and month values:
DateTime minDate = new DateTime(selectedDate.Year, selectedDate.Month, 1);
Using 31 for date doesn't work well, as all months doesn't have 31 days. Add a month to the startdate, then subtract one day to get to the last day of the month:
DateTime maxDate = minDate.AddMonths(1).AddDays(-1);
Now you can format the dates into strings and concatenate into the filter expression.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Is there any way that I can let the user enter a new record through a form and then add that record dynamically to a combobox (while user types), and give a new primary key to that new record?
Thanks
|
|
|
|
|
Well to give the user the ability to add to the combobox:
Textbox tbxText=new Textbox
tbxText.tex='insert user input; could be already created if on the form
Combobox cbxCombo=new Combobox
cbxCombo.Items.Add(tbxText.text)
This is pseudocode and not syntactically correct C# code.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thanks so much, that's exactly what I needed
|
|
|
|
|
|
Hi,
(condition ? result_if_true : result_if_false)
represents a value...
Console.WriteLine(x > y ? "X bigger" : "Y bigger (or equal to)");
is what you're looking for (note that if x > y is false... it doesn't necessarily mean that y > x).
Hope this helps.
Matthew Butler
|
|
|
|
|
Hi Matthew,
Thanks for the reply.
I should be dumb .I forgot the thing." Assignment of result"
Any way thanks for your time
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|