|
You can draw it yourself through the Paint or PaintBackground event.
protected override OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
int x, y;
x = (ClientSize.Width - backgroundImage.Width) / 2;
y = (ClientSize.Height - backgroundImage.Height) / 2;
e.Graphics.DrawImageUnscaled(backgroundImage, x, y);
} Where backgroundImage is an Image containing the image you want to draw in the background. You shouldn't also set the BackgroundImage property of the form because it will still tile the image in the background AND draw this one centered in the client area.
James
Simplicity Rules!
|
|
|
|
|
Thanks James.
Your method certainly works and perfectly fits the bill, but was trying to think of a very .NETish way of doing it. (Trying to convert from MFC to .NET)
I came up with the idea of putting a PictureBox on the form, then set the image and the propertiesDock=fill and SizeMode=CenterImage and it worked perfectly.
|
|
|
|
|
can someone give me a code
for handling word (as com object or else)
from c#
i realy need a way to add template, change font and size
i know how to open show each
|
|
|
|
|
check out this file in the .NET framework:
FrameworkSDK\Samples\Technologies\Interop\Applications\Office\Word\wordApp.cs
If you can't find it, just reply to this message and I'll email it to you.
|
|
|
|
|
I'm trying to use SetWindowsHookEx in C# so that I can get APPCOMMAND and KEYBOARD events from any window (not just my thread).
I created a DLL and put SetWindowsHookEx there, and then I'm using DllImport so that I can install hook in C# code.
As I receive events, I send a message to C# code through PostMessage.
The problem is that, even though I'm running SetWindowsHookEx globally, I just get events if my app window is focused. And if I use PostMessage, app runs really slow and almost crashes my machine, even though I have a powerful PC.
Has anyone here tried it before? If so, did you get a good performance? How?
I could do it perfectly in C++, but I need to use it in C#...
Thanks,
-Ricardo
|
|
|
|
|
Hi,
Have a little trouble passing a byte array in C# into a C++ implemented web service, the C# code is:-
FileStream fs = new FileStream("c:\\work\\temp\\Waremouse.mp3", FileMode.Open);
BinaryReader Reader = new BinaryReader(fs);
Reader.BaseStream.Seek(0, SeekOrigin.Begin);
long lLength = Reader.BaseStream.Length;
Int32 nLength = System.Convert.ToInt32(lLength);
byte[] bData = Reader.ReadBytes(nLength);
fs.Close();
//**********************************************
//C++ Web Service.......
m_FileServer.UploadFile("Waremouse.mp3", bData);
//**********************************************
The C++ is implement as COM interface as shown below
__interface IFBFileServerService
{
//Uploads a file onto the web server....
[id(1)] HRESULT UploadFile([in] BSTR bstrFileName, [in] byte* bData);
//Downloads a file from the web server...
[id(2)] HRESULT DownloadFile([in] BSTR bstrFileName, [out, retval] byte** bData);
};
The problem is that an exception is thrown in the client application
Cheers for any help
|
|
|
|
|
i download the "screen saver"(screensaver_JTJ.csproj);
and i wonder why it can download the codeproject.com's latest posts.it's code may be like this:
codeProject.LatestBrief latest = new codeProject.LatestBrief();
int nInterval = latest.GetArticleLatestUpdatePeriod();
arArticles.Clear();
codeProject.ArticleBrief[]articles=latest.GetLatestArticleBrief(latest.GetMaxArticleListLength());
TextActor a;
int nText = nTextPos;
Point velocity = new Point(0, -3);
if (null != articles)
foreach (codeProject.ArticleBrief article in articles)
{
if (article != null)
{
a = new TextActor(article.Title);
......
and it has a latest.wsdl file which i think related to it.
i want to know how to do that?i mean if i have a website like codeproject.com,how can i download such things?
any documents or articles that relate to that topic?
thanks in advance!
|
|
|
|
|
See this article!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Sorry, I was too hasty in posting my reply. You'd have to convert my MFC code to C#.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Someone meet this MFC guy and tell him not to talk MFC in a C# forum
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
He's probably just trying to raise his post count.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i will read that carefully!
then i will ask more questions maybe!
|
|
|
|
|
I have a C# form UI and I would like to create a web page from that. Anybody knows how to do that?
Thanks
Al
|
|
|
|
|
I am using a OCX component that call a event .. I never make programs using C# .. how can I use Events ?
|
|
|
|
|
how do i declare a dynamic byte array?
|
|
|
|
|
int size = 100; // dynamic size
byte[] b = new byte[size];
for ( int i=0; i
|
|
|
|
|
If you're using MFC, use CByteArray .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
If you're using MFC, use CByteArray.
Don't think he'd be using MFC, now that he has asked this question in the C# forum.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Argh! I did it again.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have a file that an old program is changing
I want to build a service or something like it to listen to
That file and raise an event (my program) every time it is
Changing
Thanks
|
|
|
|
|
look at the documentation of System.IO.FileSystemWatcher
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Can any of you recommend a good C#-book? I've bought the "Programming C#" by Jesse Liberty, and it's quite good. But there's nothing about GDI+, and since I'm mainly interested in image analysis/processing and graphics I'd like to buy a book which contains some stuff about GDI+ and possibly also about Winforms. I've thought about the WROX Proffesional C# Programming, anybody read that?
|
|
|
|
|
Programming Windows with C# by Petzold ? This discuss Winforms , UI stuff and GDI+ ...
BTW , a C# is different of GDI+ , by your title I thought that you wanted a C# book like Inside C# by Tom Archer instead of a GDI+ book .
The Petzold book is quite good explaining all the UI and GDI+ stuff , but if you are interested in Image processing you better get a specif book about this, since I currently don't known any book that deals with it with C#, C++ and C are the common language used in kind of image processing algorithm books.
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|
|
I'll second this book. Loads of good information on a variety of Windows topics.
|
|
|
|