|
Thanks for the tip. I did some research and found the "Application.EnableVisualStyles" method. I called it from the constructor of my toolbar, and after I called it I displayed "Application.RenderWithVisualStyles", the value of which was true. However, my toolbar and its controls are still gray. Do you know how I should be setting the background color to work with EnableVisualStyles?
Susan
|
|
|
|
|
Now I have the controls painting in default Vista style, but the toolstrip itself is not.
|
|
|
|
|
I want to know what's the best way to make a windows form application in C# to connect people for online meeting? and what are tools available; for that?
|
|
|
|
|
The best way would be to design a client/server conferencing system that can handle duplex communication of audio, video and text, membership, authentication, and perhaps encryption. Some technologies you may want to examine are WCF, RIA services and Silverlight.
This is a non-trivial endeavour - your question is too open ended to provide a direct answer.
/ravi
|
|
|
|
|
Maybe use WebBrowser and Google Buzz?
|
|
|
|
|
I want to know how can I place the current time using analog clock on my windows form?
|
|
|
|
|
What are you talking about?
Nevertheless, there are a lot of analog clocks here on the CP. A couple of links:
Yet Another Analog Clock[^]
Analog Clock Control[^]
If you search for articles using the search word "analog clock", you will get 6 pages of links. There are A LOT - some good looking, others less good looking...
|
|
|
|
|
i was trying to do it my self
|
|
|
|
|
OK, I misunderstood. But then you ought to post a more concrete question ("My problem is this...") instead of "How do I make an analog clock control"
The answer to the last question will always be "find an article and see how it's done there", because nobody is going to write a novel containing full explanations of what you should do.
If you have a specific, broken down problem, however... That's something people can help you with.
|
|
|
|
|
Hi,
I have the following files which was working fine until last night when I went and deleted all the commented old codes to clear the file from unwanted lines but suddenly I am getting now the following many errors and I don't know where is the issue.. Please help...
This the full file:
patient_entry.cs[^]
and these are the errors:
Error 3 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 380 17 Cure
Error 4 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 383 34 Cure
Error 5 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 383 91 Cure
Error 6 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 389 31 Cure
Error 7 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 393 31 Cure
Error 8 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 397 28 Cure
Error 9 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 399 52 Cure
Error 10 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 400 86 Cure
Error 11 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 407 50 Cure
Error 12 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 418 52 Cure
Error 13 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 418 168 Cure
Error 14 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 442 17 Cure
Error 15 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 445 34 Cure
Error 16 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 445 91 Cure
Error 17 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 451 31 Cure
Error 18 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 455 31 Cure
Error 19 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 459 28 Cure
Error 20 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 461 52 Cure
Error 21 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 462 86 Cure
Error 22 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 469 51 Cure
Error 23 Expected class, delegate, enum, interface, or struct C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 470 51 Cure
Error 24 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 481 52 Cure
Error 25 Identifier expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 481 169 Cure
Error 26 Type or namespace definition, or end-of-file expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 502 9 Cure
Error 27 Invalid expression term ':' C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 373 24 Cure
Error 28 Syntax error, '(' expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 373 24 Cure
Error 29 ; expected C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 373 25 Cure
Error 30 The name 'get_person' does not exist in the current context C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 325 29 Cure
Error 31 The name 'get_person' does not exist in the current context C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 337 29 Cure
Error 32 No enclosing loop out of which to break or continue C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 372 21 Cure
Error 33 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 373 17 Cure
Error 34 No enclosing loop out of which to break or continue C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\patient_entry.cs 376 21 Cure
|
|
|
|
|
You forgot an opening curly brace at line 215, causing a cascade of "scopes that were closed too early"
213:
214: bahrain_smartcard_error = bahrain_smartcard_data.ReadIDCard(BahrainAPI.BahrainData.Fields.EnglishName, ref bahrain_smartcard_Name);
215: if (bahrain_smartcard_error != 0) <big>{</big> MessageBox.Show(bahrain_smartcard_error.ToString()); }
Or remove the useless closing brace at the end of that line.
|
|
|
|
|
Hi,
I'm not going to download anything.
My advice is: concentrate on the first error. It tells me you probably opened a namespace, and provided some data members or methods, while not having opened a class/struct/whatever yet.
|
|
|
|
|
Other than comments, looks like you have removed some code from the following section -
catch (Exception exp)
{
MessageBox.Show("Error updating smartcard data!!" + Environment.NewLine + exp.Message + Environment.NewLine + "Please try again or enter data manually", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
public_var.create_event("System", "Error updating smartcard data!!", exp, EventLogEntryType.Error, 1000, true);
return;
}
finally
{
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
lblReadSmartCard.Visible = false;
lblReadSmartCard.Refresh();
progressReadSmartCard.Visible = false;
progressReadSmartCard.Refresh();
My signature "sucks" today
|
|
|
|
|
Hey
My application uses directshow to playback videos. If a video is playing and the user minimizes and then brings the window back on screen the video disapears. Does anyone have any idea of what could be causing this?
Thanks
|
|
|
|
|
Does this happen on all machines?
I ran into an issue with no-name nVidia cards that didn't have the updated drivers. Updating the drivers got the video to work.
|
|
|
|
|
Your render device may be lost. Try catching the render device's DeviceResizing, DeviceReset and DeviceLost events.
|
|
|
|
|
Hi All.
I have been developing my own OwnerDrawn TabControl so I can have a close button on the right hand side of the tab. All was going well thanks to some of the articles on CP and now it has stopped working in Design mode. When the control is used in the test form when the app is running, everything works as expected. In design mode I cannot switch tabs to add controls to them. Any ideas?
public class ClosableTabCtrl : TabControl
{
#region Private Members
private System.Windows.Forms.ImageList buttonImageList;
private bool showCloseButton = true;
private bool hideCloseButtonWhenOnlyOneTab;
private const string tabText = " ";
private int buttonImageIndex;
#endregion
public ClosableTabCtrl() : base()
{
buttonImageList = new ImageList();
buttonImageList.Images.Add((Image)new Bitmap(Resources.InactiveCross));
buttonImageList.Images.Add((Image)new Bitmap(Resources.ActiveCross));
buttonImageList.Images.Add((Image)new Bitmap(Resources.ClickedCross));
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.DrawItem += new DrawItemEventHandler(ClosableTabCtrl_DrawItem);
this.MouseMove += new MouseEventHandler(ClosableTabCtrl_MouseMove);
this.MouseLeave += new EventHandler(ClosableTabCtrl_MouseLeave);
this.MouseClick += new MouseEventHandler(ClosableTabCtrl_MouseClick);
this.MouseDown += new MouseEventHandler(ClosableTabCtrl_MouseDown);
this.MouseUp += new MouseEventHandler(ClosableTabCtrl_MouseUp);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
void ClosableTabCtrl_MouseUp(object sender, MouseEventArgs e)
{
if (MouseIsOverButton(e) && buttonImageIndex != 1)
{
buttonImageIndex = 1;
this.Invalidate();
}
}
void ClosableTabCtrl_MouseDown(object sender, MouseEventArgs e)
{
if (MouseIsOverButton(e) && buttonImageIndex != 2)
{
buttonImageIndex = 2;
this.Invalidate();
}
}
void ClosableTabCtrl_MouseClick(object sender, MouseEventArgs e)
{
if (MouseIsOverButton(e))
{
}
}
void ClosableTabCtrl_MouseLeave(object sender, EventArgs e)
{
if (buttonImageIndex != 0)
{
buttonImageIndex = 0;
this.Invalidate();
}
}
void ClosableTabCtrl_MouseMove(object sender, MouseEventArgs e)
{
if (MouseIsOverButton(e))
{
if (buttonImageIndex != 1)
{
buttonImageIndex = 1;
this.Invalidate();
}
}
else
{
if (buttonImageIndex != 0)
{
buttonImageIndex = 0;
this.Invalidate();
}
}
}
public bool ShowCloseButton
{
get { return showCloseButton; }
set { showCloseButton = value; }
}
public bool HideCloseButtonWhenOnlyOneTab
{
get { return hideCloseButtonWhenOnlyOneTab; }
set { hideCloseButtonWhenOnlyOneTab = value; }
}
bool MouseIsOverButton(MouseEventArgs e)
{
Rectangle r = this.GetTabRect(this.SelectedIndex);
r.Offset(2, 2);
Rectangle b = new Rectangle(new Point(r.X + (this.GetTabRect(this.SelectedIndex).Width - 20), this.GetTabRect(this.SelectedIndex).Height / 2 - 7),
new Size(17, 17));
if (b.Contains(e.Location))
{
return true;
}
else
{
return false;
}
}
void ClosableTabCtrl_DrawItem(object sender, DrawItemEventArgs e)
{
Rectangle r = this.GetTabRect(e.Index);
string title = String.Empty;
r.Offset(2, 2);
Brush TitleBrush = new SolidBrush(Color.Black);
Font f = this.Font;
if (e.State == DrawItemState.Selected)
{
if (!this.TabPages[e.Index].Text.EndsWith(tabText))
{
this.TabPages[e.Index].Text += tabText;
}
title = this.TabPages[e.Index].Text + tabText;
if (showCloseButton)
{
if (!(this.hideCloseButtonWhenOnlyOneTab && this.TabPages.Count == 1))
{
e.Graphics.DrawImage(buttonImageList.Images[buttonImageIndex],
new Point(r.X + (this.GetTabRect(e.Index).Width - 20),
this.GetTabRect(e.Index).Height / 2 - 7));
}
}
}
else
{
if (this.TabPages[e.Index].Text.EndsWith(tabText))
{
this.TabPages[e.Index].Text = this.TabPages[e.Index].Text.Replace(tabText, string.Empty);
}
title = this.TabPages[e.Index].Text + tabText;
}
e.Graphics.DrawString(title, f, TitleBrush, new PointF(r.X, (r.Height - f.Height) / 2 + 1));
TitleBrush.Dispose();
}
}
Thanks in advance.
The FoZ
modified on Wednesday, June 16, 2010 11:46 AM
|
|
|
|
|
I did something similar some time ago (although I don't think I actually inherited from tabControl), and implementing the design time functionality was a little problematic.
You can try to have a look at the souce to my Scroll Selector here:
ScrollSelector[^]
That might give you some pointers...
Good luck
|
|
|
|
|
Thanks Johnny J
I've had a look through and to be honest I'm not sure how it all works together. I'm having trouble getting it to work in 2008.
I'm going to try and build it again from scratch by pasting in the code bit by bit and testing along the way. I was able to select the different tabs in design mode before lunch. I wonder what has happened. If I find out I will post it here.
Cheers
The FoZ
|
|
|
|
|
I rebuilt it from scratch and here is what I found.
In the DrawItem method, the design mode does not like it when I change the text of the tab. The line I found to cause the trouble is
this.TabPages[e.Index].Text = this.TabPages[e.Index].Text.Replace(tabText, string.Empty);
Looks like I am going to have to actively calculate the size of the tab which is probably the best way to go about it.
If anyone can shed some light on the reason for this so I know why I shouldn't do it my original way, I would be grateful.
Cheers
The FoZ
|
|
|
|
|
Hello expert
I need the x symbol when click on the checkbox inside the datagridview. when i click on checkbox dot symbol are displayed instead on dot symbol i need the x symbol.
Please help me.
|
|
|
|
|
Hi Experts,
I'm trying to serialize a collection
using (System.IO.MemoryStream saveStream = new System.IO.MemoryStream())
{
System.Xml.Serialization.XmlSerializer saveSerializer = new System.Xml.Serialization.XmlSerializer(typeof(MyFineCollection));
saveSerializer.Serialize(saveStream, _manyObjects);
} The collection contains objects of following types
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace Test_Xml
{
public class MyFantasticBaseClass
{
private int _id = 0;
public MyFantasticBaseClass(int id)
{
this._id = id;
}
public int Id
{
get { return (_id); }
}
}
public class FirstDerivedClass : MyFantasticBaseClass
{
private bool _isReallyUseful = true;
public bool IsReallyUseful
{
get { return (_isReallyUseful); }
set { _isReallyUseful = value; }
}
}
public class SecondDerivedClass : MyFantasticBaseClass
{
private double _zoom = 1.0;
private MyFantasticBaseClass _linkedElement = null;
public double Zoom
{
get { return (_zoom); }
set { _zoom = value; }
}
public MyFantasticBaseClass LinkedElement
{
get { return (_linkedElement); }
set { _linkedElement = value; }
}
}
public class MyFineCollection:ICollection<MyFantasticBaseClass>
{
List<MyFantasticBaseClass> _innerList = new List<MyFantasticBaseClass>();
}
} Now, when collection contains an instance of one of the child classes, the line marked with "/*Ex*/" throws an InvalidOperationException with inner NullReferenceException.
How can I serialize the collection including all objects derived from MyFantasticBaseClass?
Ciao,
luker
|
|
|
|
|
Don't you need to mark the classes as Serializable?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
lukeer wrote: How can I serialize the collection including all objects derived from MyFantasticBaseClass?
By marking them all as Serializable , or implementing the ISerializable interface.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Unfortunately, simply adding the [Serializable] attribute doesn't do the trick.
And as far as my tests show, the attribute isn't even necessary for serialization with System.Xml.Serialization.XmlSerializer.
The problem at hand is not serializing a class. That part works flawlessly, at least if _manyObjects contains nothing but instances of MyFantasticBaseClass.
Things get ugly when _manyObjects contains instances of children of MyFantasticBaseClass.
How can I get this to work?
Ciao,
luker
|
|
|
|
|