|
I opened the .exe file and ICSharpCode.SharpZipLib.dll with a hex editor and found these instances in both files. Does this mean that the source code is located there?
|
|
|
|
|
You obviously have no idea what source code is. It's the original text language that is run through a compiler to get the resulting .EXE and .DLL's you're looking at in a hex editor. There are disassemblers that will show you a decent approximation of the source code but they won't do you any good as you can't modify the code in them.
|
|
|
|
|
I have used a windows application, that shows a battery meter progress bar (the same thickness as the taskbar), instead of a notify Icon. I want to know if this is possible in c#, and if so, how can I do it?
I would like to display a progress bar, the same thickness as the taskbar, next to the clock.
If someone could show me how to do this with some sample code, I would really appreciate it.
Thanks.
What I want is to display a progress bar, that it's percentage gets updated the same time the progress bar in my main form gets updated.
A solution, from the top of my head, would be to take a snapshot of the main progress bar continuously and use that as an icon.
This is an example of what I want (The battery meter that shows 98%):
http://superuser.com/questions/130889/how-can-i-turn-off-the-battery-meter-on-my-thinkpad-t500[^]
modified 6-Mar-15 12:59pm.
|
|
|
|
|
There are examples on showing a NotifyIcon. A progressbar could be made by simply changing the picture.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The solution I use is the same as the windows file copy, and browser downloads: show the progress as part of the task bar icon - which windows can do automatically from 7 onwards.
If you have a look at this https://www.nuget.org/packages/Microsoft.WindowsAPICodePack-Shell/[^] it makes it really easy!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I looked at the website, and installed the code pack, but I still don't know how to use it.
Can you please tell me where can I find some tutorial on how to use this?
Thanks.
|
|
|
|
|
|
|
I viewed the examples, and the only thing that I could find was an application that displays its progress in the icon that appears in the taskbar. That's not exactly what I'm looking for.
What I'm looking for, is a way to display an actual progress bar in the notification area, besides the clock, and the only example that I saw that came close to it was the taskbar demo.
Please tell me if this can be done.
See example:
|
|
|
|
|
Just a guess on my part here but I think you need to look adding a new toolbar to the task bar. Like the quick launch, windows search, links and address.
You are going to want to actually display something on the task bar.
I found this on CodeProject: Windows 7 Taskbar C# Quick Reference.[^]
I'm sure that this is detailing the actual icons on the task bar but it might be a start.
Jack of all trades, master of none, though often times better than master of one.
|
|
|
|
|
What I need is to use a deskband, in order for me to place a control in the taskbar, the only thing is I don't know how to.
Can someone please help me, by telling me how to use a deskband?
Thanks.
|
|
|
|
|
I have used an animated tray icon in years past. With images for every 10% or something then change the icon when the progress bar gets to those levels. 10% might be kinda tight for a tray icon.
Try this link @ StackOverflow for a couple of links.[^]
I didn't look at the links just pulled a quick search.
HTH
Jack of all trades, master of none, though often times better than master of one.
|
|
|
|
|
Hi All
There is a strange behaviour in my code ...
I have a TextBox where i handle Doubleclick and call a simple form that contain a calendar so i can pick a date from it.
When TextBox_DoubleClik create the form i pass the TextBox to Form's costructor.
The form have ONLY the MonthCalendar control and haven't control box (no close with X).
If i click outside the form an handler on form's DEACTIVATE event call this.close().
When i change a date on MonthCalendar, an handler on monthcalendar's DATECHANGED set the selected date to property TEXT of my TextBox and in my intention the form should be closed ... but if use this.close() i have the run.time error: System.ObjectDisposedException (i think that the error is referred by monthcalendar why ?)
the other, and MOOORE strange, behaviour is that if i add a couple of messagebox.show(...) before this.close() the first messagebox is IGNORED and the Exception is disappeared!!!
Can Anyone halp me to solve this misteries ???
Below some pieces of code from my project:
NB: txtBase is my class derived by TextBox
// This is the code tha i used to call my datepickerform
private void txtBase_OnDoubleClick(object sender, EventArgs e){
txtBase sd = (txtBase) sender;
txtBaseDatePicker DP = new txtBaseDatePicker(sd);
DP.Show();
}
// This is main code of my form with mnthcalendar control
public partial class txtBaseDatePicker : Form
{
private TextBox txtDate;
public txtBaseDatePicker(TextBox TB):this(){
txtDate = TB;
}
public txtBaseDatePicker(){
InitializeComponent();
}
// Handler of event DateChanged of monthcalendar (cal)
// this.cal.DateChanged += new System.Windows.Forms.DateRangeEventHandler(this.CalDateSelected);
void CalDateSelected(object sender, DateRangeEventArgs e){
MonthCalendar s = (MonthCalendar) sender;
// This.Close() throw an exception ....
// but if i active the following two lines the exception disappeare and the first
// MessageBox doesn't work!
//MessageBox.Show("MSG 1 (Absorbed)");
//MessageBox.Show("MSG 2");
this.txtDate.Text = s.SelectionStart.ToString().Substring(0,10);
this.Close();
}
void TxtBaseDatePickerDeactivate(object sender, EventArgs e){
this.Close();
}
}
PS: I solved "temporarily" with a timer that after 200 ms call this.close() but i dislike this trick ... in italy i say "This is not his Mother"!
modified 6-Mar-15 4:29am.
|
|
|
|
|
Why not just add a DateTimePicker[^] control to your main form? Also you should use ShowDialog for your child form (not Show ) so that it closes automatically when it is finished.
|
|
|
|
|
I don't use datetimepicker because i want use my txtbox class to accept any type of input.
I want that every txtBox (masked with date type) open & destroy it's own formpicker. I Call Show() method and not ShowModal() because i want that the form disappeard when the user click outside of the form.
ANYWAY ... my initial question haven't an answer ... why only adding two messagebox i can avoid an exception ?
|
|
|
|
|
Emanuele Bonin wrote: why only adding two messagebox i can avoid an exception ? Not sure, but something is definitely wrong with your code.
|
|
|
|
|
I'm not an expert and could be that i wrote something wrong.
This behaiour is very strange and the code is not complicated.
So i try to post below the complete code part to reproduce the problem.
What is wrong in my code ?
Is Wrong to create a form on the fly (local variable) pass to it a textbox so called it with Show() instead of ShowModal() ? This type of code is not acceppted to the garbage collector ?
Or there is some other problem ?
The below code is completed so is possible to reproduce the problem double cliccking on textbox and selecting a date.
using System;
using System.Windows.Forms;
using System.Drawing;
namespace TestDataPicker
{
internal sealed class Program
{
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
public class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
void TextBox1DoubleClick(object sender, EventArgs e)
{
TextBox sd = sender as TextBox;
txtBaseDatePicker DP = new txtBaseDatePicker(sd);
DP.Location = sd.PointToScreen(Point.Empty + (Size)new Point(0, sd.Height));
DP.Show();
}
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.TextBox textBox1;
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
this.textBox1.Location = new System.Drawing.Point(40, 54);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(144, 20);
this.textBox1.TabIndex = 0;
this.textBox1.DoubleClick += new System.EventHandler(this.TextBox1DoubleClick);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.textBox1);
this.Name = "MainForm";
this.Text = "testdatapicker";
this.ResumeLayout(false);
this.PerformLayout();
}
}
public partial class txtBaseDatePicker : Form
{
private TextBox txtDate;
public txtBaseDatePicker(TextBox TB):this(){
txtDate = TB;
}
public txtBaseDatePicker(){
InitializeComponent();
}
void CalDateSelected(object sender, DateRangeEventArgs e){
MonthCalendar s = (MonthCalendar) sender;
this.txtDate.Text = s.SelectionStart.ToString().Substring(0,10);
/////////////////////////////////////////////////////////////////////////////////////////////////////
///// STRANGE BEHAVIOURS ///////////
//
//this.CloseForm.Enabled = true; // Enabling timer 200 millisecond that close form all OK!
// eliminating one messaebox raise an exception
MessageBox.Show("1"); // this message will be supressede
MessageBox.Show("2");
this.Close(); // <-- This raise an exception
///////////////////////////////////////////////////////////////////////////////////////////////////
}
void TxtBaseDatePickerDeactivate(object sender, EventArgs e){
this.Close();
}
void CloseFormTick(object sender, EventArgs e)
{
this.CloseForm.Enabled = false;
this.Close();
}
///
/// Designer variable used to keep track of non-visual components.
///
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.MonthCalendar cal;
private System.Windows.Forms.Timer CloseForm;
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.cal = new System.Windows.Forms.MonthCalendar();
this.CloseForm = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
this.cal.Location = new System.Drawing.Point(4, 2);
this.cal.Name = "cal";
this.cal.TabIndex = 0;
this.cal.DateChanged += new System.Windows.Forms.DateRangeEventHandler(this.CalDateSelected);
this.CloseForm.Interval = 200;
this.CloseForm.Tick += new System.EventHandler(this.CloseFormTick);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.ClientSize = new System.Drawing.Size(232, 169);
this.ControlBox = false;
this.Controls.Add(this.cal);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "txtBaseDatePicker";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Deactivate += new System.EventHandler(this.TxtBaseDatePickerDeactivate);
this.ResumeLayout(false);
}
}
}
|
|
|
|
|
I assume that Close() causes an OnDeactivate-Event if the Form was active at that point. So the first call to Close() in CalDateSelected(..) will dispose the Form and then due to the pending OnDeactivate-Event Close() gets called a second time in TxtBaseDatePickerDeactivate(..). If this assumption is correct, it should work if you unsubscribe from the OnDeactivate-Event (this.OnDeactivate -= TxtBaseDatePickerDeactivate) in CalDateSelected(..) before calling Close().
|
|
|
|
|
I've noticed this behaviour ... closing form call deactivate .... but even if i suppress the Close () in deactivation the problem persist.
I tryed to unsubscribe ... but nothing ... no cigar i'm sorry 8) ...I suspect that the problem is inside MonthCalendarControl.
The only way to close after assign the date actually is use a Timer that after 200 ms call this.close ... i think that this de-link the close to the calnedar event.
|
|
|
|
|
imho your design is doing a lot of unnecessary work, and you can simplify this easily; if you ask here, I'll show you another way to do so.
One way to increase the encapsulation of your objects is to expose/transmit only the "minimum" that clients of those objects need to have.
You pass an entire TextBox into your Form with a MonthCalendar. I propose to you that you don't need to pass anything to the Form with MonthCalendar.
Equally less-than-optimal, imho, would be to expose the entire MonthCalendar to the main Form.
imho, what is desired is that when your MonthCalendar's SelectionRange is changed, that it raise an Event ... which the Form with the TextBoxes has subscribed to, passing the SelectionRange, or whatever, back to the subscriber.
When the Form with TextBoxes gets the Event (callback), it can then easily insert whatever it has been passed (in the right form) in the current active TextBox.
Also, whether you use ShowDialog, or not, there's no need to create an instance of the Form with MonthCalendar every time you want to use it ! That's a total waste; it's so easy to re-use one instance of that Form.
«To kill an error's as good a service, sometimes better than, establishing new truth or fact.» Charles Darwin in "Prospero's Precepts"
|
|
|
|
|
Quote: You pass an entire TextBox into your Form with a MonthCalendar. I propose to you that you don't need to pass anything to the Form with MonthCalendar.
This choice was made because in my head the picker must disappear when user click outside of it so is necessary a modless form that can't return a value ...
The picker, in my head, should be static, i'm developing the ideas and design to create a Framework, initially i tryed in this mode ... but i can't explain to myself this problems.
Next step would be reuse (or use of a static datepicker).
Thanx for suggestion.
|
|
|
|
|
Yes, if you want the Picker Form to disappear when you click outside it, it cannot be shown modally, that's understood.
But, to me that's a separate issue, entirely. You just hide the Picker Form when it fires its Deactivate Event, and that should not cause the behavior you describe.
A MonthCalender Control is an "object:" whether it is "static" or not is a result of how you declared your reference to an instance of that object.
In my view, if you recreate the Picker Form each time you want to use it, that's the opposite of "static." This is static:
// in main Form
private static PickerForm dtPicker = new dtPicker(); // show and hide as needed
Learning how to raise custom events, and create custom event arguments for use with them as needed, is an important part of your .NET toolkit.
If you want to see an example, just ask.
cheers, Bill
«To kill an error's as good a service, sometimes better than, establishing new truth or fact.» Charles Darwin in "Prospero's Precepts"
|
|
|
|
|
Thankyou very much.
I know the concept that you describe, the problem is my my poor english.
My code is a first approach wrote without think to optimize the various aspect. Infact i'll change it. But my varoius question about my code (i posted the complete example) are born because the behaviour is very strange and i want to know why, indipendently from my intention. I can use many ways to avoid the problem ... but i want know why exist the problem.
Actually i don't know where my code is problematic or if there is a Bug in compiler ...
I try to repeat my last question using an example from my experience of ther language.
In VisualFoxPro when i declare a local variable and assign to it an object, the object is destroyed when the scope of variable id ended (unless the object haven't references to objects outside his scope). Now in my code i create an Obect Form with a local Scope to the dblclick event but i show it modless, this implies that after Show() the variable object Form reach his "out of scope", but form remain visible, so i can use it and pick my date. In VFP the form should be destroyed immediatly after show() caused by out of scope of object. My question is, the behaviour of DatePicker is correct or is a latency of garbage collector or some other things that i ignore ?
If i'm not clear please don't esitate to ask me again.
|
|
|
|
|
what is code in C# to multiply two bytes in GF(256) with a given primitive polynomial i.e. X^8+x^6+^x^4+1
|
|
|
|
|