C# class design
Is it possible to design a class in C# which should be not be re-entrant. eg
if Thread1 is calling any function on the object of that class then the same
thread should not allowed to call another function on the same object untill
the first call is finished. Tag: Controls on multiple tabs Tag: 95238
Validation controls are not working
hi,
I'm developing a website using .net faramework version 1.1 the issue i'm
facing is I put validation controls on my pages they all are working fine
here localy but when i upload them on webserver they all stop working , I
hosted my site at www.7host.com I dont understand what is the issue. Kindly
help me out
Regards
Noorali Tag: Controls on multiple tabs Tag: 95234
Maximize and resize Windows
Dear all,
I am a newby of .NET programming and I have a general question. If I
put some controls on a windows form (say with size 300,400), when I
resize the Window (enlarging it) or if I Maximize it, the controls
remain in the top left corner in the rectangle 300,400 making the whole
form look very bad.
If I resize Notepad, the multiline textbox within resizes too... I'd
like my applications do the same.
Are there techniques, articles, tutorials or something like that, that
can explain me how to handle this?
Thanks in advance. JC Tag: Controls on multiple tabs Tag: 95232
FormView / GridView Connection
If someone could help...
My goal is to attach a FormView control to a GridView control such that
clicking the Select link on a record in the GridView will cause that record
to be displayed in the FormView control.
So far I've got the GridView displaying all the correct records, and the
FormView populating on the page's initial load. The FormView has its own
data source - it points to the same table the GridView uses, but has a
'where' clause that refers back to the GridView control on two fields. The
datasource has default values for those two fields, and the data that is
displayed on the initial page load reflects the record whose keys equal the
default values. So far, so good.
When I click another line's Select link, the page repaints, but the
FormView control is empty. Viewing the source I can see its skeleton, but
no content. I've breakpointed at the control's PreRender function, and the
DataItem is populated on the initial page load, but is null on the postback.
I'm sure I'm missing something fairly basic. Can I get a point in the
right direction?
Thanks,
Ben
--
bf001removethis@abovetheline.biz Tag: Controls on multiple tabs Tag: 95231
Problem creating controls from other thread w/ invoke
Hi,
I have a form which acts as monitor for a service. The form and the monitor
communicate via remoting. Because it takes some time for the service to
startup some controls are added to the form when a certain event is raised
by the service.
However, when handling this event I do the following:
--------- snip ---------
private void EventProxy_Initialized(object sender, EventArgs e)
{
MethodInvoker invoker = new
MethodInvoker(this.CreateCommunicatorControls);
this.Invoke(invoker);
}
private void CreateCommunicatorControls()
{
// create controls and add them to a panel on the form
this.panelCommunicator.Controls.Add(newCommCtrl);
[...]
}
--------- snip ---------
The panel on the form is created from the main UI thread of the form., but I
still get the exception "Controls created on one thread cannot be parented
to controls on a different thread" when adding the new control to the panel.
Does anybody know what the problem is?
Regards,
Michael Tag: Controls on multiple tabs Tag: 95226
Getting the list of colors!
Hi,
I want to retrieve the list of Colors available and display them in a drop
down combo. But the Color strcture doesnt seem to have a method that returns
the list of colors. Is there an enumerator that I can use?
Sinex Tag: Controls on multiple tabs Tag: 95217
How to show transparaent label in window forms
Hi,
I try to add a label to a windows form, but as background is image, the
label need to be transparent, but it seems no transparent property
available, I found a one in web tab, but it does not work.
Help
Thanks
Jessie Tag: Controls on multiple tabs Tag: 95213
How to show fields from related tables in same datagrid
I run VS .Net 2003. I have a distributed application with sql server 2000 and
windows front end, written in c#.
I have a number of tables in a dataset with relations between them. In one
single read-only datagrid I would like to display child rows from a child
table as well as one column from the parent table. How can I fix this in an
easy way?
I thought I could handle this via dataviews and dataviewmanager as source
for the datagrid, but I have not found any good article. I need a detailed
explanation as I am a novice on this.
I realize I could produce a new table on the windows client from the two
related tables, but as I consider the data structure to be well designed this
is not what I would like to do.
Regards
Tore Tag: Controls on multiple tabs Tag: 95208
How to draw a 1 pixel long line using Graphics.DrawLine?
I am writing a Windows Forms application graphing routine using VS.NET 2003,
Visual C# and .NET Framework 1.1.
The Graphics.DrawLine(Pen,int,int,int,int) method seems to work okay unless
the desired line being drawn is only one pixel long (horizontally). I have
not found a way to get a horizontal line of only one pixel to be drawn. I
either get no line or a two pixel line.
Example method calls:
Graphics.DrawLine( Pen, 20, 50, 21, 50 ); // Results in two pixel long line.
Graphics.DrawLine( Pen, 20, 50, 20, 50 ); // Results in no pixels being
drawn.
So how do I get a one pixel long line?
Thanks,
Dave Tag: Controls on multiple tabs Tag: 95205
Playing File Progress AVI
Is there a way in VB.NET 2005 to play the file progress avi file on a
Winform? I know there use to be a control in VB6 but there does not seem to
be one for .NET. I would rather not use external DLL's that I have to send
along with my EXE.
Thanks,
David
======================================
David McCarter
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485 Tag: Controls on multiple tabs Tag: 95202
ClickOnce
I have today gone to production with my first .net 2.0 Windows forms app. I
distributed it using click once. I was impressed with the .net framework
1.1, 2.0 looked even better from a developer point of view (generics are
brilliant). But I have to say click once is the best thing microsoft has
ever done.
I published the app to my webserver, sent everyone a link, sat back and
grinned. It felt so good I even built a quick enhancement just so i could do
an update in the afternoon. The last software distribution i did was a vb6
app and involved sending ~20Mb of install set around to 100+ people, so you
can imagine how good this felt.
Well done microsoft!
If you havent played with this technology then i would definitely suggest
you have a go.
Desktop Apps are back!
Cheers
--
David Steele
Recent VB6 - Dot net convert Tag: Controls on multiple tabs Tag: 95200
Painting Problem
Hello,
I am currently using VB 2005 and having a problem I hope that some one
can help me with. Currently in my project, I create and add a panel at
run time and on this panel, I draw a gradient along with several text
strings. This panel is docked at the top of the form and I also create
another that is docked at the bottom of the form. The problem I am
experiencing is that whenever I hover over the min/max button or bring
up any shortcut menus like clicking on the control box, where ever the
tooltip or pop up menu was will leave nothing but the background color
of the panel instead of refreshing the the gradient and any strings
drawn in that section as well. However, this only happens when the
first one pops up, if any more pop up after that, the panel seems to
paint correctly in that area when the popup/tooltip disappears
(although the previous area will remain blank). If I minimize the form
and then bring it back up, the entire form is correctly drawn, but the
problem happens exactly as it did before where the first popup causes a
problem and the rest do not. The second part of the problem is when
tabbing over to another control... all of a sudden both panels drawn
will go completely blank to whatever the default background color is
and will only come back if minimizing the form and bringing it back up
again. Below is the code I am using in my form (the panels
uxHeader/uxFooter are simply added during the form_load event with all
their defaults aside of dock and height), hopefully someone can see my
problem or suggest a resolution to it, thanks in advance:
Public Class form_main
Private Sub form_main_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) Handles
Me.Paint
DrawGradient( _
0, 0, uxHeader.Width, uxHeader.Height, _
Color.Black, Color.LightSlateGray, uxHeader,
Drawing.Drawing2D.LinearGradientMode.Vertical)
DrawGradient( _
0, 0, uxFooter.Width, uxFooter.Height, _
Color.LightSlateGray, Color.Black, uxFooter,
Drawing.Drawing2D.LinearGradientMode.Vertical)
DrawString( _
uxHeader, "Data Copy Setup", Brushes.SteelBlue, 11, 48,
_
New Font("Trebuchet MS", 14, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Data Copy Setup", Brushes.White, 10, 47, _
New Font("Trebuchet MS", 14, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Citizens Bank", Brushes.SteelBlue, 306, 10,
_
New Font("Trebuchet MS", 12, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Citizens Bank", Brushes.White, 305, 9, _
New Font("Trebuchet MS", 12, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Wintel Services", Brushes.SteelBlue, 306,
23, _
New Font("Trebuchet MS", 24, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Wintel Services", Brushes.White, 305, 22, _
New Font("Trebuchet MS", 24, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Migration Data Copy Tool",
Brushes.SteelBlue, 338, 48, _
New Font("Trebuchet MS", 12, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxHeader, "Migration Data Copy Tool", Brushes.White,
337, 47, _
New Font("Trebuchet MS", 12, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxFooter, "version 1.0.0", Brushes.SteelBlue, 416, 21,
_
New Font("Trebuchet MS", 10, FontStyle.Bold,
GraphicsUnit.Pixel))
DrawString( _
uxFooter, "version 1.0.0", Brushes.White, 415, 20, _
New Font("Trebuchet MS", 10, FontStyle.Bold,
GraphicsUnit.Pixel))
End Sub
'---------------------------------------------------------------------------------------------------------------------------------
' Sample Call:
'
' DrawGradient( _
' 0, 0, uxHeader.Width, uxHeader.Height, _
' Color.Black, Color.Gainsboro, uxHeader,
Drawing.Drawing2D.LinearGradientMode.Vertical)
'---------------------------------------------------------------------------------------------------------------------------------
Private Sub DrawGradient( _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal w As Integer, _
ByVal h As Integer, _
ByVal color1 As Color, _
ByVal color2 As Color, _
ByVal ctrl As Control, _
ByVal mode As System.Drawing.Drawing2D.LinearGradientMode)
Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(New
RectangleF(0, 0, ctrl.Width, ctrl.Height), color1, color2, mode)
Dim g As Graphics = ctrl.CreateGraphics
g.FillRectangle(a, New RectangleF(x, y, w, h))
g.Dispose()
End Sub
'---------------------------------------------------------------------------------------------------------------------------------
' Sample Call:
'
' DrawGradientString( _
' "Sample", Color.Blue, Color.Firebrick, _
' Drawing.Drawing2D.LinearGradientMode.Vertical)
'---------------------------------------------------------------------------------------------------------------------------------
Private Sub DrawGradientString( _
ByVal text As String, _
ByVal color1 As Color, _
ByVal color2 As Color, _
ByVal mode As System.Drawing.Drawing2D.LinearGradientMode)
Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(New
RectangleF(0, 0, 100, 19), color1, color2, mode)
Dim g As Graphics = Me.CreateGraphics
Dim f As Font
f = New Font("verdana", 16, FontStyle.Bold, GraphicsUnit.Pixel)
g.DrawString(text, f, a, 10, 100)
g.Dispose()
End Sub
'---------------------------------------------------------------------------------------------------------------------------------
' Sample Call:
'
' DrawString( _
' Me, "Wintel Operations", Brushes.Black, 12, 102, _
' New Font("Trebuchet MS", 24, FontStyle.Bold,
GraphicsUnit.Pixel))
'---------------------------------------------------------------------------------------------------------------------------------
Private Sub DrawString( _
ByVal ctrl As Control, _
ByVal text As String, _
ByVal b As Brush, _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal f As Font)
Dim g As Graphics = ctrl.CreateGraphics
g.DrawString(text, f, b, x, y)
g.Dispose()
End Sub
End Class Tag: Controls on multiple tabs Tag: 95199
Multi-page configuration with TreeView. How is it done?
Hi there,
I need to do something like the Visual Studio "settings" window, i.e.,
having a TreeView on the left side and some kind of multi-panel (or
multi-page) control on the right side.
What should I use on the right side? I thought it was a TabControl, but I
can't find a way to make the TabPage headers invisible.
Thanks in advance for any ideas,
-Benton
Using VS 2005. Tag: Controls on multiple tabs Tag: 95195
Derived DataGrid not displeyed correctly
Hi!
I derived a new class from a DataGrid control and added some functionality
to it. Among other things a method that autosizes the columns displayed.
When I change the data source and data member of the datagrid after having
updated some data in it, it sometimes does not display correctly. What
happens is that some cells from the old view is visible in the new view. I do
not know what is the problem, but my guess is that it has something to do
with the repainting of the derived datagrid.
Do I need to do something in the derived data grid to get the painting to
work correctly?
--
/ ScubaD Tag: Controls on multiple tabs Tag: 95194
Screen Savers: How do I spawn a process...
I have a machine that will be used to demo some Excel spreadsheets at a
convention. Because I did not author the spreadsheets and attendees will be
allowed to play with the spreadsheets, I needed a way to periodically
restore the original versions. In addition to the "always-on-top click this
button to reset demo" application I wrote, I chose to use screen saver code
to reset the demo after a period of inactivity in the event an attendee just
walked away. I chose the screen saver method because I was unsure how to
capture the system traps since my reset-app will not always have focus and
so using the screen saver method seemed to be the quickest/easiest solution.
So...
I can spawn a new process from an application and that process remains
running after the application is closed. This is good.
Using the same code in a screen saver and running it while its an .EXE
(prior to renaming it .SCR & relocating it to the system directory), the new
process remains running after the screen saver application is closed. This
is good.
I rename the screen saver to .SCR, relocate it in the system directory,
right-click the Desktop background, select Properties / Screen Saver / etc.,
click the Preview button to execute the screen saver and the new process
remains running after I select Ok or Cancel to cancel the screen saver. This
is good.
Now I allow the system to kick off the screen saver at whatever inactivity
timeout. The screen saver executes, the new process executes but it closes
when the screen saver closes. This is bad.
Here is the code being used:
private void ScreenSaverForm_Load(object sender, System.EventArgs e)
{
string InstallPath =
(string)Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyApp").GetValue(@"Path");
ProcessStartInfo startInfo = new ProcessStartInfo(InstallPath +
@"\MyFile.xls");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);
Close();
}
I have also tried including "startInfo.UseShellExecute = true;" but results
were the same.
Unless I am totally off then obviously the operating system is
handling/executing screen saver code differently at the final stage. Other
than basic skeleton code required for a screen saver, I am unable to find
any 'real' documentation on screen saver programming. For example, through
trial & error I discovered that the screen saver filename must follow the
8.3 naming convention - unless I'm doing something wrong there as well?
Anyway...
1. Most importantly, what is the code for spawning a new process from within
a system activated screen saver such that the new process remains running
after the screen saver closes?
2. Is a screen saver filename in fact limited to the 8.3 naming convention?
3. Where is the screen saver application name set or read from? For example;
if your filename is 'ssMyDemo.scr' then the system will drop the prefix of
'ss' and display 'MyDemo' in the screen saver list. If there is no 'ss'
then the filename, excluding extension, will display in the screen saver
list. But if you examine a default OS provided screen saver you will see
that the filename 'ss3dfo.scr' displays as '3D Flying Objects' in the screen
saver list. How is this accomplished?
4. Is there a "Everything you ever wanted to know" type source on screen
saver programming; net, book or otherwise?
TIA,
-Jeff Tag: Controls on multiple tabs Tag: 95193
Event question
I have a component (Say Component1 )which has two public functions and one
event(Say Func1 and Func2 and event is MyEvent) This component is being used
by a second component(Say Component2)
Here is the flow of events
1) Component2 intantiates Component1
2) Component2 registers for the event MyEvent
3) Component2 calls function Func1
4) In Func1 of Component1 the event MyEvent is raised. Func1 has to do more
work but event is raised in the middle of Func1.
5) Component2 receives event and calls Func2.
In this test case I just want to know is there a way to detect/prevent
Component2 from calling Func2 until the call to Func1 ends. It is kind of
reentry problem of the Component1. Because the Component1 is not thread safe.
The Func2 changes the state of the Component2. In this case after executing
Func2 the code will fall back to Func1 which will see a changed state.
Is there a way to stop it or making Component2 not to be re-entrant.
Thanks in advance Tag: Controls on multiple tabs Tag: 95192
ProfessionalColors class cheat sheet
I'm looking for a visual cheat sheet for using the ProfessionalColors
class with the 2.0 framework controls.
Sean Lively Tag: Controls on multiple tabs Tag: 95191
Sample from MSDN on <ApplicationSettingsBase Class> has a Resize
Hello,
I have a problem with the sample from the following article:
http://msdn2.microsoft.com/en-us/library/system.configuration.applicationsettingsbase.aspx
When the form is resized from the left side, or top, it will change the
location to the point where it was resized to and keep the original size.
I am assuming that this is not the default behavior in this case.
Is there a workaround?
Thanks.
Regards,
Genadij. Tag: Controls on multiple tabs Tag: 95188
Disable Sorting in VB.NET
I thought the only thing I had to do to disable column sorting in
VB.NET was to set datagrid.AllowSorting = False. Unfortunately this
has never worked for me. I discovered another set of code that seems
to work for 99% of the cases where I need to disable datagrid column
sorting:
Private Sub datagrid_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles datagrid.MouseDown
Dim pt As New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = dgACE.HitTest(pt)
If hti.Type <> DataGrid.HitTestType.ColumnHeader Then
MyBase.OnMouseDown(e)
End If
End Sub
However, this code does not work when my datagrid resides on a user
control. The datagrid_MouseDown event is triggered but sorting still
occurs for the column. It's critical that I disable sorting in the
datagrid due to the other things I am trying to do with the datagrid.
I'm about ready to pull my hair out trying to figure this one out so
any suggestions on how to resolve this issue would be greatly
appreciated!
Thank you!
Joy Tag: Controls on multiple tabs Tag: 95186
FlowLayoutPanel - Move Control (.NET 2.0)
Is there a way of changing the position of a control in a FlowLayoutPanel?
The only ways I can see is by systematically calling BringToFront on each
control in the right order or by pulling all the control out and ading them
back again in the correct order. Both these ways seem to me to be kludges.
TIA Tag: Controls on multiple tabs Tag: 95185
How to combine AutoScroll and virtual content scroll
I am a .NET newbie and started working on al user control, where one scroll
dimension -- say horizontal -- moves the contained controls (like AutoScroll)
and the other dimension leaves the controls sticky and updates the virtual
content of the contained controls -- lets say some text boxes -- with .NET
2.0.
I tried to use AutoScroll by setting
ScrollableControl.AutoScrollMinSize.Height to the virtual content size and
updating the content of my text boxes by using a Scroll event handler. But
this also moved my text boxes vertically and I was not able to reset their
location without introducing flickering. Question: Is there a way to make
some contained controls remain sticky or is there a way to make to movement
of the controls invisible?
My second approach was to use manual scrolling. Besides that this approach
introduces a lot more code and I had to do the layout manually, it introduced
flickering of the scroll bars when resizing. I assume that this is introduced
by the timig of layouting and control-repainting. With my first approach by
using AutoScroll there was no flickering when resizing the control. Question:
Is there a flicker save way to do layouting and painting of contained
controls.
Thanks in advance for any hints. But I want to do it purely using platform
independent .NET code, so overriding WndProc or using P-Invoke is not an
option for me. Tag: Controls on multiple tabs Tag: 95183
Fonts and Labels in a Windows Form Messed Up?
I'm converting a .NET 2.0 Beta project to the final version using Visual
Studio. In doing so, I've come across a strange problem with the fonts in my
labels. To see the problem, I have an empty form with 2 labels, one "Timing
Details:" and one "Package Details:" - each one Bolded. When viewing the
form in design mode within Visual Studio, everything looks good - as
expected. But when I run the form, the word "Details" in each of the two
labels looks different. The second one looks scrunched up.
Here's the guts of my form code - nothing out of the ordinary as far as I
can tell:
partial class Form1 {
private void InitializeComponent() {
this.packageDetailsGroupLabel = new System.Windows.Forms.Label();
this.timeDetailsGroupLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// packageDetailsGroupLabel
//
this.packageDetailsGroupLabel.Font = new System.Drawing.Font("Microsoft
Sans Serif", 8.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.packageDetailsGroupLabel.Location = new System.Drawing.Point(12,
47);
this.packageDetailsGroupLabel.Name = "packageDetailsGroupLabel";
this.packageDetailsGroupLabel.Size = new System.Drawing.Size(163, 13);
this.packageDetailsGroupLabel.TabIndex = 22;
this.packageDetailsGroupLabel.Text = "Package Details:";
//
// timeDetailsGroupLabel
//
this.timeDetailsGroupLabel.Font = new System.Drawing.Font("Microsoft Sans
Serif", 8.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.timeDetailsGroupLabel.Location = new System.Drawing.Point(12, 9);
this.timeDetailsGroupLabel.Name = "timeDetailsGroupLabel";
this.timeDetailsGroupLabel.Size = new System.Drawing.Size(163, 13);
this.timeDetailsGroupLabel.TabIndex = 21;
this.timeDetailsGroupLabel.Text = "Timing Details:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(220, 79);
this.Controls.Add(this.packageDetailsGroupLabel);
this.Controls.Add(this.timeDetailsGroupLabel);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
private System.Windows.Forms.Label packageDetailsGroupLabel;
private System.Windows.Forms.Label timeDetailsGroupLabel;
}
If you have any ideas, or would like to see a screenshot of what I'm talking
about, please let me know.
Thanks,
Chris Tag: Controls on multiple tabs Tag: 95181
Listen event on different thread and update data on UI thread
Hi,
I have a class in which I am receiving a event continuously at a great
speed. I need to listen to that event and show it on the grid in the GUI.
The problem is that the event is very very fast.
How can I listen to this event in a separate thread. Then take the data and
put it in the DataTable. I can send this DataTable back to the GUI thread
where I have a windows form on which I have applied the grid control. Please
let me know if I am not clear.
Please help.
Regards,
Rajat. Tag: Controls on multiple tabs Tag: 95179
Form and a MCppCodeDomParser error:
Hello. Every time I try and change the design or layout of the form I
receive this error.
MCppCodeDomParser error:
However, the code will compile and run fine.
Any ideas?
--
www.integrated-dev-sol.co.uk
Remove 123 from email address to reply.
Anti spam and virus measure. Tag: Controls on multiple tabs Tag: 95177
Visual Studio macro running as a STA thread
Dear All,
We have written a small set of dlls that contain some WinForms...we
lauch these forms in Visual Studio using a macro. By default the macro
thread is a MTA thread. Are there any issues if we make this thread an
STA thread?
I need this as an STA thread as the user wants to copy some elements
from the grid in the clipboard. I don't want to create a separate STA
thread for the copy functionality.
Why is the macro thread an MTA thread? Is MS planning to change it back
to STA thread?
Please help
Thanks in advance...
Many regards
Jack Tag: Controls on multiple tabs Tag: 95171
Is IMessageFilter only for .net windows?
Hi;
(I am trying to figure out the best way to intercept Word's message pump in
a .net app.) It looks like an IMessageFilter object can only be attached to
the message pum of a .net Application so it could not be used with Word. Is
this correct?
--
thanks - dave Tag: Controls on multiple tabs Tag: 95163
NativeWindow.ReleaseHandle
Hi;
I want to use NativeWindow to wrap the hwnd of Word (which is already
running and so the window exists). I need to release the handle and dispose
my NativeWindow object when the window goes away.
As Word is not a .net app, it does not have .net windows and therefore I
can't have it call an event. Do I just watch for the WM_DESTROY message in
the message pump?
--
thanks - dave Tag: Controls on multiple tabs Tag: 95162
Where is MyNativeWindowListener and MyNativeWindow?
Hi;
The VS 2005 documentation (release) for the NativeWindow class discusses the
samples MyNativeWindowListener & MyNativeWindow. But I cannot find the actual
samples anywhere. Where are they?
--
thanks - dave Tag: Controls on multiple tabs Tag: 95161
Take over screen.
I need to write an app where I use the entire screen. This includes getting
rid of the task bar. How do I do that?
TIA - Jeff. Tag: Controls on multiple tabs Tag: 95154
Databound ListBox Won't Update on Clear?
I have a ListBox control bound to an ArrayList:
m_expressionFilters = New ArrayList
m_expressionBindingManager = BindingContext(m_expressionFilters)
lstboxFilters.DataSource = m_expressionFilters
When I add an Item to the ArrayList, that change is immediately reflected in
the ListBox:
m_expressionBindingManager.SuspendBinding()
m_expressionFilters.Add(CurrentFilter)
m_expressionBindingManager.ResumeBinding()
However, when I call the Clear method of the ArrayList, the changes are not
reflected in the ListBox:
m_expressionBindingManager.SuspendBinding()
m_expressionFilters.Clear()
m_expressionBindingManager.ResumeBinding()
At this point, the m_expressionFilters ArrayList has a Count of zero, but
the Items formerly held in the ArrayList are still listed on the form in the
ListBox. I have tried calling the Refresh and Update methods on the
ListBox, but that produced no visible changes at all.
Any help or advice would be greatly appreciated.
Carl Tag: Controls on multiple tabs Tag: 95151
crystal integration
Using v1.1 of the .Net Framework, I added a Crystal Report item to my
solution as an embedded resource. My problem is that when I drop a
ReportDocument component onto my form, the window that prompts me to select
a typed reportDocument does not include in its drop-down the embedded report
that I added, and so I can't integrate the report into the form thru the
crystalReportViewer. Any idea why I wouldn't see the report show up in the
drop-down?
Thanks! Tag: Controls on multiple tabs Tag: 95147
Handling System Shutdown in a WindowsForms App
Hi. I have an application that runs as a Tray Icon app with no visible window
(most of the time) and right now, the system will not shut down while that
app is running. I think I need to handle "SystemEvents.SessionEnded" or
something to properly deal with that but I don't understand how, inside the
code for my Main Form for the application, I set up a handler for the event
and then what I actually DO with the event once it comes (though I assume I
just do whatever I would normally do to exit my application grcefully).
Can someone help me with a sample?
Alex Tag: Controls on multiple tabs Tag: 95141
Detect any kind of activity in a window.
I need to write a function so if the user doesn't do anything in 15 minutes,
it will log them out. I've got the timer set up fine I'm just looking for an
easy way to detect people doing anything. What's the easiest way to do it?
It looks like it may be mousemove on the windows. Is this reasonable?
TIA - Jeff. Tag: Controls on multiple tabs Tag: 95140
ListView.tag lost object
Hi,
I have a Form with two ListViews; The ListViews are diplayed on the
Design surface, but I progmatically adding the items to each ListView.
When adding the items to the list view I am iterating through and
setting the following:
...
With myListViewItem
.Text = drArticles("Title").ToString
.ToolTipText = drArticles("Summary").tostring
.Tag = CType(drArticles("ID"),Guid)
End With
myListView.Items.Add
...
This works fine and the items are displayed.
The problem arises when I respond to a SelectedIndexChanged event I can
retrieve the .ToolTipText and .Text values from then
SelectedListViewItemCollection but the .tag property is always empty (it
knows the object type is GUID but does not have the value. I know the
value is being set as I can set the ToolTipText to same ID as the TAG
and it is stored correctly.
Any ideas?
Many thanks in advance Tag: Controls on multiple tabs Tag: 95138
ListView.tag loast object
Hi,
I have a Form with two ListViews; The ListViews are diplayed on the
Design surface, but I progmatically adding the items to each ListView.
When adding the items to the list view I am iterating through and
setting the following:
...
With myListViewItem
.Text = drArticles("Title").ToString
.ToolTipText = drArticles("Summary").tostring
.Tag = CType(drArticles("ID"),Guid)
End With
myListView.Items.Add
...
This works fine and the items are displayed.
The problem arises when I respond to a SelectedIndexChanged event I can
retrieve the .ToolTipText and .Text values from then
SelectedListViewItemCollection but the .tag property is always empty (it
knows the object type is GUID but does not have the value. I know the
value is being set as I can set the ToolTipText to same ID as the TAG
and it is stored correctly.
Any ideas?
Many thanks in advance Tag: Controls on multiple tabs Tag: 95137
Close all windows in a VB.Net program
I've got a VB.Net program where under a condition I want to close all of my
windows (logging out the user due to inactivity). Is there a way to close
all of the currently open windows without going through each one to check if
it exists?
TIA - Jeff. Tag: Controls on multiple tabs Tag: 95136
General Windows Forms and Memory Question
I am seeing an interesting memory issue with a winform in my application.
I've noticed everytime I show a form in my application, the memory usage
increases. When I close the form, the memory isn't released. The only time
the memory is released is when I "minimize" the application. Eventually,
overtime, my application consumes a good amount of memory.
Has anyone experienced this?
Thanks,
Yosh Tag: Controls on multiple tabs Tag: 95135
ClickOnce returns XML instead of starting application
Hi
I just deployed a ClickOnce Application to a Windows 2000 Server, which only
has .NET 1.1 installed.
When I launch the application via the auto generated html page I get the
.Application XML back. I was expecting the application to launch.
If I deploy the same SmartClient to my local XP machine with .NET 2.0, the
applications installs and starts just fine.
Am I missing something? Do I need to install .NET 2.0 on the Windows 2000
server, or do I need to register some MIME types on the server? If so, could
you please provide a link (I can't find anything in the documentation... but
I found place that said that I should be able to deploy to any HTTP 1.1
compliant web server).
Please help.
Thomas Tag: Controls on multiple tabs Tag: 95132
.NET 2.0: ToolStripTextBox with Caption?
In a Winforms 2.0 application, I have a StatusStrip which hosts a
ToolStripDownDown item to display a small menu. The menu consists of
two checkable menu items and one ToolStripTextBox . Now I want to
display a simple caption on the left of the textbox. I cannot seem to
find an easy possiblity to do this, altough this seems a very common
scenario to me. After all, which programmer wants to just display a
textbox without any caption? Can somebody help me? Do I really have to
bake my own control inherited from ToolStripControlHost just for this?
Thanks for any help
Urs Eichmann Tag: Controls on multiple tabs Tag: 95129
propertygrid hosting in IE
I am not able to get properties in propertygrid with custom TypeConverter
working properly when hosted in Internet Explorer. Please help Tag: Controls on multiple tabs Tag: 95128
TabControl.OnDrawItem
Hello ppl!
I am manually drawing tab items in a TabControl by using a handler attached
to the DrawItem event on such control. I am using rectangles inside the
Item's region
for the background and drawing strings for text using the graphics object
provided in the DrawItemEventArgs. I al also painting the aread just to the
right of the last tab with another rectangle in the same DrawItem event.
The form runs just fine and I can see the tabs asd intended on the initial
load. However, as I move the form to either the left or right just beyond
the screen, my painted rectangle simply dissapears or gets smeared. If the
form is moved beyog the screen's upper or lower boundaries the rectangle gets
painted again. This also happens if another window is on top of the
tabcontrol. I tried timers for refreshing the control and the form. Tried
also a refresh on the form on a Move event and managed to eliminate the
problem is the form moves beyond the right screen boundary but still the
same problem on the left boundary. Anyway I can work around this?
Thanks in advance
sampe code of the event handler:
private void tabControl1_DrawItem(object sender,
System.Windows.Forms.DrawItemEventArgs e)
{
Graphics g = e.Graphics;
int lastTabIndex = this.tabControl1.TabPages.Count-1;
System.Drawing.StringFormat textFormat = new StringFormat();
textFormat.Alignment = StringAlignment.Center;
textFormat.LineAlignment = StringAlignment.Center;
textFormat.Trimming = StringTrimming.None;
textFormat.FormatFlags = StringFormatFlags.NoWrap;
Rectangle tabRect = this.tabControl1.GetTabRect(e.Index);
Rectangle lastTabRect = this.tabControl1.GetTabRect(lastTabIndex);
//filler rectangle beyond last tab
g.FillRectangle(new SolidBrush(Color.Blue), lastTabRect.Right,
lastTabRect.Top, this.tabControl1.DisplayRectangle.Width,
lastTabRect.Height);
//tab Item background
g.FillRectangle(new SolidBrush(Color.Red), tabRect);
//Item text
g.DrawString(this.tabControl1.TabPages[e.Index].Text,
e.Font,
new SolidBrush(Color.White),
tabRect,
textFormat);
} Tag: Controls on multiple tabs Tag: 95127
Splashscreen disappears
I added a Splashscreen to my Windows Forms project.
I specified it in Project - Application Tab - Splash screen.
When I launch the project the splash screen turns up, which is fine.
BUT then a NullReferenceException is thrown!
I turned on "Break when an Exception is thrown" but it will not stop on a
code line that is visible to me.
My application uses a frmMain as start form.
The frmMain code is enclosed by a Namespace.
When I enclosed the SplashScreen code in the same Namespace and modified
Project - Application Tab - Splash screen to point out the new full name,
then the problem disappears, but so does the SplashScreen .......!
As far as I can see there are no more settings I should have set to get it
working. Tag: Controls on multiple tabs Tag: 95126
Control to graphically connect listviews (or treeviews)
Hello.
I'm lookin for a way to have two listboxes whose some elements can be
connected graphically by an arrow. The arrows should 'move' as the listboxes
scroll, 'following' the elements they are attached to.
It should be similar to the relations fields in graphic
representation of SQL queries (as in Visual Studio's Query Designer)
I'd like to have a similar effect with two treeviews (whose element can
connected by arrows, as in Biztalk Mapper)
Does anyone know if there is a third party control that allow this?
Thank you. Tag: Controls on multiple tabs Tag: 95125
Smart Client Offline Application Block in .NET 2.0?
Hi,
Couple of questions:
1. Does anyone know whether Microsoft have plans to redevelop the SCOAB for
.NET 2.0?
2. Has anyone had experience using the existing release of SCOAB with .NET
2.0?
We have recompiled the block in 2.0, and there are lots of warnings and a
couple of compile errors (to do with Win32 calls using unsafe code within
the caching component) in the release build.
Thanks,
Chris Tag: Controls on multiple tabs Tag: 95124
Run Time Controls
hi,
I'm adding 5 Text box controls during runtime in my windows application. I'm
adding those in a for loop.
But i got only one text box as result in my form.
Why like this? And what i have to do for displaying all 5 text boxes?
Regards,
Gomathi Tag: Controls on multiple tabs Tag: 95117
guide to design a custom/ flashy windows application
I did developed a windows application which mainly does the function of
displaying data and updating the data changed by the user using visual
studio.net 2003
Now I want to improve the look and feel of the user interface of the
application. I tried embedding some pictures onto the forms and then
making the labels to have transperent color. But this change throwed an
'Invalid Value' error.
Any suggestions for my issue resolving or regarding the development of
user interface is greatly appreciated.
Thanks in advance
arun Tag: Controls on multiple tabs Tag: 95108
Serializing/Deserializing from a Modal UI Editor
I created a control that I derived from Windows Forms Control. I added one
string property, which is the name of a file. This property is a Modal UI
Editor property for which I provided a form named ShapeEditor. When the user
presses the ellipsis in the Properties window of the control in the IDE,
ShapeEditor is displayed and enables the user to draw shapes. The shape
objects are collected in an ArrayList and then serialized to a file using a
BinaryFormatter as follows.
FileStream sw = new FileStream(ShapesFileName, FileMode.Create);
ArrayList Shapes = new ArrayList();
// Create shapes and populate Shapes.
....
Shapes.Add(ShapeObject);
.....
// Then serialize
bf.Serialize(sw, Shapes);
// Deserialization is the reverse:
Shapes = new ArrayList();
sr = new FileStream(ShapesFileName, FileMode.Open);
BinaryFormatter bf = new BinaryFormatter();
Shapes = (ArrayList)bf.Deserialize(sr);
// Use objects
foreach (ShapeObject s in Shapes)
Here is the problem.
When I invoke ShapeEditor from the properties window
foreach (ShapeObject s in Shapes)
fails with an invalid cast exception even though Shapes[0].GetType() returns
a ShapeObject.
However, if I invoke ShapeEditor from a running program, everything works
fine(the same code is executed). It is as if the IDE is somehow interferring
with the deserialization.
Any help greatly appreciated. Tag: Controls on multiple tabs Tag: 95107
Custom Control ClipRegion Question
In a few of my custom controls, I need to ensure that when the control goes
from a partially obscured state to a fully exposed state, that the entire
ClientRectangle control is re-rendered, rather than just the portion that
was exposed. This seems like a simple thing, yet my simple mind hasn't come
up with a solution that works in all cases...
I've tried Graphics.SetClip, btw, and it didn't do anything. Perhaps I
haven't interpreted the black box correctly...
Any ideas appreciated... Tag: Controls on multiple tabs Tag: 95106
BindingSource vs. old binding
I'm getting myself confused about the new BindingSource. In the old days I'd
bind a combobox like this to show the "productName" field:
DataSet ds = getDS();
cboX.DataSource = ds.Tables["Products"];
cboX.ValueMember = "productID";
cboX.DisplayMember = "productName";
Now I guess I can do this:
BindingSource bs = new BindingSource(getDS(), "Products");
which sets the bs.DataSource and the bs.DataMember (ie the table within the
dataset).
But, how do I tell it what field to display when the table has multiple
fields? There is no longer any DisplayMember or ValueMember property. Tag: Controls on multiple tabs Tag: 95105
Is there a way to mirror a control onto multiple tabs? Have 1 listview
displayed on 2 tabs or 1 textbox displayed on 2 tabs but function as 1?
One other idea, just create two listviews, one on each tab page, but
have them both point to the same data source. Then you will only need
to maintain the data once and both list views should be updated!