Form as Popup
Hi all,
I have a vb6 form that function as a popup menu and
autoclose when i click out of this form; for doing so I
use subclassing and win32 api.
How can I replicate this functionality entirely in .Net
without use Win32 api ?
Thank's Tag: HTMLHelp (CHM) embedded in a form Tag: 62008
lbhappy@263.net
I need to embed my windows form application into Word
documents.I know Word can be embed with Viso or Excel. I
think there must be someway to work with my applications.
How can I get it?
Any comments appreciated!
Robin.Liu Tag: HTMLHelp (CHM) embedded in a form Tag: 62004
BUG and FEATURE REQUEST in designer properties
Hi,
I have an enum (a bitfield with Flags attribute) that is in a user control
and at design time the form does NOT permit setting of multiple bits.
Will this be possible in future designers?
Thanks. Tag: HTMLHelp (CHM) embedded in a form Tag: 62001
WindowsFormsParkingWindow
Can someone tell me some more details about the WindowsFormsParkingWindow?In
my application (C#) in full screen mode I must deal with the
WindowsFormsParkingWindow.After I switched to full screen mode and click on
a child form (after some time) then the WindowsFormsParkingWindow
appears.See the code: /// <summary>
/// Switch the client to full screen or normal
display mode
/// </summary>
public bool FullScreen
{
get { return m_infullscreenmode; }
set
{
if(m_infullscreenmode !=
value) // only commence if the current mode is different from the
desired mode.
{
m_infullscreenmode = value;
if(m_infullscreenmode)
{
this.Menu = null;
if(this.WindowState == FormWindowState.Maximized) //gu (new) srs 211
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
panel1.Visible = false;
mFullScreen.Checked = true;
Displays.FullScreenSize(this);
}
else
{
this.mHide.Visible = false;
mFullScreen.Checked = false;
this.Menu = MainMenu;
panel1.Visible = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
if(mFullScreen.Checked) MLog.Info(3, "client.fullscreen");
else
MLog.Info(3, "client.normalscreen");
}
}
} Tag: HTMLHelp (CHM) embedded in a form Tag: 61999
Opening HTML files
Hallo,
I would like to make Help files in HTML. The only way I
found how to display these files is:
Dim pHelp As New ProcessStartInfo
pHelp.FileName = "explorer.exe"
pHelp.Arguments = "Help.htm"
pHelp.UseShellExecute = True
pHelp.WindowStyle = ProcessWindowStyle.Normal
Dim proc As Process = Process.Start(pHelp)
This works under Windows 2000, Windows ME but not under
Windows NT. Does anyone have a better approach?
Nigel... Tag: HTMLHelp (CHM) embedded in a form Tag: 61996
reusing winforms in .NET CF
Hi,
I am working on a GUI intensive application on .NET Cf in
C#. Most of my forms have very similar controls and
appearance. I have around 5 screens and want to use one
base form for all these screens and then customize this
form dynamically for each screen.
Please suggest me a suitable approach for the design.
Any pointers for sample applications will be very helpful.
Regards,
Vishal. Tag: HTMLHelp (CHM) embedded in a form Tag: 61994
Bringing a form to focus
Hello,
I have a launcher for a Windows Form application that will guard against
starting an already started application like the following:
private static Mutex singletonMutex;
static void Main(string[] args)
{
bool first;
singletonMutex = new Mutex(true, "MyApplication", out first);
if (first)
{
// process application startup
DoStartup(args);
}
else
{
MessageBox.Show("Application already running"); // YUCK!
}
}
Now the question is: How do I avoid using a message box instead bringing the
already started application to focus?
Thanks for any help.
/m Tag: HTMLHelp (CHM) embedded in a form Tag: 61993
[ANN] Xamlon Beta 1 - XAML for Windows.Forms
I am very proud to announce the pre-beta release of Xamlon!
Xamlon (pronounced "Zamelon," which rhymes with "avalon"), is a XAML runtime
library for the .NET Framework 1.1. Xamlon is not a 100% XAML/Avalon
compatible library, it was not designed to be, but rather uses some of the
same objects and syntax as XAML to provide the same power and capabilities
as XAML but for building "Windows.Forms" applications instead. Simply put:
"Xamlon is XAML for Windows.Forms"
There are several key benefits of using Xamlon today:
a.. Application development becomes much more simple and efficient. Xalmon
provides a very clean separation between presentation and application logic.
b.. Xamlon application run on all of today's .NET Framework 1.1 Windows
operating systems: Windows 98, ME, NT, 2000, XP, and Server 2003.
c.. Xamlon provides a much simpler migration path to Microsoft's
next-generation presentation layer in Longhorn, XAML.
This is an early release so we could get it into the hands of developers.
There is little to no documentation, but we'll be updating the web site
frequently. For pre-beta 1, Xamlon has basic support for the Application
object, Window object, and several other controls including GridLayout,
FlowLayout, etc. These are very early stage controls, but will allow you to
get started. Of course all Windows.Forms controls can be used, third-party
controls, etc. Read over the included examples and source code, and we'll be
updating the bits frequently!
Enjoy... http://www.xamlon.com/
-Paul Colton Tag: HTMLHelp (CHM) embedded in a form Tag: 61991
Restoring files from the Recycle Bin
Does someone know how can i restore a file from the
Recycle Bin using the Shell API?.
The thing is that i know how to send files to the Recycle
Bin using the SHFileOpertion, but i do not know how to
restores the files.
Thanks for any help. Tag: HTMLHelp (CHM) embedded in a form Tag: 61989
Triger an event in the code
hi, everybody,
Can I triger an event in the code? For example, can I
triger a keydown event of textbox?
thanks Tag: HTMLHelp (CHM) embedded in a form Tag: 61987
Decent image control
Hi there,
I need to show an image centered on a form. That's easy,
use a Picturebox... problem is the images may be
different sizes, and I need to resize to show the image
with the correct aspect ratio (ie: height vs width)...
sometimes the image will be too big to fit on the form so
then I'd like scrollbars... I need like a "shrink/stretch
to fit" method which understands the aspect ratio bit....
Is it me or is the picturebox control pretty useless...?
Can anybody suggest a way of achieving what I want with
standard .Net controls... or am I going to have to
subclass the picturebox (or make my own version)...?
Any help appreciated...
Cheers Tag: HTMLHelp (CHM) embedded in a form Tag: 61986
MessageBox does not show up
Hi, there,
I have a MDI app written in C#. I have a form, then a
panel. The objects are drawn on the panel. When I closing
the window, I would like to save any changes that was
made. The code followed is in Form class:
public void ClosingHandler(Object sender, CancelEventArgs
e)
{
if(panel.Document.IsDirty ){
DialogResult save = MessageBox.Show("Do you want to
save changes ?","Name",
MessageBoxButtons.YesNoCancel);
...
}
}
But the message box would not show up unless I activate
another window then come back to my own.
Any idea what I am missing here?
Thanks in advance for your help.
Michael Tag: HTMLHelp (CHM) embedded in a form Tag: 61983
Control.Update method
Hello:
I have an application that performs a long process, it shows a progress bar
to help users dont get into panic, but, if I move another window over my
application's main form, the applications starts looking like if it was "not
responding". I try using the Update method, because the documentation says
it "Executes any pending requests for painting." But it is not working at
all.
I tried Refresh(), but it invalidates all the area, and the whole
application blinks.
Another way i tried is callind Application.DoEvents (), It works, but it
also allows users to clik on menus, close windows and I don't want that.
Is there any simple way to get the main window repainted? Tag: HTMLHelp (CHM) embedded in a form Tag: 61981
Moving form with no border
I've got a form that has no border
(FormBorderStyle.None), and I'd like to move it with the
mouse. My solution is below. Is there a better one?
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseDown
MouseDownLoc.X = e.X
MouseDownLoc.Y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles
MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Me.Left += e.X - MouseDownLoc.X
Me.Top += e.Y - MouseDownLoc.Y
End If
End Sub Tag: HTMLHelp (CHM) embedded in a form Tag: 61979
datagrid tablestyles child data
Hi,
I'm trying to get the tablestyle to populate when I
navigate ("drill down") to the child data in a datagrid. I
have the tablestyle mappingname set to the child table,
but it still uses the "default" (all the cols in the table
with their col name) setting. I've tried defining
programmatically (clearing all the cols and colstyles and
adding one at a time), and setting a couple cols for the
tablestyle using the designer, but no luck.
On the datagrid navigate event, I see the
datagrid.datamember has been switched to the child table,
but no luck.
Help!
thanks,
pchak Tag: HTMLHelp (CHM) embedded in a form Tag: 61975
Please help.....
Hi,
Could you please take a look and tell me what this means?
Cor has tried to help me, but we haven't found it yet.
Everytime I run this code, I get an exception error.
Here is my code:
Dim connStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=" &
Me.txtFile.Text
Dim SQLstr As String = "SELECT * FROM sitelist"
Dim cn As New OleDb.OleDbConnection(connStr)
Dim da As New OleDb.OleDbDataAdapter(SQLstr, cn)
Dim ds As New DataSet
pgBar.Value = 0
pgBar.Refresh()
da.Fill(ds, "sitelist")
pgBar.Value += 1
pgBar.Refresh()
dgMain.DataSource = ds
dgMain.DataMember = "Sitelist"
dgMain.Refresh()
cn.Close()
'FileNaam = FileNaam.Replace("sitelijst.mdb", "sitelist.mdf")
Dim con As New SqlConnection("Server=(local);database=;Integrated
Security=SSPI")
Dim cmd1 As New SqlCommand("DROP DATABASE sitelist", con)
con.Open()
Try
cmd1.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim strSQL As String = "CREATE DATABASE sitelist"
Dim cmd2 As New SqlCommand(strSQL, con)
Try
cmd2.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
cmd2.CommandText = "USE sitelist " & vbCrLf & _
"CREATE TABLE sites (sitenummer NVARCHAR(10), " & _
"adres NVARCHAR(255), gemeente NVARCHAR(25), " & _
"[Type site] NVARCHAR(25), bsc NVARCHAR(35), " & _
"Safety NVARCHAR(25), [X pos] NVARCHAR(15), " & _
"[Y pos] NVARCHAR(15), verantwoordelijke NVARCHAR(25), " & _
"online NVARCHAR(15), CONSTRAINT [pk_indentFT] PRIMARY " & _
"KEY CLUSTERED(sitenummer))"
Try
cmd2.ExecuteNonQuery()
Catch ex As Exception
'do nothing
End Try
con.Close()
Dim sqlNewstr As String
con = New SqlConnection("Server=(local);Database=sitelist;Integrated
Security=SSPI;")
Dim sqlDa = New SqlDataAdapter
sqlDa.SelectCommand = New SqlCommand("SELECT * FROM sites", con)
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(sqlDa)
cb.QuoteSuffix = "["
cb.QuotePrefix = "]"
Dim dstoo As New DataSet
sqlDa.Fill(dstoo, "Sites") 'connect the dataset to the empty table
Dim ab As Integer
Dim dr As DataRow
For ab = 0 To ds.Tables(0).Rows.Count - 1
dr = dstoo.Tables(0).NewRow()
dr(0) = ds.Tables(0).Rows(ab)(0)
dr(1) = ds.Tables(0).Rows(ab)(1)
dr(2) = ds.Tables(0).Rows(ab)(2)
dr(3) = ds.Tables(0).Rows(ab)(3)
dr(4) = ds.Tables(0).Rows(ab)(4)
dr(5) = ds.Tables(0).Rows(ab)(5)
dr(6) = ds.Tables(0).Rows(ab)(6)
dr(7) = ds.Tables(0).Rows(ab)(7)
dr(8) = ds.Tables(0).Rows(ab)(8)
dr(9) = ds.Tables(0).Rows(ab)(9)
dstoo.Tables(0).Rows.Add(dr) 'add the new rows to the table
Next
dgSec.DataSource = dstoo
dgSec.DataMember = dstoo.Tables(0).TableName
dgSec.Refresh()
MsgBox("continue?") 'just to be able to look at the datagrid
If dstoo.HasChanges Then
Try
sqlDa.Update(dstoo, dstoo.Tables(0).TableName)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
dstoo.AcceptChanges() 'make all changes permanent
dgMain.DataSource = dstoo
dgMain.DataMember = dstoo.Tables(0).TableName
sqlDa.Fill(ds, "Sites") 'connect the dataset to the table
dgSec.DataSource = ds
dgSec.DataMember = "Sites" 'check the table for new data
con.Close()
MsgBox("Ready") 'finished
End Sub
and this is the message I get on the line
"sqlDa.Update(dstoo,dstoo.Tables(0).TableName)"
System.Data.SqlClient.SqlException: Line 1: wrong syntaxis at ].
at
Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
at MDBtoSDF.Form1.btConvert_Click(Object sender, EventArgs e) in
D:\VB.NET projecten\PPC\MDBtoSDF\Form1.vb:line 264
I don't have a clue what it all means...
rg,
Eric Tag: HTMLHelp (CHM) embedded in a form Tag: 61966
WindowsForms Data Binding Over Internet
Hi Guys,
I have been doing a lot of research on what is the best architecture to bind
a WindowsForms Application to data across the Internet.
Scenario: My company is hosting all data in SQLServer2000 and running
IIS/ASPNET
The Client applications will be deployed outside our network. Its a typical
scenario, but seems like there is too many solutions:)
Is Remoting a more efficient way to expose all data manipulation objects,
does it need to be synchronized from scratch for all data updating and
binding?? Should DataSets be serialized to the client and bound to the forms
and will they handle the sync?
I saw somewhere that in the SQLConnection string, you can put in something
like "Server=http://111.111.222.222/" to connect the DataAdapter over
internet..is that true?
Can anyone please shed some more light??
Thanks a lot. Tag: HTMLHelp (CHM) embedded in a form Tag: 61965
casting Error
Hi
I'm trying to put the database column's value in a
variable, but when I do this I get this exception
Specified cast is not valid.
The column accept varchar values. My code is:
string reg = odrCrear.GetString("Name").ToString().Trim();
What is wrong???
Regards Tag: HTMLHelp (CHM) embedded in a form Tag: 61962
Borderless form?
I would like to create a MFC project (preferable using the
Wizard) that has a borderless, menuless window as the main
form. Unchecking basically everything in the Wizard still
gives me a border and a menu bar. How do I make it
borderless & menuless?
Thank you,
Richard Tag: HTMLHelp (CHM) embedded in a form Tag: 61960
Is there an enumeration for the WM_ messages????
If I overload WndProc(), I'll want a switch() in there to act on different
windows WM_ messages like WM_MOUSEMOVE and stuff like that. Trouble is, how
do I find the value of these constants? I know, I can hunt around in
winuser.h for them, but if I'm a VB or C# guy, that's kind of a roundabout
solution. The ".net" way of doing this would be to give me an enum that
contained all the values. Is there such a thing? I can't find one. Tag: HTMLHelp (CHM) embedded in a form Tag: 61958
System.Security.SecurityException: Request failed.
I'm trying to get my Windows form exe to execute from a web server.
Everything works fine on the server itself (my local machine),
when I go to any other machine, I get this error.
I have used the dotnet Trust An Assembly utility to trust the
assembly,
and I can browse to the server OK (my local machine).
Unfortunately our systems administrators have locked down the security
in IE so that it's impossible to add trusted sites, or change any of
these settings.
I can probably get them to change this, but I'd have to be clear in
what I needed changing.
Can anybody help. All the samples sem to assume you've got full access
to the machine.
David Noble Tag: HTMLHelp (CHM) embedded in a form Tag: 61957
WM_ACTIVATE
Hello,
In VB6 the WM_ACTIVATE message was not sent to a window
when it was activated from an other application (when the
application switched).
Did this change in VB.NET? Is it now always sent? Tag: HTMLHelp (CHM) embedded in a form Tag: 61953
selected text highlight and fontdialog
Hi,
I have some selected text highlighted in a textbox and a right mouse click
brings up a context menu which pops up a FontDialog box. Once the
FontDialog box is up, I lose the selection highlight on the text. How do I
keep the highlight?
Thanks,
dax Tag: HTMLHelp (CHM) embedded in a form Tag: 61949
How to Activate() a window
I have a Hwnd for a window that I want to bring to the front and give focus.
This window is not part of my application, but is being controlled by my
app. I get the Hwnd from the applications COM object model. Can I take
this Hwnd and give the form focus? Thanks!
--
Bobby C. Jones
www.AcadX.com Tag: HTMLHelp (CHM) embedded in a form Tag: 61934
Displaying version info onto a label
Hello,
I am trying to figure out how to display the applications version
information onto a label. How would I do this?
-T Tag: HTMLHelp (CHM) embedded in a form Tag: 61932
Centering an application when starting?
Does anyone know how to center an application on the desktop when starting
rather than rely on the default location? Tag: HTMLHelp (CHM) embedded in a form Tag: 61927
[ANN]unofficial Extensibility Application Block
Hi Folks.
Look here for the full details:
http://weblogs.asp.net/rosherove/posts/39484.aspx
and here for the download:
http://workspaces.gotdotnet.com/eap
in a few sentences:
This block allows you to incorporate plugins into your application with
ease. It also allows to easily create plugins for your application if it
uses this framework.
intro:
Extensibility Application Block
overview:
One of the demands from a successful application is the abilityto easily
adept to the needs of its users if and when they change (and they do). Many
times, the required changed, or extra features that need to be added
require not only pure development work, but also re-compilation of some or
all of the application binaries (this discussion does not include web
applications, only winform applications).
To avoid having to go through this sometimes painful process just to add a
simple feature, or fix a simple bug, a new need has grown - to allow
extending an existing application without the need to recompile it or even
without the help of the original developer. This is how what we know today
as Add-ins and plugins were born.
When we moved into the world of .Net, we still have the ability to write
applications that can be extended by others. However, there is no clear
path, a common way, to design and implement such abilities into .Net
applications. If you were to go today and try to build an extensible
application, you'll be faced with a myriad of articles and HOW-TOs, each
explaining the story a little bit differently than it's predecessor.
This Application block was created so that we can start and retain a common
ground for how such abilities should be built. So that it can be both easy
to understand and powerful enough as to be used by the most demanding
applications.
The solution I present here is based on my experience writing extensible
applications in .Net and on all the things I learned while trying to figure
out the best way to achieve specific abilities while trying to maintain a
generic approach.
How does it work?
There are 3 basic principles that need to be implemented in order for an
application to have plugins:
1. The application needs a way to recognize and communicate with the
plugins
2. The Plugins need a way to talk (or sometimes control) the application in
which they are hosted
3. The plugins need to be recognized and loaded at runtime into the host
application
1. The application needs a way to recognize and communicate with the
plugins
This application block solves this problem by providing a common interface
that all plugins must implement:IPlugin.
The principle is actually very simple:
Let's say I have a text editing application to which I would like people to
be able to add plugins.
These plugins should be able to talk to the application in which they
reside, AND the application should be able to talk to them.
However, since the application does not know in advance what plugins may be
available (some of them may only be created in the future!) the application
cannot have a direct reference on any specific DLL or class. It needs to
support ANY CLASS but it needs to be able to talk to it on pre-known terms.
This paradox is solved by the using a COMMON INTERFACE that both the plug
in and the application know. This interface is declared in a separate
assembly and both the plug in and the application have a reference to that
assembly.
This interface is what our application will use to communicate with the
plug in. Any plug in that will want to attach itself to the app will have
to implement this interface or otherwise we won't even try to load it. This
interface is called (in this application block) IPlugin.
2. The Plugins need a way to talk (or sometimes control) the application in
which they are hosted
This application block solves this problem by providing a base class called
AppContext. To the Plugins, AppContext is their one and only link to the
outside world. Anything they need to do, anything they need to know, they
do it through this class. The host application will hold a class derived
from AppContext which has specific methods and properties which should be
shared with the plugins. the IPlugin interface contains an Init Method
which passes an AppContext instance into the plug in, allowing it to hold a
reference to it and using it for what it needs. For example, For an Editor
application, We can have an EditorContext class which exposes events such
as TextChanged and properties such as SelectedText and so on. The plugins
can use these properties to manipulate their outside environment . It all
depends on how much the developer decides to expose to the plugins using
the AppContext class. The AppContext class is also the class that will load
and unload the plugins when the application starts and finishes, but for
that it uses yet another class from the application block - the
PluginProvider classes which I'll now discuss in the next paragraph.
3. The plugins need to be recognized and loaded at runtime into the host
application
There are many ways in which one can organize and recognize the plugins
that their application needs to load. Some prefer to dynamically search all
the DLLs in the app directory and find classes that implement the IPlugin
Interface. Some prefer to list the required plugins and their type inside
the application config file. Some might have a whole different way of doing
this which no one has ever thought of before. This application block is
built to support whatever method you choose to load your plugins, and it
also provides a couple of implementations right off the bat so you can get
up and running in no time with your new application.
In the extensibility block there are special objects for which the only
purpose in life if to find and load plugins. These are called Plugin
Providers. Each plug in provider must implement the IPluginProvider
interface. There are several providers already build for you. These include
the XmlFilePluginProvider, SectionHandlerPluginProvider and
DynamicFindPluginProvider. Each of these implements searching for plugins
in a totally different way, but because they all support the same
interface, they all return a collection of IPlugin object when they are
done allowing you to simply choose the method in which to search.
Don't find anything you like in there? Feel like you need an extra feature?
Simple implement the IPluginProvider interface in your own class and you're
free to go.
--
Roy Osherove
weblog: http://www.iserializable.com Tag: HTMLHelp (CHM) embedded in a form Tag: 61925
Unwanted Focus in TabControl
Hi,
When I'm using the SelectedIndex property to
programmatically change the current TabPage of a
TabControl (or controlling it by DataBinding), the
corresponding TabPage "steals" Focus. Does anybody know a
simple way to avoid this?
Thank you in advance!
Per Tag: HTMLHelp (CHM) embedded in a form Tag: 61923
No touch deployment and XP Themes
Hi.
How do I adopt XP-theme together with no touch deployment?
I am using no touch deployment of a windows application (framework
1.1).
The problem is when deploying the application through no touch the
visual style does not adopt XP-themes.
I am using...
Application.EnableVisualStyles();
Application.DoEvents();
... but i do not seems to work.
I have also tried to use a Manifest file, but i do not think it is
sent to the client computer. Maybe I am doing something wrong!?!
Can anybody please help!
Thanks in advanced. Tag: HTMLHelp (CHM) embedded in a form Tag: 61919
Focus form after use popup menu in notifyicon
Hello,
I have form with notifyIcon and popup menu for notifyIcon. I modified
Close event - I hide form instead close. When I clik to icon in
systray, form shows. But when I selected item from popup menu over
notifyIcon, form shows too - but I don't show it, only run any code.
How do I it?
Ehh, sorry for my english :/
There is source code (I wrote it in C#Builder Personal):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Project1
{
/// <summary>
/// Summary description for WinForm.
/// </summary>
public class WinForm : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private bool closeFromMenu;
private System.Windows.Forms.MenuItem menuItem2;
public WinForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
closeFromMenu = false;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(WinForm));
this.notifyIcon1 = new
System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
//
// notifyIcon1
//
this.notifyIcon1.ContextMenu = this.contextMenu1;
this.notifyIcon1.Icon =
((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
this.notifyIcon1.Click += new
System.EventHandler(this.notifyIcon1_Click);
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 1;
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new
System.EventHandler(this.menuItem1_Click);
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "Click";
this.menuItem2.Click += new
System.EventHandler(this.menuItem2_Click);
//
// WinForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(264, 237);
this.Name = "WinForm";
this.Text = "WinForm";
this.Closing += new
System.ComponentModel.CancelEventHandler(this.WinForm_Closing);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new WinForm());
}
private void menuItem1_Click(object sender, System.EventArgs e)
{
closeFromMenu = true;
this.Close();
}
private void WinForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (!closeFromMenu)
{
this.Visible = false;
e.Cancel = true;
}
}
private void notifyIcon1_Click(object sender, System.EventArgs e)
{
if (!this.Visible)
{
this.Visible = true;
} else
{
this.Activate();
}
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
// any code
}
}
} Tag: HTMLHelp (CHM) embedded in a form Tag: 61911
html control
I asked this a few days ago but it appears I didnt word it correctly.
Is there any way to place a html control onto a windows form in .net such
that the javascript on the html displayed within the html can access
properties and methods of the application via the external object in JS? Tag: HTMLHelp (CHM) embedded in a form Tag: 61902
Textbox-level validation
Folks,
I have a C# WinForms app, and I am doing some validation of text boxes
and their contents.
So far, I've used the TextBox1_Leave event - if the focus goes away
from the textbox, I check for certain conditions (not empty, valid
entry etc.).
This works okay so far - but in some cases, I'd like to skip that
validation, e.g. when the user clicks on the "Cancel" button.
But how can I "foresee" that the user has clicked the Cancel button,
inside my TextBox1_Leave event?? In Delphi, we used to be able to
inspect a property "ActiveControl" which was set to the button that
had been clicked - based on that info, I was able to determine whether
or not I wanted to apply my validation.
I don't seem to find anything similar in C# / .NET - I do have an
"ActiveControl" property, but that is still set to my text box, as
long as I'm still on it.....
Any way to achieve what I'm trying to do without major kludges??
Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch Tag: HTMLHelp (CHM) embedded in a form Tag: 61901
Scope of form variables...
This may sound like a dumb question, but I am hoping someone might comment
on it....
Consider the following method (assuming that Form1 is a class derived from
System.Windows.Forms.Form) :
private void MyMethod()
{
int i = 1;
Form1 myForm = new Form1();
myForm.Show();
}
Both of the variables, i and myForm, are local variables that should go out
of scope when the method is finished executing. But the myForm variable
continues to live on. Is this correct? Why is the scope of form variables
different than the scope of other types? Tag: HTMLHelp (CHM) embedded in a form Tag: 61889
free control alterative to treeview
does anybody of the existance of a free control that is a good
alternative to the treeview
i basically want some flexibility in the UI and ability to do
multiselect etc etc.
in delphi some guy had made a free virtual tree view that just rocked
and i'm looking to see if some people have stepped up to the mark in
C#
Karl Tag: HTMLHelp (CHM) embedded in a form Tag: 61888
image of button
I find that when a button is disabled, the image on the button will not
display and turn into a mess of grey color, is there anything we can do so
that the image can be visible or fade out or change to another image in
order to indicate that the button is disabled rather than turn into a mess
of grey.
Thz Tag: HTMLHelp (CHM) embedded in a form Tag: 61887
Main Form Unresponsive
I'm building a custom install program that allows the user
to select which assemblies get installed. In creating the
prototype I am encountering a situation where the main
form will not accept user input after the installation is
complete.
In my form, pressing the 'Install' button runs the
following method:
public override bool Install()
{
IDictionary savedState = new Hashtable();
System.Configuration.Install.AssemblyInstaller ai = new
System.Configuration.Install.AssemblyInstaller();
try
{
ai.Path = "testassembly.dll";
ai.UseNewContext = true;
ai.Install(savedState);
ai.Commit(savedState);
ai.Dispose();
return true;
}
catch (Exception e)
{
return false;
}
}
My trivial installer class is the only class in
the "testassembly.dll" named above:
[RunInstaller(true)]
public class Installer1 :
System.Configuration.Install.Installer
{
public Installer1()
{
}
public override void Install(IDictionary stateSaver)
{
base.Install (stateSaver);
MessageBox.Show("Installing", "TestAssembly");
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall (savedState);
MessageBox.Show("Installing", "TestAssembly");
}
}
After the install MessageBox is dismissed, the main form
gets updated (progress bar goes away and a 'Done' button
is made visible) correctly, but when I try to either click
the 'Done' button to exit the app, or close the form,
nothing happens.
If I remove the MessageBox from the installer class, then
everything works correctly and I can exit the app, so I
assume that there is some sort of forms or event loop
issue going on, but I have not been able to figure it out.
Anyone have any ideas?
Matt Tag: HTMLHelp (CHM) embedded in a form Tag: 61883
Main Form's Display chops Right Side & Bottom
Hello,
It seems that on a certain machine (i.e. Dell Dimension
4500S) when the main form is displayed (it initially
comes up maximized, and AutoScale is True per the
default - not that I truly grasp its significance) parts
of the right and bottom portions of the form are not
being displayed at all in the window. They seem to have
been truncated from the display.
I have a textbox that is located (and anchored) on the
far right-hand side of the form and when it comes up more
than half of the text is just chopped off (a good 2
logical inches or so). The bottom of the form has two
rows of icons (24x24) that don't show up at all (these
icons are also anchored to the bottom of the form).
You can't ever get the form to show any of the "lost"
area either (ie. by resizing, minimizing, maximizing,
etc.).
Has anyone seen this behavior at all or has any ideas as
to what is causing this behavior? Is there some known
issues with cetain computer's video drivers (this Dell
Dimensions uses an Intel video driver) and .NET. After
looking around on the net I haven't seen this addressed.
On this particular machine "normal" apps seem to work
fine and this is the first .NET form application it's
ever seen.
Thanks for any help/insight,
JB Tag: HTMLHelp (CHM) embedded in a form Tag: 61878
Maximum height of windows form
Hi,
I am trying to set the height of a form in the VS .net IDE, and somehow seem
unable to set the height beyond 780. I have set the autoscale and autoscroll
properties to true, and the Miniumn size and maximum size are set to 0,0
each. I was under the impression that with these settings I could make the
form as big as I wanted, and could get the scrollbars automatically when
needed. However this doesnt seem to be happening. The height gets reset to
780 if i type in anything bigger than that.
Am I missing something here ? Does anyone have an idea why I see such
behavior ?
Thanks in advance for any help,
Aniket Sule Tag: HTMLHelp (CHM) embedded in a form Tag: 61876
Is there any way to get an MDI child window to flash, like with FlashWindowEx()?
With FlashWindowEx(), I can make dialogs flash (like yahoo chat and stuff
like that). Is there any way to get an MDI child window to flash in the
same way? FlashWindowEx() doesn't work on child windows... Tag: HTMLHelp (CHM) embedded in a form Tag: 61873
Selecting Listview Item by Text
I have a listview with items Apple, Pear, Banana. How can I
programmatically select Pear if I don't know the index?
Thanks,
Todd Tag: HTMLHelp (CHM) embedded in a form Tag: 61868
OnPaint when using Offscreen bitmap
I am using an offscreen bitmap and I have scrolling.
For now I DrawImage the entire offscreen bitmap -- but that is slow.
Could anyone please tell me how to only DrawImage the portion I need so it
will go faster.
Thank you!
For now I do:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.TranslateTransform(
AutoScrollPosition.X, AutoScrollPosition.Y);
e.Graphics.DrawImage(offScreenBmp, 0, 0);
System.Drawing.Size s = new System.Drawing.Size();
s.Width = 0;
s.Height = 2100;
AutoScrollMinSize = s;
} Tag: HTMLHelp (CHM) embedded in a form Tag: 61861
Problems with MessageBox.Show
I'm experiencing a problem where I have a non-modal toolwindow that contains
a control derived from System.Windows.Forms.ComboBox displayed in an MDI
application. Whenever a .NET message box is displayed in the application the
derived combo boxes on the toolwindow appear to lose their base control,
i.e. base.WndProc(ref m) in the derived control's WndProc results in a
NullReferenceException. Admittedly this could be a problem with the derived
controls, however after looking at how System.Windows.Forms.MessageBox works
it seems like there are some "oddities". Also, if I call the Win32
MessageBox function directly via p/invoke, specifying the correct owner
window, then everything works fine.
Here is the section of System.Windows.Forms.MessageBox (ShowCore) that I've
been looking at:
if ((owner != null) && ((options & 2228224) != 0))
throw new ArgumentException(SR.GetString("CantShowMBServiceWithOwner"),
"style");
IntSecurity.SafeSubWindows.Demand();
num1 = (((buttons | icon) | defaultButton) | options);
ptr1 = IntPtr.Zero;
if ((options & 2228224) == 0)
{
if (owner == null)
ptr1 = UnsafeNativeMethods.GetActiveWindow();
else
ptr1 = owner.Handle;
}
Application.BeginModalMessageLoop();
result1 = MessageBox.Win32ToDialogResult(SafeNativeMethods.MessageBox(new
HandleRef(owner, ptr1), text, caption, num1));
Application.EndModalMessageLoop();
return result1;
The value of 2228224 corresponds to MessageBoxOptions.DefaultDesktopOnly |
MessageBoxOptions.ServiceNotification. The interesting thing here is that
the owner parameter is always ignored since owner must be null when options
contains the above flags. If owner is not null, the handle is never
retrieved because options cannot also contain the above flags and therefore
ptr1 remains as IntPtr.Zero. The other interesting thing is the
BeginModalMessageLoop/EndModalMessageLoop block. It appears as though this
disables all windows in the current thread, although I haven't looked at
this too deeply, and this further implies that the owner parameter plays no
part in establishing modality. Does anyone have any thoughts on this,
particularly with reference to the fact that the
BeginModalMessageLoop/EndModalMessageLoop block appears to be causing severe
problems for my non-modal windows? A single call to the Win32 MessageBox
function with a correctly specified owner window does not exhibit the same
problems.
TIA.
--
Kevin Westhead Tag: HTMLHelp (CHM) embedded in a form Tag: 61859
PropertyGrid customization
Hi,
I'm in the process of customizing the PropertyGrid for an
application. I've written several TypeConverters and a
few editors to display and process data within the grid.
What I haven't been able to do yet is have the editor
control receive the mouse input from another window.
For example, I have a CAD app and I want modify a line
entity. I select the entity and its properties are
displayed in the PropertyGrid. I select the beginning
coordinate field in the PropertyGridwant to modify the
coordinate of the beginning point by selecting the
location in the graphics window. Is this possible, or do
I just need to create my own custom version of the
PropertyGrid??
What I would ideally like to do is embed an existing
custom control inside the PropertyGrid.
TIA,
Peter Tag: HTMLHelp (CHM) embedded in a form Tag: 61851
Preventing "ding!" on Esc or Enter in a textbox
Anybody know how to prevent the ding sound from happening when the escape or
enter key is entered into a textbox? I need to catch the enter and escape
keys for processing.
I've the following event handler for on the Keydown event of the text box,
but I'm still getting the ding sound.
private void EditBoxKeyDown(object sender, System.Windows.Forms.KeyEventArgs
e)
{
if ( e.KeyCode == Keys.Enter )
{
/* do some processing */
e.Handled = true;
}
if ( e.KeyCode == Keys.Escape )
{
/* do some processing */
e.Handled = true;
}
} Tag: HTMLHelp (CHM) embedded in a form Tag: 61848
Form Start Position question
When I set the StartPosition on my main form to CenterScreen, the form never
starts at center screen, but offset toward the lower right corner. On my
modal login form, however, the property seems to work just fine.
Am I overlooking something??
Thanks! Tag: HTMLHelp (CHM) embedded in a form Tag: 61846
Form Scrolling
I have scrolling in my app.
When I click the arrows of the scroll bar or click inside the scroll bar the
app scrolls -- but when I drag the scroll box (that part in the middle) the
app does not scroll until after I release the mouse button. I'd like it to
scroll as I drag that scroll box. I figure I could just call this.refresh
but I do not see any events for the Form that fire while dragging that box?
Thank you. Tag: HTMLHelp (CHM) embedded in a form Tag: 61843
Call another form
Hi
I created two forms in the same proyect and I want to call
one form from another one but I couldn't find the Show
method. I'm working with C#.
In Visual Basic 6 you can tell the proyect which form use
first.
Regards Tag: HTMLHelp (CHM) embedded in a form Tag: 61838
Custom Authentication
I have a project where I have to build an internet cafe type program. I am
having a problem figuring out how to authenticate at user stations .
What I want to do is client machine to be locked and needs a temporary
password to get in. I am not sure how to lock the workstation. I am not just
looking for a solution, but suggestions. I have looked in google but I am
not sure what I am looking for. Any ideas?
John Tag: HTMLHelp (CHM) embedded in a form Tag: 61837
Hello,
i would like to embedd HTML-Help-Page (Chm-File) in a
form (i would not like to open an extra window for the
help).
Is this possible?