|
Brian_TheLion wrote: Can you use this to auto add text to a rich text window on a form when you ... Theoretically, given the right structure, and valid references to run-time objects, the handler(s) that subscribe to the event can do anything any other method can do.
Take a look at the examples here: [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 30-May-19 11:01am.
|
|
|
|
|
@Brian_TheLion good article on INotifyPropertyChanged: [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Using Properties - C# Programming Guide | Microsoft Docs
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Gerry, I'm grateful for any knowledge I receive.
Brian
|
|
|
|
|
Hello,
I'm on WinForms and my window is FormBorderStyle.None. If the window is maximized and I drag the taskbar from the bottom to the side, the maximized window will not be adjusted to the new size. Events like LocationChanged, SizeChanged or Resize doesn't fire. What can I do?
Greetings
Ken
|
|
|
|
|
|
Hi Eddy,
this looks like a solution for WPF. But i'm on WinForms.
Greetings
|
|
|
|
|
It looks? So you stopped reading eh?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Sorry, I know AppBar in WPF-Context. I took another look at it and compiled it. Looks promising.
|
|
|
|
|
First: the guidelines for Win apps warn against forcing the users to use some "fixed" style of UI: whether taskbar(s) auto-hide, and, where they are located, are usually left up to the user. Exceptions to this are "kiosk" apps, and single-purpose machines deliberately configured a certain way. Think long and hard before locking your user into a certain window configuration. Or, think about creating your own virtual desktop [^].
If you are showing a WinForm with 'WindowState = FormWindowState.Maximized, it will fill the screen completely, covering any TaskBars that are not hidden.
So, I do not understand your question ... yet.
Do you have experience with interop in C# using the Shell ... i.e., using WndProc, using P/Invokes ?
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 28-May-19 23:36pm.
|
|
|
|
|
Hi Bill,
"
If you are showing a WinForm with 'WindowState = FormWindowState.Maximized, it will fill the screen completely, covering any TaskBars that are not hidden. "
I've solved this problem already with
private void frmMain_Load(object sender, EventArgs e)
{
MaximizedBounds = Screen.FromHandle(Handle).WorkingArea;
WindowState = FormWindowState.Maximized;
}
But: My application doesn't receive any event, that informs about the movement of the TaskBar. If i set FormBorderStyle.Sizeable everything is OK.
Do you have experience with interop in C# using the Shell ... i.e., using WndProc, using P/Invokes ?
Yes, i have.
Greetings
|
|
|
|
|
Ken Guru wrote: If i set FormBorderStyle.Sizeable everything is OK. Please explain this further; it's "ok" because ? happens, or, because the user can ... ?
Does any issue arise if other apps have windows set to 'TopMost.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Quote: I drag the taskbar from the bottom to the side
I think I did that once in the last 20 years.
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
You don't know our users
|
|
|
|
|
@Ken-Guru I think I've found a way to get you somewhat there: this works for me in VS 2017 using .NET 4.7. I set the Form 'WindowState to 'Normal, and the 'StartPosition to 'Manual because ... those settings "worked."
I tried using the old P/Invokes ... FindWindow and IsWindowVisible ... to try to get the state of TaskBar visibility, but kept getting a 'visible result even when the TaskBar was hidden.
Hopefully, you can take it from here, and please do post any better technique you may come up with.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Win32;
namespace MaxonTBarChange
{
public partial class Form1 : Form
{
public Rectangle AppBounds;
public Form1()
{
InitializeComponent();
AppBounds = Screen.PrimaryScreen.WorkingArea;
this.Bounds = AppBounds;
SystemEvents.UserPreferenceChanged += SystemEventsOnUserPreferenceChanged;
this.Closing += OnClosing;
}
private void OnClosing(object sender, CancelEventArgs e)
{
SystemEvents.UserPreferenceChanged -= SystemEventsOnUserPreferenceChanged;
}
private void SystemEventsOnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
var bnds = Screen.PrimaryScreen.WorkingArea;
if (AppBounds != bnds)
{
AppBounds = bnds;
this.Bounds = AppBounds;
}
}
}
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 31-May-19 2:17am.
|
|
|
|
|
Can you send me dll code in how to download pdf file link in mail.
|
|
|
|
|
No.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The only code you get is the code YOU write.
We're not here to do your work for you.
modified 28-May-19 14:01pm.
|
|
|
|
|
Note: to use the code shown here, you must enable C# 8 preview in VS 2019; see: [^]
Good grief: infix notation for a 'switch that returns something; expression bodies; no use of 'default. I find the necessity to declare a new explicitly typed variable before using 'when tedious, but, thank the godz you can't use 'var !
int offset = '9' + '0';
public char EncodeChar(char ch)
{
return ch switch
{
Char c when Char.IsDigit(ch) =>
(char) (offset - ch),
Char c when Char.IsUpper(ch) =>
ch == 'Z' ? 'Y' : (char) (ch - 1),
Char c =>
ch == 'z' ? 'a' : (char) (ch + 1)
};
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 3-Jun-19 8:03am.
|
|
|
|
|
It's ugly, isn't it?
I think they are trying to convert it into C++ myself - the recent additions don't seem to improve the language, just complicate the code and make it less readable.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Well, I experience it as weird, as potentially high risk in terms of code maintenance, but I wouldn't say "ugly." Wonder what Grady Booch ... "The function of good software is to make the complex appear to be simple." ... would think.
I find even weirder the use of an underscore character as a "finalizer" in 'switch, as in this example:
string Display(object o)
{
return o switch
{
Point p => $"({p.X}, {p.Y})",
_ => "unknown"
};
} source: [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
As long as they don't take away the old way to do stuff, I don't give a pair of flyin' donkey testicles what kinda bullsh*t they add to the language.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
The problem is that the "new boys" will use the new stuff, even if the older way is more appropriate.
Which means that we will have to deal with it as maintenance in future...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm fairly close to retirement.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OriginalGriff wrote: Which means that we will have to deal with it as maintenance in future... You mean rewrite it to resemble something that is remotely acceptable
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|