|
AFAIK, there is a setting for the default size, but not for the maximum. It doesn't need a setting, as it is defined as the size of the screen (depending on settings, minus the taskbar).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
What is stopping you from editing the 'MaximumSize Property of your Form in the Property Browser at design-time ? Or, setting that Property at run-time ?
The one side-effect you may not expect ... if you have set the Form 'StartPosition to 'CenterScreen ... is that when you then 'Maximize, the Form may appear with its upper-left corner at screen upper-left.
You can deal with that by writing a Form 'ReSize event handler that does the "right thing" to center the Form in the screen area
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
this.Size = MaximumSize;
Rectangle scrn = Screen.PrimaryScreen.WorkingArea;
this.Left = scrn.Width / 2 - this.Width / 2;
this.Top = scrn.Height / 2 - this.Height / 2;
this.Refresh();
}
} And, of course, you could modify this to do something when the WindowState was 'Minimized. You can also do weird stuff like setting a Form Size larger than Screen Size.
However, I suggest you think long and hard about modifying the behavior of the Maximize, or Minimize, buttons on a WinForm. People often expect those to behave in a "standard" way. I have yet to see an actual case where having a WinForm sized larger than screen size was "good design."
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
I'm opening Windows Photo Viewer like this:
var process = new Process();
process.StartInfo.FileName = "rundll32.exe";
process.StartInfo.Arguments = @"C:\WINDOWS\System32\shimgvw.dll, ImageView_Fullscreen " + filename;
process.Start();
If it's already running, I want to close it.
1) How can I check if it's running. Task Manager shows multiple instances of RunDll32.Exe, but no info on what app their hosting.
2) Assuming I can tell if it's running, how can I close it?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
You could use its window title?
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
if (!String.IsNullOrEmpty(p.MainWindowTitle))
{
Console.WriteLine("Process: {0}\n ID: {1}\n Window title: {2}", p.ProcessName, p.Id, p.MainWindowTitle);
}
}
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I forgot - you want to kill it as well.
If the Title works, you can just kill the process:
if (p.MainWindowTitle == "Untitled - Paint")
{
p.Kill();
}
(Windows Photo Viewer is hidden on WIn10, and I don't want to faff with the registry to re-enable it, So I used Paint as an example)
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Ok, that did it. Thanks
Any way to determine if my app opened that instance of Windows Photo Viewer?
If it's not broken, fix it until it is
|
|
|
|
|
Only if you keep a list of the process instances you open - AFAIK windows doesn't keep a record of who opened processes.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Surely it would be simpler to hang on to the Process instance you've created? Then you can check its HasExited property, and call CloseMainWindow / Kill as necessary.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I have a server having an ODBC connection for Pervasive database.
I would like from my laptop to connect to that ODBC?
Is it possible? How can I do this using C#?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
Create a web service on the server and communicate with that to get database access.
|
|
|
|
|
I am developing a software to read some data from a text and plot the data in the c# chart using windows forms。However,I can't zoom the chart in Yaxis if i don't select a region and zoom it first.Who can tell me how to zoom a chart using up key automatically without zoom a region first?
|
|
|
|
|
That sounds suspiciously like functionality specific to whatever charting library you're using.
Without knowing that, it's pretty much impossible to tell you anything useful.
|
|
|
|
|
Can you select a region by code? If so, select some region in the middle of the currently visible part of the chart first, the apply the zoom.
|
|
|
|
|
hi
Quote: What are feature extraction methods in image quality assessment?
|
|
|
|
|
Combined with your other question below, this is sounding a lot like your homework.
And we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
hi
Quote: How can i extract image structural information based on SSIM index (IQA)?
|
|
|
|
|
By reading the documentation and writing some code.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace listeimagetest2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DirectoryInfo dir = new DirectoryInfo(@"C:\Users\Pictures\Images");
foreach (FileInfo file in dir.GetFiles())
{
try
{
this.imageList1.Images.Add(Image.FromFile(file.FullName));
this.imageList1.ImageStream.Add(Image.FromFile(file.FullName));
}
catch
{
Console.WriteLine("Ce n'est pas un fichier image");
}
}
this.listView1.View = View.LargeIcon;
this.imageList1.ImageSize = new Size(103, 147);
this.listView1.LargeImageList = this.imageList1;
for (int j = 0; j < this.imageList1.Images.Count; j++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex = j;
this.listView1.Items.Add(item);
}
}
}
}
|
|
|
|
|
|
Here's how I do it:
private ImageList images = new ImageList();
private void ShowImages(ListView lv, string path, string filter)
{
images.Images.Clear();
lv.LargeImageList = images;
lv.SmallImageList = images;
string[] files = Directory.GetFiles(path, filter);
int i = 0;
foreach (string file in files)
{
images.Images.Add(Image.FromFile(file));
lv.Items.Add(new ListViewItem { ImageIndex = i++, Text = Path.GetFileNameWithoutExtension(file) });
}
}
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
For my numerology program I need to get a word file binded to a number. For example, when the outcome in a textbox is 9, it must call a word/XML/HTML document and place that in a word document. Every calculation has is own outcome, that makes a complete report.
The end result has to be something like this.
Word file 1: Introduction
word file 2: Outcome textbox 1
word file 3: Outcome textbox 2.
word file 4: Contact information
The report is textfile 1 to 4 in order placed in word, or PDF
I knoe how to use Report Wizard with simple text in code as object, but not a complete word file with pictures and lay-out.
Inspired greetings, Wilco
|
|
|
|
|
I'm working on a WPF app that allows the user to specify in XAML the source of data on an Attached Property.
<MyControl DataSource="App.VehicleInfo"/>
This string could reference any part of the app. Given a string like "App.VehicleInfo", how can I get the instance of the VehicleInfo class off the App at runtime?
If it's not broken, fix it until it is
|
|
|
|
|
The (WPF) Application class has a Properties collection that you can use to store a reference to "VehicleInfo" with a corresponding string key.
|
|
|
|
|
You can use the Reflection methods for that. There is a function that allows you to do this, Assembly.CreateInstance(string) [^].
But the problem is, you need to have the object type defined at the compile-time before you can cast the object created, to the one you need. Since you don't know that, I would suggest that you limit the instance creation variability to a few that your application knows. For more on this, please read, Activator.CreateInstance(String, String) [^].
Have a look at these documentations, you will get an idea. Both of them require a cast to a type.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|