Show Desktop How can I bring the Desktop to the top, like pressing [Windows]+[D ]
Important : the way of minimizing all windows by calling ShowWindow ( p .MainWindowHandle, SW_MINIMIZE) for each process p returned by Process.GetProcess() doesn't solve my problem, but something like to minimize all windows listed in systray would. Tag: Visual C# General 2D Drawing Options Visual C#
Using C++ SDK in C#? I have a set of cameras that I need to write a program to operate and the manufacturer provides an SDK in C++. However, the system I need to interface with is all being written in C# and I need to know if there will be a problem running those function (I assume there will be) Tag: Visual C# General 2D Drawing Options Visual C#
Migration to 2005 I am migrating to 2005, is there any easy way to get snippets over into 2005 from 2003 and is there any easy way to get the contents of the toolbox i.e. componets over to 2005 Tag: Visual C# General 2D Drawing Options Visual C#
storing values between two forms Hi,
IS there away to store values between forms, without using Viewstate, sessions, or cookies,
//A class:
public class BaseClass : System.Web.UI.Page
{
private string test = "";
public string A { get { return test;} set { test= value ;} }
}
my first webform1.aspx
private void bt_c_Click( object sender, System.EventArgs e)
{
BaseClass bc = new BaseClass();
bc.A = "hello world";
Response.Redirect("WebForm2.aspx");
}
after it redircts to webform2.aspx and when I try to print the value: The value is blank, why is that
BaseClass bc = new BaseClass();
Response.Write("-------<BR>"+bc.A);
Thank you, Tag: Visual C# General 2D Drawing Options Visual C#
report logging you can probably easily create the methods to insert data into the database....
create a method that splits the entries into fields by the comma seperator for example, then for each item in the string array, create a parameter, add it to the SQL parameter collection and executeNonQuery, clear the parameter collection and keep doing this until no more items in the string[] array. Of course the number of fields must match up the fields in the database table, or should I say there should be no less than the number of fields from the textfile or there can be more but having the fields not a required field.
you are going to face perf issues as logs get filled up into the file...better start now than later Tag: Visual C# General 2D Drawing Options Visual C#
Environment.SpecialFolder.MyDocuments in C#1.1 hi,
Environment .GetFolderPath( Environment . SpecialFolder .MyDocuments) ;
how to achieve the same in framwork 1.1. Environment does not have SpecialFolder in vs2003 ;-(
thanks Tag: Visual C# General 2D Drawing Options Visual C#
I would like to ask about Face Detection Ki Ki, try this link: franck.fleurey.free.fr/ Face Detection / Found it when searching with google. Keyword: "face detection C#" It's the first link. Tag: Visual C# General 2D Drawing Options Visual C#
C# Newbie - Problem with syntax? Compiler: Visual C# 2005 Express I am tring to see if a file exists and if it does delete it. To see if the file exists I am using: bool exists; exists = Syste.IO.File.Exists(@"c:\test.txt"); To delete the file I am using: System.IO.File.Delete(@"c:\test.txt"); The test file is located in c:\ and is called test.txt however, exists always returns false and the file is never deleted. What am i doing wrong What is the purpose of the @ symbol before the file name thanks Tag: Visual C# General 2D Drawing Options Visual C#
only view select text in textbox hi,
i have a textbox that i populate but i only want to show the start about 8 characters, what would i need to do so i can only show the first 8 without showing all is there somthing like trim or somthing like that and how
huge thanx Tag: Visual C# General 2D Drawing Options Visual C#
Problems with Intellisense popup behavior My intellisense will appear for a second and then disappear. It does not give me time to scroll or select anything.
This behavior is not consistent. Is there a timing or environment setting for intellisense How does it determine how long it stays visible
Thanks, Tag: Visual C# General 2D Drawing Options Visual C#
2 simple questions I am trying to create a security image program.. you know to prevent automatic requests.
I have my own font file *.tff .. but i don't know how to use it inside the program.. i tried to declare a new font object, but i couldn't import the font file into it.
is there any way to import my own font file and use it
the second issue is related random numbers..
i have an array of letter {A-Z , 0-9};
and constant length = 5
how can i create an alphanumeric random text out of this array, based on system time changes
another question has just poped up into my mind
can you give me a good example for using md5 objects
thnks alot Tag: Visual C# General 2D Drawing Options Visual C#
How to use string.replace to replace "\\" with "\" in a string? _currentUserName = @_currentUserName.Replace(@"\\", @"\");
sqlCommand.Parameters[@"username"].Value = _currentUserName;
_currentUsername still has two slashes.... Tag: Visual C# General 2D Drawing Options Visual C#
Visual Studio Set References Copy Local to True Hi,
I have a solution which contains many dll and exe.
I set the Copy Local properties to each of References of all projects (it depends, some must be true, and some must be false).
I build and save the solution, everything is in the right place.
The csproj files seem to be good with <Private>False</Private> or <Private>True</Private> in every section.
If I close VS and re-open my solution, all References are set to true, despite the value of the csproj.
I don't understand what happens, and this is very unconvenient, because I have to re-set Copy Local in each Reference manually.
My collegue, who works on the same VSS base, don't have the problem.
I have not VS SP1 installed, but I have not seen any improvment in that way.
Thanks for any help or suggestion. Tag: Visual C# General 2D Drawing Options Visual C#
% Operator Here's what I'm trying to acheive. I need to have a condition in an if statement so that it occurs only if the value is divisible by 100. Here's a code snippet of what I'm working with: if (value < 1200 && " ") { _departmentID = value; _rules.MaintainRule("department", false); PropertyColors["department"] = Color.Black; } The condition will be going in place of the quotes. I know it has something to do with % operator but cannot figure out what I need to do. The reasoning is that I only want the if statement to be true if the departmentID is less than 1200 and divisible by 100. Tag: Visual C# General 2D Drawing Options Visual C#
Unmanaged to managed code Mark Benningfield wrote:
Try this:
[ DllImport (" dllfilename ")] public static extern Int32 XPTO( byte aux);
Not quite. It's "DWORD XPTO(BYTE **aux)" and those two stars are important.
With one star, I believe we could have used: [DllImport("dllfilename")] public static extern Int32 XPTO( ref byte aux);
But for two stars, I think we'll need:
[DllImport("dllfilename")] public static extern Int32 XPTO( ref IntPtr aux);
with some extra manual code to get th ebyte out of the IntPtr. Tag: Visual C# General 2D Drawing Options Visual C#
msvcm80d.dll Error! When I attempt to load my program (C# 2005 SP1) on some computers, even some with VS 2005 installed I get the following error: The type initializer for '<Module>' threw an exception. System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'msvcm80d.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E). Any idea how I can make my program not rely on the above DLL as I know that it is a DEBUG DLL. In VS 2005 I believe that I am building in Release mode but how do I check. Assistance would be great! Tag: Visual C# General 2D Drawing Options Visual C#
"No more internal identifiers available" on rename of file there doesn't seem to be a "visual studio bugs" forums, this seems to be the closest.
Microsoft Visual Studio 2005 / Version 8.0.50727.762 (SP.050727-7600) / Microsoft .NET Framework Version 2.0.50727 / Installed Edition: Professional
i have a single project application (~2k files) on a local drive, d:.
suddenly, when i try to rename a file i get a "Cannot rename 'filename'.No more internal identifiers available." (sic).
remembering the first rule of support, i've rebooted my machine but still no dice.
is there anything else i can do Tag: Visual C# General 2D Drawing Options Visual C#
Windows Service - needs user interaction... or help with it :P So far, the problem looks like a typical webservice scenario. user interacts with the webservice interface, login, perform action based on session authentication. webservice calls windows service to perfom certain tasks. my suggestion is to pass the user information from webservice(which holds the authenticated session) to windows service, so that the windows service knows what process to run and returns the result back to webservice. the windows service itself is 'sessionless'. does that solve your problem
rternier wrote:
Hey, Thanks for the reply. I'm using sessions on the WebService, so that returns a cookie which is stored in the CookieCollection of the webservice object on the client. Even if the session is lost, the webservice can tell the Service that, but how can I get the service to send information to other programs (I don't think i really want to get into .NEt remoting that much...). I do have a client WinForm application that I can launch from the service. So if the service needs to launch it, it can. however iwth that, I do not know how to launch an application in the right process space. Example: If the service is running and no one is signed in, I can't launch any application - I have to wait for someone to sign in. When someone is signed in, my service can launch that app in the correct process space... but how do you determine what process space Tag: Visual C# General 2D Drawing Options Visual C#
Stuck on 1st program in C# book!!! Did you start by going to File-> New Project and selected Console Application Tag: Visual C# General 2D Drawing Options Visual C#
Enum.Equals vs == Hi, I have another newbie question. I was looking at documentation for the ' Enum.Equals() ' method at the msdn2 website, Enum , and I was wondering what is the difference between using something like; enum Mammals { Cat, Dog, Horse, Dolphin }; Mammals myPet = Mammals.Cat; Mammals yourPet = Mammals.Dog; if (myPet.Equals(yourPet)) { } // and this statement if (myPet == yourPet) { } Does one method have an advantage over the other At the msdn2 website they don't even mention "==" in the documentation. Which method is the acceptable standard and considered a best practice Thanks, Erica Tag: Visual C# General 2D Drawing Options Visual C#
Copy a Database file I have made a small copying application. The copy result is still the same with files being copied as 0KB. namespace CopyTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DialogResult res = openFileDialog1.ShowDialog(); if (res == DialogResult.OK) textBox1.Text = openFileDialog1.FileName; } private void button2_Click(object sender, EventArgs e) { DialogResult res = saveFileDialog1.ShowDialog(); if (res == DialogResult.OK) textBox2.Text = saveFileDialog1.FileName; } private void button3_Click(object sender, EventArgs e) { String sourcePath = textBox1.Text; String destinationpath = textBox2.Text; try { using (FileStream fs = File.Create(sourcePath)) { } //File.Delete(destinationpath); File.Copy(sourcePath, destinationpath); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } Tag: Visual C# General 2D Drawing Options Visual C#
blackjack program... how do i reset game to deal a new hand? namespace blackjack2player
{
public class blackjack : System.Windows.Forms. Form
{
private int whichpic, ply1tot, ply2tot, bankertot, counter = 0;
int [] cvalue ={11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,10,10,
11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,10,10
};
private PictureBox [] piccard = new PictureBox [5];
private int [] cardscore = new int [5];
private IContainer components;
private ImageList carddeck;
private Panel panel1;
private PictureBox pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5;
private Label lblplayer1tot, lblplayer2tot, lblbankertot;
private Button btndeal, btnbet, btntwist, btnstick, btntwist2, btnstick2;
private Timer timer1, timer2, timer3, timer4;
public blackjack()
{
InitializeComponent();
}
private void dealcards()
{
reset();
Random rancard = new Random ();
for ( int i = 0; i < 5; i++)
{
piccard = new PictureBox ();
piccard .Size = new Size (50, 65);
whichpic = rancard.Next(25);
piccard .Image = carddeck.Images[whichpic];
cardscore = cvalue[whichpic];
}
ply1tot = cardscore[0] + cardscore[3];
ply2tot = cardscore[1] + cardscore[4];
bankertot = cardscore[2];
pictureBox1.Image = piccard[0].Image;
pictureBox2.Image = piccard[1].Image;
pictureBox3.Image = piccard[2].Image;
pictureBox4.Image = piccard[3].Image;
pictureBox5.Image = piccard[4].Image;
//labels added as a check on cardscores
lblplayer1tot.Text = ply1tot.ToString();
lblplayer2tot.Text = ply2tot.ToString();
lblbankertot.Text = bankertot.ToString();
} //end dealcards
protected override void Dispose( bool disposing)
{
if (disposing && (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.ComponentModel. ComponentResourceManager resources = new System.ComponentModel. ComponentResourceManager ( typeof ( blackjack ));
this .carddeck = new System.Windows.Forms. ImageList ( this .components);
this .panel1 = new System.Windows.Forms. Panel ();
this .lblplayer1tot = new System.Windows.Forms. Label ();
this .lblplayer2tot = new System.Windows.Forms. Label ();
this .pictureBox5 = new System.Windows.Forms. PictureBox ();
this .pictureBox4 = new System.Windows.Forms. PictureBox ();
this .pictureBox3 = new System.Windows.Forms. PictureBox ();
this .pictureBox2 = new System.Windows.Forms. PictureBox ();
this .pictureBox1 = new System.Windows.Forms. PictureBox ();
this .btndeal = new System.Windows.Forms. Button ();
this .timer1 = new System.Windows.Forms. Timer ( this .components);
this .timer2 = new System.Windows.Forms. Timer ( this .components);
this .timer3 = new System.Windows.Forms. Timer ( this .components);
this .timer4 = new System.Windows.Forms. Timer ( this .components);
this .btnbet = new System.Windows.Forms. Button ();
this .btntwist = new System.Windows.Forms. Button ();
this .btnstick = new System.Windows.Forms. Button ();
this .btntwist2 = new System.Windows.Forms. Button ();
this .btnstick2 = new System.Windows.Forms. Button ();
this .lblbankertot = new System.Windows.Forms. Label ();
this .panel1.SuspendLayout();
((System.ComponentModel. ISupportInitialize )( this .pictureBox5)).BeginInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox4)).BeginInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox3)).BeginInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox2)).BeginInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox1)).BeginInit();
this .SuspendLayout();
//
// carddeck
//
this .carddeck.ImageStream = ((System.Windows.Forms. ImageListStreamer )(resources.GetObject( "carddeck.ImageStream" )));
this .carddeck.TransparentColor = System.Drawing. Color .Transparent;
this .carddeck.Images.SetKeyName(0, "ACE CLUBS.png" );
this .carddeck.Images.SetKeyName(1, "2C.png" );
this .carddeck.Images.SetKeyName(2, "3C.png" );
this .carddeck.Images.SetKeyName(3, "4C.png" );
this .carddeck.Images.SetKeyName(4, "c5.png" );
this .carddeck.Images.SetKeyName(5, "c6.png" );
this .carddeck.Images.SetKeyName(6, "c7.png" );
this .carddeck.Images.SetKeyName(7, "c8.png" );
this .carddeck.Images.SetKeyName(8, "c9.png" );
this .carddeck.Images.SetKeyName(9, "c10.png" );
this .carddeck.Images.SetKeyName(10, "cj.png" );
this .carddeck.Images.SetKeyName(11, "cq.png" );
this .carddeck.Images.SetKeyName(12, "ck.png" );
this .carddeck.Images.SetKeyName(13, "d1.png" );
this .carddeck.Images.SetKeyName(14, "d2.png" );
this .carddeck.Images.SetKeyName(15, "d3.png" );
this .carddeck.Images.SetKeyName(16, "d4.png" );
this .carddeck.Images.SetKeyName(17, "d5.png" );
this .carddeck.Images.SetKeyName(18, "d6.png" );
this .carddeck.Images.SetKeyName(19, "d7.png" );
this .carddeck.Images.SetKeyName(20, "d8.png" );
this .carddeck.Images.SetKeyName(21, "d9.png" );
this .carddeck.Images.SetKeyName(22, "d10.png" );
this .carddeck.Images.SetKeyName(23, "dj.png" );
this .carddeck.Images.SetKeyName(24, "dq.png" );
this .carddeck.Images.SetKeyName(25, "dk.png" );
//
// panel1
//
this .panel1.BackColor = System.Drawing. Color .FromArgb((( int )((( byte )(0)))), (( int )((( byte )(192)))), (( int )((( byte )(0)))));
this .panel1.Controls.Add( this .lblbankertot);
this .panel1.Controls.Add( this .lblplayer1tot);
this .panel1.Controls.Add( this .lblplayer2tot);
this .panel1.Controls.Add( this .pictureBox5);
this .panel1.Controls.Add( this .pictureBox4);
this .panel1.Controls.Add( this .pictureBox3);
this .panel1.Controls.Add( this .pictureBox2);
this .panel1.Controls.Add( this .pictureBox1);
this .panel1.Location = new System.Drawing. Point (12, 12);
this .panel1.Name = "panel1" ;
this .panel1.Size = new System.Drawing. Size (643, 363);
this .panel1.TabIndex = 0;
//
// lblplayer1tot
//
this .lblplayer1tot.AutoSize = true ;
this .lblplayer1tot.Location = new System.Drawing. Point (325, 232);
this .lblplayer1tot.Name = "lblplayer1tot" ;
this .lblplayer1tot.Size = new System.Drawing. Size (63, 13);
this .lblplayer1tot.TabIndex = 11;
this .lblplayer1tot.Text = "lblplayer1tot" ;
//
// lblplayer2tot
//
this .lblplayer2tot.AutoSize = true ;
this .lblplayer2tot.Location = new System.Drawing. Point (12, 232);
this .lblplayer2tot.Name = "lblplayer2tot" ;
this .lblplayer2tot.Size = new System.Drawing. Size (35, 13);
this .lblplayer2tot.TabIndex = 10;
this .lblplayer2tot.Text = "label6" ;
//
// pictureBox5
//
this .pictureBox5.Location = new System.Drawing. Point (71, 128);
this .pictureBox5.Name = "pictureBox5" ;
this .pictureBox5.Size = new System.Drawing. Size (59, 65);
this .pictureBox5.TabIndex = 4;
this .pictureBox5.TabStop = false ;
this .pictureBox5.Visible = false ;
//
// pictureBox4
//
this .pictureBox4.Location = new System.Drawing. Point (383, 128);
this .pictureBox4.Name = "pictureBox4" ;
this .pictureBox4.Size = new System.Drawing. Size (57, 65);
this .pictureBox4.TabIndex = 3;
this .pictureBox4.TabStop = false ;
this .pictureBox4.Visible = false ;
//
// pictureBox3
//
this .pictureBox3.Location = new System.Drawing. Point (217, 20);
this .pictureBox3.Name = "pictureBox3" ;
this .pictureBox3.Size = new System.Drawing. Size (58, 65);
this .pictureBox3.TabIndex = 2;
this .pictureBox3.TabStop = false ;
this .pictureBox3.Visible = false ;
//
// pictureBox2
//
this .pictureBox2.Location = new System.Drawing. Point (15, 128);
this .pictureBox2.Name = "pictureBox2" ;
this .pictureBox2.Size = new System.Drawing. Size (50, 65);
this .pictureBox2.TabIndex = 1;
this .pictureBox2.TabStop = false ;
this .pictureBox2.Visible = false ;
//
// pictureBox1
//
this .pictureBox1.Location = new System.Drawing. Point (328, 128);
this .pictureBox1.Name = "pictureBox1" ;
this .pictureBox1.Size = new System.Drawing. Size (49, 65);
this .pictureBox1.TabIndex = 0;
this .pictureBox1.TabStop = false ;
this .pictureBox1.Visible = false ;
//
// btndeal
//
this .btndeal.Location = new System.Drawing. Point (13, 381);
this .btndeal.Name = "btndeal" ;
this .btndeal.Size = new System.Drawing. Size (75, 23);
this .btndeal.TabIndex = 1;
this .btndeal.Text = "deal" ;
this .btndeal.UseVisualStyleBackColor = true ;
this .btndeal.Click += new System. EventHandler ( this .btndeal_Click);
//
// timer1
//
this .timer1.Enabled = true ;
this .timer1.Interval = 250;
this .timer1.Tick += new System. EventHandler ( this .timer1_Tick);
//
// timer2
//
this .timer2.Enabled = true ;
this .timer2.Interval = 250;
this .timer2.Tick += new System. EventHandler ( this .timer2_Tick);
//
// timer3
//
this .timer3.Enabled = true ;
this .timer3.Interval = 250;
this .timer3.Tick += new System. EventHandler ( this .timer3_Tick);
//
// timer4
//
this .timer4.Enabled = true ;
this .timer4.Interval = 250;
this .timer4.Tick += new System. EventHandler ( this .timer4_Tick);
//
// btnbet
//
this .btnbet.Location = new System.Drawing. Point (156, 414);
this .btnbet.Name = "btnbet" ;
this .btnbet.Size = new System.Drawing. Size (75, 23);
this .btnbet.TabIndex = 2;
this .btnbet.Text = "BET" ;
this .btnbet.UseVisualStyleBackColor = true ;
//
// btntwist
//
this .btntwist.Location = new System.Drawing. Point (258, 413);
this .btntwist.Name = "btntwist" ;
this .btntwist.Size = new System.Drawing. Size (75, 23);
this .btntwist.TabIndex = 3;
this .btntwist.Text = "TWIST" ;
this .btntwist.UseVisualStyleBackColor = true ;
this .btntwist.Click += new System. EventHandler ( this .btntwist_Click);
//
// btnstick
//
this .btnstick.Location = new System.Drawing. Point (362, 413);
this .btnstick.Name = "btnstick" ;
this .btnstick.Size = new System.Drawing. Size (75, 23);
this .btnstick.TabIndex = 4;
this .btnstick.Text = "STICK" ;
this .btnstick.UseVisualStyleBackColor = true ;
this .btnstick.Click += new System. EventHandler ( this .btnstick_Click);
//
// btntwist2
//
this .btntwist2.Location = new System.Drawing. Point (258, 414);
this .btntwist2.Name = "btntwist2" ;
this .btntwist2.Size = new System.Drawing. Size (75, 23);
this .btntwist2.TabIndex = 5;
this .btntwist2.Text = "button1" ;
this .btntwist2.UseVisualStyleBackColor = true ;
this .btntwist2.Visible = false ;
this .btntwist2.Click += new System. EventHandler ( this .btntwist2_Click);
//
// btnstick2
//
this .btnstick2.Enabled = false ;
this .btnstick2.Location = new System.Drawing. Point (362, 442);
this .btnstick2.Name = "btnstick2" ;
this .btnstick2.Size = new System.Drawing. Size (75, 23);
this .btnstick2.TabIndex = 6;
this .btnstick2.Text = "stick2" ;
this .btnstick2.UseVisualStyleBackColor = true ;
this .btnstick2.Visible = false ;
this .btnstick2.Click += new System. EventHandler ( this .btnstick2_Click);
//
// lblbankertot
//
this .lblbankertot.AutoSize = true ;
this .lblbankertot.Location = new System.Drawing. Point (217, 92);
this .lblbankertot.Name = "lblbankertot" ;
this .lblbankertot.Size = new System.Drawing. Size (35, 13);
this .lblbankertot.TabIndex = 12;
this .lblbankertot.Text = "label1" ;
//
// blackjack
//
this .ClientSize = new System.Drawing. Size (763, 512);
this .Controls.Add( this .btnstick2);
this .Controls.Add( this .btntwist2);
this .Controls.Add( this .btnstick);
this .Controls.Add( this .btntwist);
this .Controls.Add( this .btnbet);
this .Controls.Add( this .btndeal);
this .Controls.Add( this .panel1);
this .Name = "blackjack" ;
this .Text = "BLACKJACK" ;
this .panel1.ResumeLayout( false );
this .panel1.PerformLayout();
((System.ComponentModel. ISupportInitialize )( this .pictureBox5)).EndInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox4)).EndInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox3)).EndInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox2)).EndInit();
((System.ComponentModel. ISupportInitialize )( this .pictureBox1)).EndInit();
this .ResumeLayout( false );
}
#endregion
// <summary>
/// The main entry point for the application.
/// </summary>
[ STAThread ]
static void Main()
{
Application .Run( new blackjack ());
}
private void btndeal_Click( object sender, EventArgs e)
{
dealcards();
pictureBox1.Visible = true ;
}
private void timer1_Tick( object sender, EventArgs e)
{
if (pictureBox1.Visible == true )
{
pictureBox2.Visible = true ;
}
}
private void timer2_Tick( object sender, EventArgs e)
{
if (pictureBox2.Visible == true )
{
pictureBox3.Visible = true ;
}
}
private void timer3_Tick( object sender, EventArgs e)
{
if (pictureBox3.Visible == true )
{
pictureBox4.Visible = true ;
}
}
private void timer4_Tick( object sender, EventArgs e)
{
if (pictureBox4.Visible == true )
{
pictureBox5.Visible = true ;
}
}
private void btntwist_Click( object sender, EventArgs e)
{
int picplycard3score, picplycard4score, picplycard5score;
Random rancard = new Random ();
counter++;
if (counter == 1)
{
PictureBox picply1card3 = new PictureBox ();
picply1card3.Size = new Size (50, 65);
picply1card3.Location = new Point (450, 128);
panel1.Controls.Add(picply1card3);
picply1card3.Visible = true ;
whichpic = rancard.Next(25);
picply1card3.Image = carddeck.Images[whichpic];
picplycard3score = cvalue[whichpic];
ply1tot += picplycard3score;
lblplayer1tot.Text = ply1tot.ToString();
} //end 1st twist
if (counter == 2)
{
PictureBox picply1card4 = new PictureBox ();
picply1card4.Size = new Size (50, 65);
picply1card4.Location = new Point (492, 128);
panel1.Controls.Add(picply1card4);
whichpic = rancard.Next(25);
picply1card4.Image = carddeck.Images[whichpic];
picplycard4score = cvalue[whichpic];
ply1tot += picplycard4score;
lblplayer1tot.Text = ply1tot.ToString();
}
if (counter == 3)
{
PictureBox picply1card5 = new PictureBox ();
picply1card5.Size = new Size (50, 65);
picply1card5.Location = new Point (542, 128);
panel1.Controls.Add(picply1card5);
whichpic = rancard.Next(25);
picply1card5.Image = carddeck.Images[whichpic];
picplycard5score = cvalue[whichpic];
ply1tot += picplycard5score;
lblplayer1tot.Text = ply1tot.ToString();
}
}
private void btnstick_Click( object sender, EventArgs e)
{
btntwist.Enabled = false ;
btntwist.Visible = false ;
btntwist2.Visible = true ;
btntwist2.Enabled = true ;
btnstick2.Visible = true ;
btnstick2.Enabled = true ;
counter = 0;
btnstick.Enabled = false ;
btnstick.Visible = false ;
}
private void btntwist2_Click( object sender, EventArgs e)
{
int picply2card3score, picply2card4score, picply2card5score;
Random rancard = new Random ();
counter++;
if (counter == 1)
{
PictureBox picply2card3 = new PictureBox ();
picply2card3.Size = new Size (50, 65);
picply2card3.Location = new Point (130, 128);
panel1.Controls.Add(picply2card3);
whichpic = rancard.Next(25);
picply2card3.Image = carddeck.Images[whichpic];
picply2card3score = cvalue[whichpic];
ply2tot += picply2card3score;
lblplayer2tot.Text = ply2tot.ToString();
} //end 1st twist
if (counter == 2)
{
PictureBox picply2card4 = new PictureBox ();
picply2card4.Size = new Size (50, 65);
picply2card4.Location = new Point (180, 128);
panel1.Controls.Add(picply2card4);
whichpic = rancard.Next(25);
picply2card4.Image = carddeck.Images[whichpic];
picply2card4score = cvalue[whichpic];
ply2tot += picply2card4score;
lblplayer2tot.Text = ply2tot.ToString();
}
if (counter == 3)
{
PictureBox picply2card5 = new PictureBox ();
picply2card5.Size = new Size (50, 65);
picply2card5.Location = new Point (230, 128);
panel1.Controls.Add(picply2card5);
whichpic = rancard.Next(25);
picply2card5.Image = carddeck.Images[whichpic];
picply2card5score = cvalue[whichpic];
ply2tot += picply2card5score;
lblplayer2tot.Text = ply2tot.ToString();
}
}
private void btnstick2_Click( object sender, EventArgs e)
{
btnstick2.Enabled = false ;
btntwist2.Enabled = false ;
int bankercard2score, bankercard3score, bankercard4score;
Random rancard = new Random ();
PictureBox picbankercard2 = new PictureBox ();
picbankercard2.Size = new Size (50, 65);
picbankercard2.Location = new Point (271, 20);
panel1.Controls.Add(picbankercard2);
whichpic = rancard.Next(25);
picbankercard2.Image = carddeck.Images[whichpic];
bankercard2score = cvalue[whichpic];
bankertot += bankercard2score;
lblbankertot.Text = bankertot.ToString();
//if banker has less than 17
if (bankertot < 17)
{
PictureBox picbankercard3 = new PictureBox ();
picbankercard3.Size = new Size (50, 65);
picbankercard3.Location = new Point (320, 20);
panel1.Controls.Add(picbankercard3);
whichpic = rancard.Next(25);
picbankercard3.Image = carddeck.Images[whichpic];
bankercard3score = cvalue[whichpic];
bankertot += bankercard3score;
lblbankertot.Text = bankertot.ToString();
} //endif
if (bankertot < 17)
{
PictureBox picbankercard4 = new PictureBox ();
picbankercard4.Size = new Size (50, 65);
picbankercard4.Location = new Point (365, 20);
panel1.Controls.Add(picbankercard4);
whichpic = rancard.Next(25);
picbankercard4.Image = carddeck.Images[whichpic];
bankercard4score = cvalue[whichpic];
bankertot += bankercard4score;
lblbankertot.Text = bankertot.ToString();
} //endif
} //end bankercards
public void reset()
{
panel1.Controls.Clear();
btnstick.Visible = true ;
btnstick.Enabled = true ;
btnstick2.Visible = false ;
btntwist2.Visible = false ;
btntwist.Visible = true ;
btntwist.Enabled= true ;
}
}
}
hello
i have set up a basic blackjack hand for 2players which works ok. but when i want to deal a new hand the programgoes awry.i tried using panel1.controls.clear() to remove the previous hand,which it does but no new cards appear.(except the ones i created using the button twist click events) so i guess when using controls.clear() the controls stay cleared! any solutions to this problem will be greatly appreciated.thx. also if u feel my code could be improved ,ie arrays for twist cards suggestions would be warmly received. thx Tag: Visual C# General 2D Drawing Options Visual C#
Thread Problem Hi freind,
I am facing problem in threading
eg:
int sum(int a, int b)
{
//complex code/
//time conusming code
return int;
}
Now I want to run this method through tread.. but here i have return type so confused how to your with threading Tag: Visual C# General 2D Drawing Options Visual C#
How to have multiple sets of application settings? Hello All.
Stan:
Well, first off, subclassing a class derived from ApplicationSettingsBase is not as easy as I had envisioned. One has to virtually assume complete control over the settings persistence process, with a custom section handler and custom settings provider, and it takes a ton of code. Probably not the way to go in this case. Sorry for the mis-direction.
Now, is there a reason that you can't use a single settings class for the port settings you have defined, for example:
Properties.PortSettings.Default.FirstPort Properties.PortSettings.Default.SecondPort ...
Or, going the other way, if there are multiple different settings for a given instance:
Properties.FirstInstance.Default.PortSetting Properties.FirstInstance.Default.WindowTitle ...
There probably is a way to enumerate the settings classes through Reflection (Reflection is a formidable namespace), but the code would likely be longer than a switch statement, and quite a bit more convoluted.
If you don't want a lot of switch statements (I think switch statements have a worse reputation than they deserve, since the advent of polymorphism), then I suggest that you could make your test for the instance occurrence, use 1 switch statement to fill a "CurrentSettings" structure, and subsequently use that structure in the rest of your code.
HTH. Tag: Visual C# General 2D Drawing Options Visual C#
How to make static to form control? Sandeep wrote:
What can i do to restrict the IDE to chang the scope of treeview control from static control to simple control.
This IDE does not support static controls and you have to code it manually. An important thing you need to be aware of is that, one control can only have one parent( or container). When you add it to a new container (a form for example), it will be removed from the former container. Tag: Visual C# General 2D Drawing Options Visual C#
Build Events Error After looking all day found a solition that works xcopy "$(ProjectDir)Reports" "$(TargetDir)Reports" /i /d /y Thing is I have never used post build until yesterday so was hoping you could help me out still I understand the xcopy statement but do not know what the /Switches means Tag: Visual C# General 2D Drawing Options Visual C#
Make end of statement ";" optional? The lack of a line terminator is just one of the many examples of sloppy grammar design in VB, and which is one of the many reasons I prefer C#. Making syntax optional is a poor design decision, as some developers will supply the optional bits and some won't and some will sometimes supply it and sometimes not. On a large programming team this inconsistency results in a mess. Code standards are not the answer - it is much better to enforce rules via the compiler (which can be 100% strict and correct) rather than some error-prone, ad-hoc human standard. Tag: Visual C# General 2D Drawing Options Visual C#
convert double[] to byte?? Hi ,
As Zamial said, the max value of byte is 255 , so how is it possible to put a double array into a single byte value.
A double array can be conveted to byte array but not to a byte value.
U have told that u r going to store this byte value in MS-Access. Is it Byte or Memo type
if it is memo type, i guess u can pass byte[]. or else u can format all the array values into a string having a delimeter as seperator and save it in database as text type.
Hope my thought may help you.
Could u please let me know ur opinion after reading these things
cheers,
Ch.T.Gopi Kumar. Tag: Visual C# General 2D Drawing Options Visual C#
Advice for career path? I am a network admin/web guru currently with userstanding of HTML, CSS. Im familular with PHP code, but have never got deeper than tweaking pre created code.
I am implementing Sharepoint 2007 for use for our business and I have been appointed to head it up. They want to get me training for coding in whatever is used for Sharepoint 2007, I assume ASP.NET Primarily to customize Sharepoint for our business via webparts or simular.
Its a bit confusing for me coming in as I dont know what I should learn to suit our business needs.
So my question is does anyone have any CBT that they would reccomend (something more than just Videos (CBTNuggets). Maybe something like CareerAcadamy.com
Anywans, what should I learn, where to start I have co workers tell me C#, another tells me C while I thought it was ASP.NET id have to learn.
Anyways, please help out this newb! Thank you!! Tag: Visual C# General 2D Drawing Options Visual C#
bdorman
I'm developing an app that can graph signals (audio, FFTs, etc). Right now I'm using GDI+ and the signal is represented as a series of lines in a GraphicsPath object. I usually draw the lines then fill the path with a gradient. I'm wondering if there are any other options for doing this in C#. I thought about managed DirectX, but it seems that is mostly geared towards 3D drawing. Anyone have suggestions about a better way to go. It's important for me to draw/redraw as quickly as possible. Thanks!
have you looked into WPF, this is the new presentation framework. It is capable of 2D or 3D graphics and unlike GDI+ is capable of utilizing graphics hardware to perform the rendering.