|
I am developing a screen saver in C#. However, I am stuck at one point. How can I embed resources in the src that will be build ? and any information how the standard screen savers store the resources ?
Thanks.
Please note images are to loaded at run-time which I want to embed in the src file, that the application will create.
-- modified at 7:57 Sunday 22nd July, 2007
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Hi,
there are several good articles on screensavers available on CodeProject.
you can include resources (images, icons, ...) in your exe by:
- adding their file to your project (I typically add a "resources" folder in the Solution Explorer pane)
- setting its "Build Action" to "Embedded Resource"
- adding some code to access the resource; I cant remember what exactly, so I let Visual
Designer use my resource (e.g. as an image for a picturebox, an icon for the main form),
then look at the code it generated, and copy/paste/modify that
I see no reason why screensavers would handle resources any different than other apps do.
|
|
|
|
|
Thanks for your response.
I am adding the images at run-time.Any help on this. I have got to know about ResourceWriter which creates a satellite dll. What I need is a single scr file, which has the resources embedded.
So any help on making the resource embedded in an exe at run-time ? Do I need to compile another exe(scr) at run-time and embed those images in the new exe(scr)?
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Hi,
I explained on how to embed images and the like into the exe at build-time; that would
result in a single file.
You did not ask about run-time images at first; if the images are only available at run-time,
why would you want to turn them into a dll, rather than just use them from where they are ?
I have no experience with ResourceWriter; I think it helps creating a resource dll
while said dll file is NOT in use. I expect, once a resource (or other) dll is in use,
you cant modify it.
|
|
|
|
|
Hello,
Thanks for the response.
Yes I know you were talking about embedding resources at build-time. That is why I asked for run-time.
The reason for this, if the user removes the images at the path or user wants to redistribute the screen saver. Then user would need to relocate the images as well. So in short I want everything in a single exe(scr) file.
Yes, resourcewriter creates a satellite dll. This has better results as compared to loading images at run-time.That is, the actions of user deleting the images does not affect the screen saver. However, relocating the screen saver on another machine would still require to move this dll as well.
Thanks.
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
|
Hi,
Have you tried creating a gridview with 2 lines in one(1) record? I have 15 field that needs to fit the gridview which is my Detail info of my header/detail page. It display the entire fields but you have to scroll to the right in order for you to see the information.
Any work around?
Thanks
Dabsukol
|
|
|
|
|
I would use Repeater control...
Regards,
Arun Kumar.A
|
|
|
|
|
Sorry I forgot to tell you that the gridview that I am using should handle the edit/delete and can insert new row. all these is working already in my gridview though the display is my only problem. The design will not fit those users who is still using the 15inch monitor and our user doesn't want to accept scrolling to the right to see the other information.
Dabsukol
|
|
|
|
|
No Idea of how to do this with GridView...
But I think DataList control will fulfill all your need...
Regards,
Arun Kumar.A
|
|
|
|
|
Hello everyone,
When using property assembly: AssemblyKeyFile in Visual Studio 2005, I find that it is not supported and we need to using Project --> Properties --> Signing Tab to specify the sign key. Is that correct?
thanks in advance,
George
|
|
|
|
|
I'm working on a Windows Forms project. It's an aplication on environment recognition. At some point I load an image in a
picuteBox and I have to determine, to "draw" the areas in that picture and then save them - I do this by extracting the x and
y mouse click coordinates and then by saving those pairs in a text file.
However, I do have a little problem...
When I minimize the window or when I put something on top of one of those regions, the part of the region that is covered
dissappears and then reappears with a delay (about 5-10 seconds) and only if I do somethig like a click or at least a mouse
movement, some kind of a refresh anyway.
Why is this happening? What am I doing wrong?
How can I repair this bug, or at least how can I shorten the delay?
I mention that the only suited event that I found for the invalidate action is the resize event! (I didn't find an event like
"object cover - object discover"...! that would have been better fit)
Here is the code for all this:
private void pictureBox1_Resize(object sender, EventArgs e)
{
Invalidate();
Update();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if(zones != null)
drawZones(zones);
}
where the drawZones function is:
public void drawZones(Dictionary<string, list<string="">> zones)
{
foreach (KeyValuePair<string, list<string="">> vect in zones)
{
List<string> list = vect.Value as List<string>;
if (list == null)
throw new Exception("Mistake");
int i = 0;
foreach (string s in list)
{
Point pctP = convertStringToPoint(list[0]);
Point pctU = convertStringToPoint(list[list.Count - 1]);
Graphics gr = this.pictureBox1.CreateGraphics();
Pen pencil = new Pen(mLineColor, 1);
gr.DrawLine(pencil, pctP, pctU);
Point pctCurr = convertStringToPoint(s);
if (i != 0 && list.Count > 1)
{
Point pctBack = convertStringToPoint(list[list.IndexOf(s) - 1]);
gr.DrawLine(pencil, pctBack, pctCurr);
}
i++;
}
}
}
Good gives us the power of creating the future. Use this power with reason.
|
|
|
|
|
Hi,
I cant read all of your source, since it is losing its < and > signs to HTML interpretation.
Some ideas:
- the picturebox by itself will repaint the image it holds whenever needed; this
may be slow if the original image is very large (that's showing a huge file, in whatever
size the PB has).
- your paint handler allows you to draw on top of that image; it should
not throw exceptions (you have one), who is going to catch those ?
- your paint handler does not need to create a Graphics object, there is one available
in its PaintEventArgs. (and IF you create one, which takes time, you should also dispose it).
Hope this helps.
|
|
|
|
|
Hi,
I am wanting to create an effect like that in FrontPage and DreamWeaver (and many other code IDEs).
For example, I am using DreamWeaver and I type this automatically turns blue to show it is code. This is what I would like to do.
I already have something going, but it only does it when the file is first loaded, not while it is being edited, so I need to put it in a loop or something like that, also another problem was that all subsequent text after the last string () was also blue.
Here are my two functions so far, CheckAllText() runs in the Load function of the Form.
public void TextColor(string text)
{
int iReturnValue = richTextBoxZedit.Find(text);
if (iReturnValue >= 0)
{
richTextBoxZedit.SelectionColor = Color.Blue;
}
}
public void CheckAllText()
{
string[] HTMLArray = new string[4] { "", "", "", "" };
for (int i = 0; i < HTMLArray.Length; i++)
{
TextColor(HTMLArray[i]);
}
}
Any suggestions?
Thanks in advance.
|
|
|
|
|
Hi,
three comments:
- there are discussion threads about such things all the time, often they have the following
keywords: RichTextBox Syntax Coloring; and there are some article on it too on CP
= the more data and intelligence you add to RTB, it gets slower and slower
- IMO if you want to come up with a line-oriented editor with some fancy features and capable of
dealing with 1000+ lines of text, yiu should not use RTB, but just use a Panel, do all
the text handling and the painting yourself. That solution scales well, i.e. you can make it
deal with 1,000,000+ lines and still behave well. Example: I do most of the syntax coloring
analysis in the paint handler, and only for the lines that are visible (that's no more
than 100 on today's monitors).
If you expect to handle no more than say 300 lines of text, you're on a good track;
ptherwise you may have to rethink it.
|
|
|
|
|
Ok thanks, I am very early on in my learning of c# and so wouldn't really know how to go about painting the text myself etc.
Any tutorials?
Thanks.
|
|
|
|
|
Hi,
since you are new to C#, I do not recommend you dive into GDI+ with all the painting stuff
immediately. I do recommend you read and work your way through an introductory book on C#
though (possibly skipping some of the chapters you dont immediately need, e.g. GDI+,
databases, networking).
If you dont need to handle very large files, then probably the RichTextBox approach is
best for you. It has its quirks, but you will learn from trying, and possibly asking here.
If on the other hand you do get curious, dont forget to search on CodeProject.
Searching "paint text" in the search box above, resulted in many articles, including this
lenghty book chapter.[^]
Enjoy C# !
|
|
|
|
|
Ok thanks, I'll have a look at that chapter later. I have already learnt lots on ado.net and database work in C# and so now want to move into something different.
When I said I was just beginning, I meant beginning GDI stuff, not C#. But thankyou for the links.
|
|
|
|
|
|
Hi
I created a C# Application about 2 months ago. Haven't really touched done anything to it, other than moving the folder.
I re-opened it today and got these warnings..
Warning 1 The custom tool 'ResXFileCodeGenerator' failed while processing the file 'Properties\Resources.resx'.
Warning 2 The custom tool 'SettingsSingleFileGenerator' failed while processing the file 'Properties\Settings.settings'.
Warning 3 The custom tool 'SettingsSingleFileGenerator' failed while processing the file 'Properties\Settings.settings'.
They're just warnings, but unfortunately all the Forms and .cs files in my project cannot be opened, and i receive this error message "The project ______ does not exist in the current directory. It may have been moved, or deleted"
I have no idea why i got this message, I haven't really removed anything from the project folder. I always move the filed from my laptop-USB thumbdrive-pc, and it always works.
Can anyone help me out?
Thanks in advance.
|
|
|
|
|
Hello,
In my C# form application i rounded the UI of form using drawing region. Now i am not having any caption bar, it suppressed the movable property of form.
I want the form to be mavable though the caption is not available.
How can i do it?
Thanks.
Gajesh
-- modified at 7:53 Sunday 22nd July, 2007
|
|
|
|
|
Hi!
You can make the window moveable by clicking anywhere inside the window's client area by overriding its WndProc like this:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
const int WM_NCHITTEST = 0x0084;
const int HTCAPTION = 0x0002;
if (m.Msg == WM_NCHITTEST)
m.Result = new IntPtr(HTCAPTION);
}
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks Mav,
It works perfectly for Form client area.
One more concern here is that i have put one user control on the form so if user click on control area then also it should give the same apperance.
How can i catch the control's WndProc event in Form??
Thanks
Gajesh.
|
|
|
|
|
You can override the WndProc of the usercontrol, too.
There's no such thing as a "WndProc event", so you cannot simply "catch" messages destined for another window (at least not without using a windows hook, but that's far beyond the scope of a forum reply).
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,all
I want to use Dictionary<> to make a map.I create a class named ILayer.So,I write
Dictionary<string, ilayer*=""> g_LyrNameToILayer =
new Dictionary<string, ilayer*="">();
But it was wrong,who can tell me what shoud i do? Thanks a lot!
|
|
|
|
|