|
You want to create a custom progress bar? Or just use the one thats already provided?
Either way, the webiste is packed full of tutorials, just type 'progress bar' into the search box up there ^
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
|
How do i align my form to the bottom left of my screen?
|
|
|
|
|
In the Properties screen of your form, set the startup position of your form to manual. Then change the location to where you want the form.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Do you want the form to show up in the bottom left corner of your screen,
and remain there (unmoveable)?
Edit: If this is the case, then you could do it by adding these lines of code in your form's constructor:
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(0, SystemInformation.WorkingArea.Height - this.Height);
Note: This doesn't make the form unmoveable. I'm still looking for a way to do that. Perhaps you could set a timer that moves the form back to the same location at a given interval - but that's a ugly way to do it, honestly.
Edit #3 : Here a way to make the form "unmoveable", that is, it's still moveable, but as soon as the user releases the mouse button, the form "jumps" back to it's default position.
Set the form's Move event handler, and write the following code:
this.Location = new Point(0, SystemInformation.WorkingArea.Height - this.Height);
And that works!
Virtual1ty "Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Thanks. I thought there might be a propery to do the work for me. Guess not (getting lazy with 2.0)Framework)
|
|
|
|
|
Yeah, I was hoping that there was a property to do that, but it seems there isn't.
Virtual1ty "Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
hy everyone!
i want to parse a file which contains a lot of info, some info is not necessary for my application but some is. so i have to look for this kind of information by parsing the file and extract it. i found a solution for my problem but i am not very happy with it.
my lines start either with f or d where f is for format and d is for data. the f line describes where which info could be found in the d line which follows. e.g.
fname,address,postalcode,city,phone,fax
dsmith|new street 11|1234|new town|123456|234567
now i want to extract lets say the phone number. lets say i do have 20 lines like above which should be parsed one by one. my problem ist i can't just search for phone, because first i will get more than one hit and second i have to know the index, meaning where it is located in the f-line to find the data in the d-line. i do only want to extract the data which can be found in the d-lines, the f-lines are only there to get the index where the data is stored in the line. (it's always a f-line - d-line combination in the whole file. so some kind of valuestrings).
i could read line by line out of the file and check if a token is in it. if it is not then the line is of no interest, if there is then i have to tokenize it. but what if i want to extract more than one info? lets say i want to extract phone than it is quit simple, but what if token1 is in it and token2 isn't (for what reason ever) and it is the token i used to search for? normally every line should look the same so i could just use one which is in there for sure.
example
fone,two,three,four
d1,2,3,4
ftwo,three,four,five
d2,3,4,5
fname,address,postalcode,city,phone,fax
dsmith|new street 11|1234|new town|123456|234567
fname,address,postalcode,city,phone,fax
dsmith1|new street 121|12324|new town|1232456|2234567
fname,address,postalcode,city,fax <=
dsmith2|new street 131|12334|new town|2334567 <=
ffoo,foo2,foo3,foo4
d1,2,3,4
ffoo2,foo3,foo4,foo5
d2,3,4,5
so with my current solution i would search for a line with phone in it, then split the info by tokenizing it and extract the data. but if the entry is no longer in it (see line with <=) i am lost and have to change the algorithm. does someone of you have a better solution how to find the line or even to realize it is a line which is worth tokenizing (because lines with data of no interest should be left behind because of performance reasons!).
i hope i was able to describe my problem well enough so you could get the gist of what my current problem looks like.
thanks.
stephan.
-- modified at 10:53 Wednesday 24th October, 2007
|
|
|
|
|
|
Hi,
I'm sure this has been discussed before, but I can't seem to put my finger on any article useful to my problem.
What I'm trying here is to use Generics through a method with this signature:
public T Read<t>(string section, string key, T defaultValue)
There is a value associated with the specified section-key. I'd like to be able to convert the said value as either a bool, an int, a float or a string.
My problem is that I can't enforce a constraint on the generic T to be of those common data types. Boolean, for example, is a struct, and the constraint must be an Object.
Is there something I'm missing, or must I use some workarounds to this issue (no generics, wrapping data types, ...)?
Thanks!
|
|
|
|
|
If you have a set list of say four items, then you don't need to use generics. You can simply build overloads of the Read method that takes each type, for example:
public bool Read(string section, string key, bool defaultValue) {
}
public int Read(string section, string key, int defaultValue) {
}
etc...
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I just want realize the following:
I plot two lines in a panel, and now I want to use mousemove to select the two lines. Just like most software, a dashed rectagle is displayed during mouse moving. If the lines are within this rectagle, then the lines are selected.
Now I have one problem, during mouse moving, the panel is required to refresh and update continuously, then the lines are also update again and again during mouse moving, then it gives flash effect. How to avoid to update the lines during mouse moving?
thanks !
|
|
|
|
|
Just use double buffering, then all your flicker will be gone. I beleive its as simple as:
this.DoubleBuffer = true;
or something like that.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi, thanks,
however, it does not work, where should I put this command? in the Paint() function or somewhere else?
|
|
|
|
|
Have you tried SuspendLayout and ResumeLayout ?
SuspendLayout on mousedown and resume on mouseup.
If it' stuck, DO NOT pull harder!
|
|
|
|
|
I plot in a panel, if you set: this.DoubleBuffered=true, it can be effective for the panel?
I have tried SuspendLayout and ResumeLayout , it does not work either.
because the lines and rectagule are both updated simutaneously in the paint() function. How can I update the rectagle lines without updating the lines?
|
|
|
|
|
Hi,
I just tried to plot in a panel, it does work!
I think now the problem is: if I plot in a panel, how to do it.
thanks a lot
|
|
|
|
|
i dont understand your question.
can you post some code?
If it' stuck, DO NOT pull harder!
|
|
|
|
|
sorry, I mean if I plot in a form, it does work, but if I plot in a panel (I use splitcontainer) how to make it work.
///////////////////////////////////////////////////////////////////////////////////
for example: plot in a form: (it works)
using System.Drawing;
using System.Drawing.Drawing2D;
namespace GDI__Test
{
public class Form1 : Form
{
private GraphicsPath _oShape;
private Pen _oPen;
private SolidBrush _oBrush;
public Form1()
{
base.SetStyle(ControlStyles.DoubleBuffer, true);
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
_oShape = new GraphicsPath();
_oPen = new Pen(Color.Black, 2.0F);
_oBrush = new SolidBrush(Color.Yellow);
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
_oShape.Dispose();
_oShape = new GraphicsPath();
_oShape.AddEllipse(e.X, e.Y, 100, 150);
_oShape.CloseFigure();
this.Invalidate();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics loGraphics = e.Graphics;
loGraphics.SmoothingMode = SmoothingMode.AntiAlias;
loGraphics.FillPath(_oBrush, _oShape);
loGraphics.DrawPath(_oPen, _oShape);
}
}
}
////////////////////////////////////////////////////////////////////
//plot in the panel: (it does not work!)
...
private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e) {
Graphics loGraphics = e.Graphics;
loGraphics.SmoothingMode = SmoothingMode.AntiAlias;
loGraphics.FillPath(_oBrush, _oShape);
loGraphics.DrawPath(_oPen, _oShape);
}
|
|
|
|
|
hi.. i had a chance to try this.
change
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
_oShape.Dispose();
_oShape = new GraphicsPath();
_oShape.AddEllipse(e.X, e.Y, 100, 150);
_oShape.CloseFigure();
this.Invalidate();
}
to
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
_oShape.Dispose();
_oShape = new GraphicsPath();
_oShape.AddEllipse(e.X, e.Y, 100, 150);
_oShape.CloseFigure();
splitContainer1_Panel2.Invalidate();
}
and use the splitcontainer mousemove method.
but then it flickers since there's no setstyle on the panel.
If it' stuck, DO NOT pull harder!
|
|
|
|
|
thanks a lot.
I found the solution for panel:
public class DoubleBufferPanel : Panel
{
public DoubleBufferPanel()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}
}
then and a new DoubleBufferPanel to the current panel, then plot everyting on this new panel, it works.
|
|
|
|
|
Dear All,
I can enable/disable(install/uninstall) serial port through device manager. But I have to do it
through programming . How can i do that in C#? Please help.
Thanks in advance
Nasif
|
|
|
|
|
I haven't checked it but a good start would probably be connecting to the management console. Apparently there is a new MMC class in .Net 3.0
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Hi, I posted the following mesage to a wrong forum earlier. Hope you can forgive me. Here is the re-post:
I tried to find an answer for while but could not get one. Here is the code to send ONE email:
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
mail=null;
However, if you want to send the email to thousands of each individual email address, do you place the loop outside of this code block or inside?
if outside, the mail object is created and destroyed in every loop:
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
mail=null;
}
if inside, the mail object is created once:
MailMessage mail = new MailMessage();
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
}
mail=null;
Which is the proper way or does not really matter?
Thanks,
TOMZ_KV
|
|
|
|
|
I feel i've seen this before...
Why not try:
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
mail.To = RecipientEmail;
SmtpMail.Send(mail);
}
mail=null;
Assuming that the subject, message, and server all stay the same.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|