|
behzadcp wrote: Does textbox have Autosize property?
Nope.
behzadcp wrote: when i use Autosize property in win app there is but when i use in class library project there is not any property that named AutoSize
You might have mixed up classes. Are you using a label, or mayhaps setting the Form.AutoSize property by accident?
behzadcp wrote: ????
???
??
?
.
If you're lost, you can always check MSDN for information on the TextBox[^] component.
I are troll
|
|
|
|
|
No there isnt any inbuilt 'AutoSize' property for textbox but you can do some tricks. Here is one
write the following code in TextChanged and FontChanged events of TextBox.
Graphics g = Graphics.FromHwnd(IntPtr.Zero);
TextBox.Size = g.MeasureString(TextBox.Text, TextBox.Font).ToSize();
g.Dispose();
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
behzadcp wrote: Does textbox have Autosize property?
No.
behzadcp wrote: when i use Autosize property in win app there is but when i use in class library project there is not any property that named AutoSize
Not possible. The TextBox class is same be it win app or a class library.
Moreover, why would you need that?
With textboxes, you can always make it multiline, set WordWrap to true and set scrollbars property to Vertical.
If you need to grow/shrink the textbox with increase/decrease in the size of its container, then you should employ anchoring and docking.
जय हिंद
|
|
|
|
|
i am getting image based slideshow by using image list and picture box. i want it to make it more dynamic and flexible... I tried using "System.IO.Directory.GetFiles("C://MyPictures")"......So tat image files (after specifying the extension also ("*.jpeg"))can be extracted from the directory and be displayed as slideshow.....But its kinda not working out for me....need help !!!
**************************************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 3000;
timer1.Enabled = true;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
System.IO.DirectoryInfo dirInfo=new System.IO.DirectoryInfo("C://Images");
System.IO.FileInfo[] files=dirInfo.GetFiles("*.jpeg");
if(files!=null)
{
foreach(System.IO.FileInfo file in files)
{
pictureBox1.Image=Image.FromFile(file);
}
}
}
}
}
|
|
|
|
|
Hi,
Do you get a sepcific error message during comilation/runtime?
Try to use
<br />
pictureBox1.Image = Image.FromFile(file.FullName);<br />
FromFile accepts only the filename, not the FileInfo.
Regards
Sebastian
|
|
|
|
|
The most obvious thing here is that by putting all of the file fetching code inside the ontick handler, each time it fires, it gets all the files again and shows the first one every time (I think).
My suggestion, move
System.IO.DirectoryInfo dirInfo=new System.IO.DirectoryInfo("C://Images");
files=dirInfo.GetFiles("*.jpeg");
into Form_Load(), or other suitable place.
create System.IO.FileInfo[] files = null; as a field of the form.
add an index field int index = 0; as well.
Then in your ontick handler
if (files != null)
{
if (index >= files.Length)
{
timer1.Enabled = false;
}
else
{
pictureBox1.Image=Image.FromFile(files[index++]);
pictureBox1.Image=Image.FromFile(files[index++].FullName);
}
}
[MOD]
Realized I had forgotten the '.FullName' property
[/MOD]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
modified on Thursday, March 26, 2009 4:49 PM
|
|
|
|
|
dude d slideshow stops after d last image is read !!!
i want d slideshow to run continously .....plz help !!
|
|
|
|
|
i want d slideshow to execute continously in a repeated fashion and not stop after reading the last image. Is there any way i can do it ??
|
|
|
|
|
OK.
It's hard to be certain without seeing your code, but something like this should work.
Change the code of the ontick handler so it looks something like this:
if (files != null)
{
if (index >= files.Length)
{
timer1.Enabled = false;
index = 0;
}
else
{
pictureBox1.Image=Image.FromFile(files[index++].FullName);
}
}
All that this does, is detect when the last image has been used and resets the index back to the start.
Hope this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I'm getting a NullReferenceException from the line "notify.SetNotificationPositions(bpnArray,3);" in the code below anyone got any idears.
code:
buffer = new Microsoft.DirectX.DirectSound.Buffer(bufferDescription, playbackDevice);<br />
<br />
bufferHalfEmptyEvent = new AutoResetEvent(false);<br />
<br />
bufferSize = buffer.Caps.BufferBytes;<br />
<br />
sinusBuffer = new MemoryStream(waveFormat.BlockAlign * waveFormat.SamplesPerSecond);<br />
<br />
BufferPositionNotify bufferOneThridPointNotify = new BufferPositionNotify();<br />
bufferOneThridPointNotify.Offset = bufferSize / 3 - 1;<br />
bufferOneThridPointNotify.EventNotifyHandle = bufferHalfEmptyEvent.Handle;<br />
BufferPositionNotify bufferTwoThridPointNotify = new BufferPositionNotify();<br />
bufferTwoThridPointNotify.Offset = (2*bufferSize / 3) - 1;<br />
bufferTwoThridPointNotify.EventNotifyHandle = bufferHalfEmptyEvent.Handle;<br />
BufferPositionNotify bufferEndPointNotify = new BufferPositionNotify();<br />
bufferEndPointNotify.Offset = bufferSize - 1;<br />
bufferEndPointNotify.EventNotifyHandle = bufferHalfEmptyEvent.Handle;<br />
<br />
BufferPositionNotify[] bpnArray = new BufferPositionNotify[3];<br />
bpnArray[0] = bufferOneThridPointNotify;<br />
bpnArray[1] = bufferTwoThridPointNotify;<br />
bpnArray[2] = bufferEndPointNotify;<br />
Notify notify = new Notify(buffer);<br />
notify.SetNotificationPositions(bpnArray, 3);
|
|
|
|
|
The only thing I can see is that maybe your offset calculations are causing a problem during the division process. It may be getting rounded down during. Set a breakpoint before or on SetNotificationPositions and check those values aren't <= 0
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Nope thats not it. Have tried with offset set to 10,20 and 30 same result. buffersize is 0x8000;
But thanks.
|
|
|
|
|
Which object is it saying is null?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
It doesn't say for some reason directX just throw a standard NullReferenceException.
|
|
|
|
|
From my delving into MSDN, the two parameters for SetNotificationPositions are:
dwPositionNotifies
Number of DSBPOSITIONNOTIFY structures.
pcPositionNotifies
Pointer to an array of DSBPOSITIONNOTIFY structures (the maximum array size is DSBNOTIFICATIONS_MAX).
So it looks to me like you have the params reversed.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I found that when I first looked. I think Microsoft.DirectX.DirectSound class wrapps this and provides
public void SetNotificationPositions(BufferPositionNotify[] notify, int numNotificationPositions);
Link[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Ain't MS wonderful.
My link is titled 'DirectX and XNA', so must be fairly recent, and yet yours gives a different answer.
I give up!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
When i try to transefer files using socket, the message is sending pary by part, so when in the reciving end the partial byte of the file making exception.
How can i send the byte[] in its full form, not part by part?
Thankyou
YPKI
|
|
|
|
|
Please try this
//Client Socket code
/* Make IP end point same as Server. */
Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
/* Make a client socket to send data to server. */
string filePath = "";
/* File reading operation. */
fileName = fileName.Replace("\\", "/");
while (fileName.IndexOf("/") > -1)
{
filePath += fileName.Substring(0, fileName.IndexOf("/") + 1);
fileName = fileName.Substring(fileName.IndexOf("/") + 1);
}
byte[] fileNameByte = Encoding.ASCII.GetBytes(fileName);
if (fileNameByte.Length > 850 * 1024)
{
curMsg = "File size is more than 850kb, please try with small file.";
return;
}
curMsg = "Buffering ...";
byte[] fileData = File.ReadAllBytes(filePath + fileName);
/* Read & store file byte data in byte array. */
byte[] clientData = new byte[4 + fileNameByte.Length + fileData.Length];
/* clientData will store complete bytes which will store file name length, file name & file data. */
byte[] fileNameLen = BitConverter.GetBytes(fileNameByte.Length);
/* File name length’s binary data. */
fileNameLen.CopyTo(clientData, 0);
fileNameByte.CopyTo(clientData, 4);
fileData.CopyTo(clientData, 4 + fileNameByte.Length);
/* copy these bytes to a variable with format line [file name length][file name] [ file content] */
curMsg = "Connection to server ...";
clientSock.Connect(ipEnd);
/* Trying to connection with server. /
curMsg = "File sending...";
clientSock.Send(clientData);
/* Now connection established, send client data to server. */
curMsg = "Disconnecting...";
clientSock.Close();
/* Data send complete now close socket. */
curMsg = "File transferred.";
//Server Scoket Code
//Make IP end point to accept any IP address with port no 5656.
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
//Here creating new socket object with protocol type and transfer data type
sock.Bind(ipEnd);
//Bind end point with newly created socket.
}
public static string receivedPath;
public static string curMsg = "Stopped";
public void StartServer()
{
try
{
curMsg = "Starting...";
sock.Listen(100);
/* That socket object can handle maximum 100 client connection at a time & waiting for new client connection /
curMsg = "Running and waiting to receive file.";
Socket clientSock = sock.Accept();
/* When request comes from client that accept it and return new socket object for handle that client. */
byte[] clientData = new byte[1024 * 5000];
int receivedBytesLen = clientSock.Receive(clientData);
curMsg = "Receiving data...";
int fileNameLen = BitConverter.ToInt32(clientData, 0);
/* I’ve sent byte array data from client in that format like [file name length in byte][file name] [file data], so need to know first how long the file name is. /
string fileName = Encoding.ASCII.GetString(clientData, 4, fileNameLen);
/* Read file name */
BinaryWriter bWrite = new BinaryWriter(File.Open(receivedPath +"/"+ fileName, FileMode.Append)); ;
/* Make a Binary stream writer to saving the receiving data from client. /
bWrite.Write(clientData, 4 + fileNameLen, receivedBytesLen - 4 - fileNameLen);
/* Read remain data (which is file content) and save it by using binary writer. */
curMsg = "Saving file...";
bWrite.Close();
clientSock.Close();
/* Close binary writer and client socket */
curMsg = "Reeived & Saved file; Server Stopped.";
Hope that it will solve your problem
Thanks
Annapurna
|
|
|
|
|
i have completely installed VS2008 and SQL Server management studio express,could i create a new database without SQL Server?
|
|
|
|
|
No (at least not an sql database)
|
|
|
|
|
Yes you can create a stand alone database, or a 'single file database'. You can do this with SQLite.
|
|
|
|
|
your answer is different from Tom Deketelaere's,so could you make it more clear?
|
|
|
|
|
Yes, it's really simple, you can make a database withouth an sql server. I myself are using SQLite for this, because I'm making applications which will run localy, if that's all you need a single file database is enough and I reccomend SQLite. SQLite is working as an dll, nothing more.
It works the same as the rest, you just execute some sql statements and you're done.
Just try and search google with 'C# SQLite', you'll find some information about it.
|
|
|
|
|
Interesting didn't know that, will have to give it a try.
I'm guessing tho that this is not usable with multiple connections?
|
|
|
|