|
Thanks Ravi!
I haven't tried it out yet, I will let you know if it works.
Thanks for the idea!
Cheers! 
|
|
|
|
|
Hey Ravi, I tried your suggestion regarding setting the margin. Hmm, but I did not achieve what I want, it just put padding on the menu strip as a whole. I want to share you what I did. See code below.
private void ResizeMenu()
{
int itemHeight = (int) (Math.Floor((double)(this.Size.Height / (this.menuStrip1.Items.Count + 1))));
foreach (ToolStripMenuItem item in this.menuStrip1.Items)
{
int prevWidth = item.Size.Width;
item.Size = new Size(prevWidth, itemHeight);
}
}
Sorry I can't format nicely my code here. I am calling the method when form resizes.
Thanks for your help!
|
|
|
|
|
That's not what I meant. Change each item's Margin property instead (specifically the .Left member).
/ravi
|
|
|
|
|
hi,
I have a FTP location from where i want to get files, which are created on a date which is saved in the local machine.
Is it possible to do that,when i searched the data is retrieved as stream , where i cant give a filter condition. (with my knowledge)
Please suggest a solution.
Thanks
Sandeep
|
|
|
|
|
You may want to use NetFTP[^].
/ravi
|
|
|
|
|
http://www.codeproject.com/Questions/163452/how-to-get-the-latest-file-in-a-FTP-or-directory-u
got the solution 
|
|
|
|
|
How to access remote file directories without permission from remote system.
|
|
|
|
|
You want us to tell you how to get files that the ownere doesn't want you to have? No chance!
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
hi
how can move a rectangle over desktop area and taking picture.i want to be able to move the rectangle around pressing left mouse cursor and keep capturing pictures.
your help is greatly appreciated
abol
|
|
|
|
|
|
|
Hello
How to Get bound of full screen without taskbar c#
thanks
|
|
|
|
|
Rectangle r1 = Screen.PrimaryScreen.Bounds;
Rectangle r2 = Screen.PrimaryScreen.WorkingArea;
int tBarHeight = r1.Height - r2.Height; If the TaskBar is not auto-hidden then the r1.Height - r2.Height gives you the height of the TaskBar.
However, if your goal is to show a full-screen Window, you should not really concern yourself with the TaskBar: see Raymond Chen's MS blog entry:[^].
Remember that the user may have docked the TaskBar to another side of the screen, and, that there could be multiple monitors in use.
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
|
Hello would someone please help me with my program, I'm stuck all day with this thing. The program runs, but I think the problem is a logical error. The fraction 1/4 + 2 1/2 should be equal to 2 3/4 but the program's result is 2 3/8. Another thing is the expression 1/8 + 2 1/2 should be equals to 2 5/8. Please help me how to fix the codes. Thank you very much!
using System;
class FractionDemo
{
static void Main(string[] args)
{
Fraction firstfraction = new Fraction();
Fraction secondfraction = new Fraction();
firstfraction.Numerator = 1;
firstfraction.Denominator = 4;
secondfraction.Numerator = 1;
secondfraction.Denominator = 8;
secondfraction.WholeNumber = 2;
Fraction add = new Fraction();
add = firstfraction + secondfraction;
Console.Write("\n {0}/{1}", firstfraction.Numerator, firstfraction.Denominator);
Console.WriteLine(" + {0}/{1} = {2}/{3}", secondfraction.Numerator, secondfraction.Denominator, add.Numerator, add.Denominator);
Console.Write("\n {0}/{1}", firstfraction.Numerator, firstfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator,secondfraction.WholeNumber, add.WholeNumber, add.Numerator, add.Denominator);
Console.Write("\n {0}/{1}", firstfraction.Numerator, secondfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.WholeNumber, add.WholeNumber, add.Numerator, add.Denominator);
Console.ReadLine();
}
public class Fraction
{
private int wholenumber;
private int numerator;
private int denominator;
public int WholeNumber
{
get
{
return wholenumber;
}
set
{
wholenumber = value;
}
}
public int Numerator
{
get
{
return numerator;
}
set
{
numerator = value;
}
}
public int Denominator
{
get
{
return denominator;
}
set
{
denominator = value;
if (denominator > 0)
{
denominator = value;
}
else
{
denominator = 1;
}
}
}
public Fraction(int wholenumber, int numerator, int denominator)
: this(numerator, denominator)
{
WholeNumber = wholenumber;
}
public Fraction(int numerator, int denominator)
{
WholeNumber = 0;
Numerator = numerator;
Denominator = denominator;
}
public Fraction()
{
WholeNumber = 0;
Numerator = 0;
Denominator = 1;
}
public int gcd()
{
int x = Numerator;
int y = Denominator;
int m;
if (x > y)
m = y;
else
m = x;
for (int i = m; i >= 1; i--)
{
if (x % i == 0 && y % i == 0)
{
return i;
}
}
return 1;
}
public void Reduce()
{
int gcdNum = gcd();
if (gcdNum != 0)
{
Numerator = Numerator / gcdNum;
Denominator = Denominator / gcdNum;
}
if (Denominator < 0)
{
Denominator = Denominator * -1;
Numerator = Numerator * -1;
}
convertFraction();
}
public void convertFraction()
{
WholeNumber = Numerator / Denominator;
Numerator = Numerator % Denominator;
}
public static Fraction operator +(Fraction firstfraction, Fraction secondfraction)
{
int firstNum = (firstfraction.WholeNumber * firstfraction.Denominator) + firstfraction.Numerator;
int secondNum = (secondfraction.WholeNumber * secondfraction.Denominator) + secondfraction.Numerator;
Fraction Result = new Fraction();
Result.Numerator = firstNum * secondfraction.Denominator + firstfraction.Denominator * secondNum;
Result.Denominator = firstfraction.Denominator * secondfraction.Denominator;
Result.Reduce();
return Result;
}
}
}
|
|
|
|
|
Um.
No, it's your test code that is the problem:
Console.Write("\n {0}/{1}", firstfraction.Numerator, firstfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.WholeNumber, add.WholeNumber, add.Numerator, add.Denominator);
Console.Write("\n {0}/{1}", firstfraction.Numerator, secondfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.WholeNumber, add.WholeNumber, add.Numerator, add.Denominator);
Why are you printing the whole number in two places:
1/4 + 2 1/2 = 2 3/8
^
1/8 + 2 1/2 = 2 3/8
^
If you change the third parameter value to the Denominator:
Console.Write("\n {0}/{1}", firstfraction.Numerator, firstfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.Denominator, add.WholeNumber, add.Numerator, add.Denominator);
Console.Write("\n {0}/{1}", firstfraction.Numerator, secondfraction.Denominator);
Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.Denominator, add.WholeNumber, add.Numerator, add.Denominator);
Then the math is correct for the second line:
1/4 + 2 1/8 = 2 3/8
but still wrong for the third, since that isn't the sum you are doing!
1/8 + 2 1/8 = 2 3/8
|
|
|
|
|
the Math works, but displaying the data is corrupt.
use function like:
public override string ToString()
{
if (wholenumber == 0) return String.Format("{0}/{1}", numerator, denominator);
return String.Format("{0} {1}/{2}", wholenumber, numerator, denominator);
}
In fraction class definition for standard displaying a fraction.
to calculate an other fraction, you have to change the calculation parameters like:
Fraction firstfraction = new Fraction(1,8);
Fraction secondfraction = new Fraction(2,1,4);
Fraction add = firstfraction + secondfraction;
Console.WriteLine(firstfraction.ToString() + " + " + secondfraction.ToString() +" = "+ add.ToString() );
firstfraction = new Fraction(3,8);
secondfraction = new Fraction(2,1,6);
add = firstfraction + secondfraction;
Console.WriteLine(firstfraction.ToString() + " + " + secondfraction.ToString() +" = "+ add.ToString() );
Console.ReadLine();
|
|
|
|
|
Hello
I know I can change mouse cursor like that
this.cursor=cursor.hand
I need change it when my application is minimized by notify Icon.
|
|
|
|
|
Just to be clear, you want to change the cursor when the mouse is OVER the notify icon, or you want to change the cursor for the system after your application minimizes to the notify icon?
|
|
|
|
|
I want change the cursor for the system after application minimized to finish some task and return mouse to default..
thanks in advance
|
|
|
|
|
Changing the System cursor is usually a very bad idea, but I assume you have some very special purpose in mind ... so, if you have to do it:
You are going to have define your own cursor file, and hack the registry: [^].
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
thanks for answer
I know that and I do not want change cursor from register and restart PC, I need For instance make trick on form maximize it and change the cursor make the form opacity 0.
so that change the cursor but when I move mouse does not focus
another window because the main form cover all screen.
I hope you understand me.
|
|
|
|
|
This goes directly against the principles of a multi-tasking operating system. Locking the machine while your application does something is really bad practice. Why do you want to do this?
|
|
|
|
|
Hello
How I can Retrieve all the controls of any window with their types and value.
please urgent
thanks
|
|
|
|
|
delphix5 wrote: urgent No, it's not urgent. And you could answer questions like this far faster by doing Google searches[^].
Veni, vidi, abiit domum
|
|
|
|
|