|
|
Hi,
I have developed a application which is simulates a pdf reader. It has basic features like text select, hand tool, text search and so on.
There is a perfromance issue, which I have to fix. Following are the details of the issue.
When I open a pdf file and select the HAND tool, and scroll, there is flickering on the screen. I would like to make the scrolling as smooth as possible. like in Adobe acrobat.
How can I do that?
Any suggestion is appreciated.
Thank you,
|
|
|
|
|
Hi.
I'm creating a small program that can take restaurant menu choices. I have a main form that takes all the user's choices and then another form that takes how many did the user ordered for a particular dish/menu. Now my problem is I can't show the quantity inputted by the user to the main form where i can also show all the menu/dishes that the user has ordered, the quantity of each dish, and the total amount he must pay.
I have a class that gets the quantity but when i try to show it to the main form after entering the quantity, the value is still zero.
How will I show the quantity to the main form after i enter it from another form? I'm thinking of another way but I feel that this solution is possible.
this is the combobox from the main form:
OrderInfo customerChoices = new OrderInfo();
#region Appetizer ComboBox
private void cmboBoxAppetizer_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cmboBoxAppetizer.SelectedIndex)
{
case 0:
{
frmQuantity frmQuantity = new frmQuantity();
frmQuantity.Show();
customerChoices.Appetizer = cmboBoxAppetizer.Text;
label1.Text = customerChoices.Quantity
}
break;
case 1:
{
frmQuantity frmQuantity = new frmQuantity();
frmQuantity.Show();
}
break;
case 2:
{
frmQuantity frmQuantity = new frmQuantity();
frmQuantity.Show();
}
break;
default:
{
}
break;
}
}
#endregion
then this is the form that takes the quantity:
public partial class frmQuantity : Form
{
OrderInfo customerChoices = new OrderInfo();
public frmQuantity()
{
InitializeComponent();
}
private void txtBoxQuantity_TextChanged(object sender, EventArgs e)
{
txtBoxQuantity.MaxLength = Convert.ToInt32(txtBoxQuantity.Text);
}
private void btnOk_Click(object sender, EventArgs e)
{
customerChoices.Quantity = Convert.ToInt32(txtBoxQuantity.Text);
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
and the class that takes the quantity:
class OrderInfo
{
int quantity;
public int Quantity
{
get
{
return quantity;
}
set
{
quantity = value;
}
}
}
I didn't include the other code to easily get what i want.
|
|
|
|
|
gamer1127 wrote: OrderInfo customerChoices = new OrderInfo();
You need to read a basic book on OO. Imagine you own two cars. Imagine you put a good stereo in one. Now, you're driving the other one. Do you have a good stereo ? Perhaps, but perhaps not. You have two different instances of OrderInfo, you set values in one, and the other is unaffected. You should use delegates to create communication between forms. Just google for articles explaining how delegates work, and go from there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ok. I have a book that explains how delegates work but it seems that the explanation is insufficient for me. I think I really need to buy more books for OO.
|
|
|
|
|
hi
i read file its extention cs
and i read it line by line
i want to knwo if this line is a header of method or not
how can i know if this line is a header of method or just a line of code
i try with this but not valid
private bool validLine(string s)
{
string[] spliter = s.Split('(');
string check = spliter[0];
string check2=check.Replace(" ","");
if (check2.StartsWith("if")
||check2.StartsWith("//")
||check2.StartsWith("for")
||check2.StartsWith("foreach")
||check2=="using"
|| s.StartsWith("if")
||s.StartsWith("///")
||s.StartsWith("for")
||s.StartsWith("using")
||s.StartsWith("foreach")
|| s.EndsWith(";")
|| s.EndsWith("}")
|| s.EndsWith("{")
|| !s.EndsWith(")")
||string.IsNullOrEmpty(s))
return false;
else
return true;
}
but i think this is not cover all cases
|
|
|
|
|
Yes, you do need help. What are you trying to do ? Your approach is both wrong and ugly. A method is going to be in the scope of a class. Anything inside {} is inside a method, once you're past the class scope. That's how I'd work it out, as well as looking for optional specifiers such as private, a method name, brackets and variable names inside ( plus no semicolon at the end ).
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You certain do, you need to learn to read the guidlines[^] of the forum.
You need to learn how to format your code using the pre (under CODE BLOCK)
zez0 wrote: knwo if this line is a header of method or not
Your question does not make a lot of sense, what do you mean by this.
[edit] spelling is worse than usual today [edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
He wants to know if the line is a method definition. He's going about it very badly.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
ok , this is the first time i post a questions so i don't read
the guidlines
i mean when i read the line from the file
i need to know if this line is head of mehtod like
private string getSplit(string s)
or
string getSplit(string s)
or
private static string getSplit(string s)
so when i read the file i want to validate it (if this line a head of mehtod or not)
and sorry i'm not good in english
i hope u understand me
and thanks
|
|
|
|
|
zez0 wrote: ok , this is the first time i post a questions so i don't read
the guidlines
So, perhaps you should.
zez0 wrote: and sorry i'm not good in english
No-one will make fun of you for that, this is an international site.
As I said above, private and static are optional, so you should check if they are there, and disregard them if they are, but not require them. Just the fact that the rest looks like a full method call but has no semicolon should be all you really need beyond that, which you can do with a regex, but keeping track of braces is perhaps slightly more reliable.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: No-one will make fun of you for that, this is an international site.
so what ?
what's matter with your ?
if this is your way of your replay ,so i don't need your replay
|
|
|
|
|
I guess your English is REALLY bad. I just said that we will NOT make fun of you or care that your English is not good, because this site has users from all over the world.
zez0 wrote: if this is your way of your replay ,so i don't need your replay
I've given you the answer you need several times, and reassured you that your poor English is not an issue. I'd suggest you read my replies carefully again, and take a few deep breaths.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Use this[^] or this[^].
There are plenty of ways by which one can define methods. And thus, it won't be easy to take care of all the conditions while finding them in a cs file.
Another option could be to load the assembly instead of cs file then get the details through reflection.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
hi
how i can disable BT and WIFI in windows mobile, using C# ?
can i get sample code for it ?
thank's in advance
|
|
|
|
|
I searched google ( did you ? ) and confirmed that there's no standard way to do this, you'd need to read the documentation for the different devices you run on to see if they offer any sort of support that you can hook into.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
is there a generic solution ? something in the .net ?
|
|
|
|
|
Yes, there is. That's why I told you there isn't, because it's *secret* knowledge, and I didn't want to tell you unless you REALLY wanted to know.
Seriously. I just told you, I used google to do the basic research you should have done, and confirmed there is nothing in .NET, no standard way to do this.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all i have a code in to show Date to Date report.When i compile and run it, it cannt show any error but when it run in browser it takes too much time to load and no result is shown. I take this code from an article and i want to implement it. Plz help y it even show parameters and reports???
protected void btnShow_Click(object sender, System.EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("CrystalReport3.rpt");
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
ParameterFieldDefinitions crParameterFieldDefinitions ;
ParameterFieldDefinition crParameterFieldDefinition ;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value =txtFrom.Text;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Date1"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue.Value = txtTo.Text;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Date2"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crConnectionInfo.ServerName = "Server1";
crConnectionInfo.DatabaseName = "Coupon Management.mdf";
crConnectionInfo.UserID = "";
crConnectionInfo.Password = "";
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
CrystalReportViewer2.ReportSource = cryRpt;
CrystalReportViewer2.RefreshReport();
}
|
|
|
|
|
Do you have the vaguest idea what this code does ? Have you stepped through it to see where it gets stuck ? Are the values being passed in correct for your database, or did you just copy random code ? I am guessing you don't have a Coupon Management.mdf, or you have some other issue that's causing the database connection to time out, hence the wait.
Either way, programming and copying random code off the web, THEN asking us to make it work for you ( without even giving us the info we need to try to work out why it's not running ), are two different things. If you're being paid for the latter, you should tell your client you don't know what you're doing. If you're trying to learn, you shouldn't start with random code snippets, you should start with a book.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have a class that takes a constrained generic type and I need to know whether that type will be boxed when I call the Equals method.
class FUBAR<T> where T : struct
{
bool DoSomething(T a, T b)
{
return a.Equals(b);
}
}
|
|
|
|
|
Use ildasm to check.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Why can't you just use the == operator ? How do they differ from each other ? Is that not possible because of the generic type ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Its not possible because structs do not implement the == operator implicitly.
|
|
|
|
|
Oh, of course. I was thinking of IComparable, but that has a CompareTo method, not ==. Generics in C# are woefully underpowered compared to C++. I don't think they are good for much more than containers of type T.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|