|
Repost: this is the same problem you asked about 3 days ago: Printe page limit - C# Discussion Boards[^]
Don't repost the same question repeatedly - it just wastes time and effort!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Looking at your code with a very limited understanding of the domain, I am wondering if
Member 14192216 wrote:
string deviceInfo =
@"<DeviceInfo>
<OutputFormat>EMF</OutputFormat>
<PageWidth>{pageSettings.PaperSize.Width * 100}in</PageWidth>
<PageHeight>{pageSettings.PaperSize.Height * 100}in</PageHeight>
<MarginTop>{pageSettings.Margins.Top * 100}in</MarginTop>
<MarginLeft>{pageSettings.Margins.Left * 100}in</MarginLeft>
<MarginRight>{pageSettings.Margins.Right * 100}in</MarginRight>
<MarginBottom>{pageSettings.Margins.Bottom * 100}in</MarginBottom>
</DeviceInfo>"; is meant to be an interpolated string. If so, try changing the @"..." to $@"..." so that the expressions inside {...} sections are evaluated. It may be that the uninterpolated values are being treated as invalid number, which are treated a undefined items so the defaults for the geometry are used.
|
|
|
|
|
You're confusing "logical" printing and "physical" printing.
There is no evidence that the "thermal printer" understands what you're sending it. (thermal printers can have their own "language")
You start by sending "one line" / chaeacter to the printer. When that works, you'll have some confidence you're on the right track; otherwise, you're just grasping.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
|
I only found "commercial" "high performance" charting software. For open-source, it's not a priority.
And then you need to choose Windows Forms and / or WPF, etc.
If it is static or dynamic (I needed dynamic for a client). With static you could use a (WPF/UWP) ViewBox for scrolling.
For about $1000, you get to do less thinking about it.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
@honeythecodewitch
Check out honeythecodewitch's work on IOT controller graphics: [^].
I'd say she is the right person on CP to advise you.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
The C# part should give you a clue that the "graph/diagram" IS NOT running on an IOT; but obviously not.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
If you were familiar with the range of HTC's projects, and her competencies ...
You would have to find another way to troll.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
More than you apparently; HTC is using C++.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Any idea why the standard:
Form2.Show()
wouldn't be working for me? I'm trying to link a menu button to another form.
|
|
|
|
|
It doesn't like you?
Seriously. How could anybody guess why it's "not working" when you have provided no details whatsoever?
And "not working" is not a proper description of a problem.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I am attempting to link a form to a menu button. The button is an "about" for the app, named FormAbout.
<
private void menAbout_Click(object sender, EventArgs e)
{
FormAbout formabout = new FormAbout();
FormAbout.Show();
}
this is my latest attempt. Still brings up an error:
Severity Code Description Project File Line Suppression State
Error CS0120 An object reference is required for the non-static field, method, or property 'Control.Show()' StraightlineDepreciationCalculator C:\Users\koval\source\repos\StraightlineDepreciationCalculator\StraightlineDepreciationCalculator\Straightline Depreciation Calculator.cs 208 Active
|
|
|
|
|
Good. the answer is easy.
You are calling Show on the wrong name. You are calling it on FormAbout when you need to be calling it on formabout.
FormAbout is the type name. formabout is the instance name.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks, I knew it had to be something easy. Spent way to much time on that, lol. Doing my best as a beginner.
|
|
|
|
|
If it starts with a capital letter, you're probably accessing a class name instead of an (local) object instance.
(For the Troll, that assumes one has naming standards).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
modified 23-Jun-21 12:21pm.
|
|
|
|
|
Thank you for clearing that up for me.
|
|
|
|
|
Hey guys,
As a beginner I'm going through exercises to try an learn the basics of C#. This exercise calls for a straightline depreciation to be calculated with user entering inputs for present value, salvage value, and years of depreciation. I'm stuck at this point and don't know how I should proceed -- if anyone can review and provide me with some direction it would be appreciated!
<
namespace StraightlineDepreciationCalculator
{
public partial class frmStraightlinedDepreciationCalculator : Form
{
public frmStraightlinedDepreciationCalculator()
{
InitializeComponent();
}
private void btnClear_Click(object sender, EventArgs e)
{
txtPresentValue.Text = "";
txtSalvageValue.Text = "";
txtYearsOfDepreciation.Text = "";
txtDisplay.Text = "";
txtPresentValue.SelectAll();
txtPresentValue.Select();
}
private void btnExit_Click(object sender, EventArgs e)
{
DialogResult dlgresult;
dlgresult = MessageBox.Show("Do you want to exit the application?", "Close the form", MessageBoxButtons.YesNo);
if (dlgresult == DialogResult.Yes)
{
System.Environment.Exit(1);
}
else
{
txtPresentValue.Select();
}
}
private void btnCalculate_Click(object sender, EventArgs e)
{
double dblPresentValue = 0;
double dblSalvageValue = 0;
int intYearsOfDepreciation = 0;
int intCounter = 0;
string strDisplay = "";
txtDisplay.Text = "";
dblPresentValue = Convert.ToDouble(txtPresentValue.Text);
dblSalvageValue = Convert.ToDouble(txtSalvageValue.Text);
intYearsOfDepreciation = Convert.ToInt32(txtYearsOfDepreciation.Text);
if (dblPresentValue < 1 | dblPresentValue > 1000000)
{
MessageBox.Show("Present value must be between $1 and $1,000,000");
txtPresentValue.Select();
txtPresentValue.SelectAll();
}
else if (dblSalvageValue > dblPresentValue)
{
MessageBox.Show("Salvage value cannot be greater than Present Value");
txtSalvageValue.Select();
txtSalvageValue.SelectAll();
}
else if (intYearsOfDepreciation < 0 | intYearsOfDepreciation > 25)
{
MessageBox.Show("Years of Depreciation must be in 1 - 25 range");
txtYearsOfDepreciation.Select();
txtYearsOfDepreciation.SelectAll();
}
else
{
strDisplay = "Year Asset Value/r/n------- ---------------";
}
}
}
}
|
|
|
|
|
What do you need help with?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
getting a proper straightline depreciation calculation + display. I'm stuck, not sure where to go from here.
|
|
|
|
|
Well, do you know what "straight line depreciation" is?
How do you work it out manually?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Getting it to work this way, just need to display as currency now. Thanks for looking.
<
strDisplay = "Year Asset Value\r\n------- ---------------";
double period = (dblPresentValue - dblSalvageValue)/intYearsOfDepreciation;
int curYear = DateTime.Now.Year;
while (intCounter < intYearsOfDepreciation)
{
strDisplay += "\r\n"+ curYear.ToString() + ": " + dblPresentValue.ToString();
intCounter = intCounter + 1;
dblPresentValue -= period;
curYear++;
}
txtDisplay.Text = strDisplay;
|
|
|
|
|
Are you trying to display the end result and what does this show.
Member 15248867 wrote: txtDisplay.Text = strDisplay;
Or do you want to display each iteration, in which case you need to use a listview for display.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Depreciation is a declining balance calculation; the amount depreciated is higher in the first years than the last. The difference between principal and salvage represents a capital gain or loss.
If the principal is 100 and depreciation is 20%, then:
year 1: 100 @ 20% = 20 and 80 (depreciation and remaining principal)
year 2: 80 @ 20% = 16 and 64
year 3: etc.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I had assumed that ThenBy had to be executed immediately on the result of an OrderBy call.
I found out that is incorrect: as long as you call ThenBy on an IOrderedEnumerable<T> ... and, of course, you have your argument types correct ... it will perform as expected.
This is useful to me in an Extension I am working on where run-time parameters may determine if a ThenBy is used; may it be useful to you :")
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 21-Jun-21 8:33am.
|
|
|
|
|
As far as I can see, the LINQ ThenBy extension method only works if the argument type is IOrderedEnumerable<T> or IOrderedQueryable<T> . If you try to call it on an IEnumerable<T> or IQueryable<T> , you'll get a CS1061 compiler error even if the run-time type is an ordered enumerable/query.
Enumerable.ThenBy Method (System.Linq) | Microsoft Docs[^]
Queryable.ThenBy Method (System.Linq) | Microsoft Docs[^]
So these will work:
IEnumerable<T> source = ...;
IOrderedEnumerable<T> result = source.OrderBy(x => x.Foo).ThenBy(x => x.Bar);
IEnumerable<T> source = ...;
IOrderedEnumerable<T> sorted = source.OrderBy(x => x.Foo);
IOrderedEnumerable<T> result = sorted.ThenBy(x => x.Bar); But these will not:
IEnumerable<T> source = ...;
IOrderedEnumerable<T> result = source.OrderBy(x => x.Foo).Where(x => x.IsActive).ThenBy(x => x.Bar);
IEnumerable<T> source = ...;
IOrderedEnumerable<T> sorted = source.OrderBy(x => x.Foo);
IOrderedEnumerable<T> result = sorted.Where(x => x.IsActive).ThenBy(x => x.Bar);
IEnumerable<T> source = ...;
IOrderedEnumerable<T> result = source.OrderBy(x => x.Foo).AsEnumerable().ThenBy(x => x.Bar);
IEnumerable<T> source = ...;
IOrderedEnumerable<T> sorted = source.OrderBy(x => x.Foo);
IOrderedEnumerable<T> result = sorted.AsEnumerable().ThenBy(x => x.Bar); Of course, if you're using reflection or the LINQ Expressions API, then a call to ThenBy should work, so long as the parameter has the correct run-time type.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|