
EFileTahi-A
Avatar/Signature-
Posts
633 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by EFileTahi-A
-
This function is not fully working
EFileTahi-A replied to EFileTahi-A's topic in Graphics and Multimedia
Wow, at has been a long time! For some reason, I cannot make this function work properly when image B is a PNG -- I was experimenting my PNG's transparency (a black gradient with 100% black opacity on the left reaching 0% on the right most) over a BMP. Any ideas? -
I'm desperate. Isometric Coordinates Translation
EFileTahi-A replied to EFileTahi-A's topic in Graphics and Multimedia
I have implemented it quite easily. :D Alright! I finally can add input into my ship design editor. Promise me you will never die and that you always will be around. :) PS: Remember Snarfblam, I'll also be around by the day you decide to team up with me. I have some great stuff going on atm. -
I'm desperate. Isometric Coordinates Translation
EFileTahi-A replied to EFileTahi-A's topic in Graphics and Multimedia
I get very excited every time I see your nickname In my threads, because your posts always hit the bull's eye! Can't wait to get home to try your idea. Thank you Snarfblam, I was getting seriously desperate with this thing. I really hope some day I have the opportunity to reward you. I will post again soon. -
After browsing the web and reading dozens of examples and tutorials I still can't figure out how to translate mouse X;Y screen position in pixels to X;Y isometric tile index. All the examples I tried returned strange values. The attached picture shows exactly the tiles' redering order. The Zig-Zag rendering mode was so simple to implement with the help of a colored coded tile. But this diamond shapped design is really giving me a hard time. I guess the formula involves the following variables: - MousePos.X - MousePos.Y - TileWidth - TileHeight - ScreenWidth - ScreenHeight Now I just need to know how to put the pieces together. Unfortunately, I fail to see the logic behind it. Thank you very much for any possible help.
-
Forcing windows font system size to 100%
EFileTahi-A replied to EFileTahi-A's topic in Windows Forms
Well, I didn't find the time to look into it during the weekend and to be honest, I will leave this issue for last as it is the least of my concerns now now. -
Forcing windows font system size to 100%
EFileTahi-A replied to EFileTahi-A's topic in Windows Forms
The text still scales :( What I plan to do is to detect the scale size set by Windows to let my app do the scaling by itself (manually). This way I can decide which controls can have their text scalde without compromising their functionality. Some will, others won't scale at all. I will try to do it this weekend. This requires time because the moment I change the font scale above 100% my .NET project will be immediately scaled messing up all my forms in the designer view. I will need to work over a backup of my project until I get it right. I hope I can post a solution here afterwards. -
Forcing windows font system size to 100%
EFileTahi-A replied to EFileTahi-A's topic in Windows Forms
I understand that letting the system handling it can, in most cases, be the best approach and that it should be considered seriously, but it sure doesn't make it a golden rule. Just because I'm using .NET controls (which are actually custom made controls) it doesn't mean they have to be exposed to changes from an outside source to behave like a common form. In this case, this is not about what the user wants / needs, this is about what the app needs in order to function right; in order to actually function. It is like requesting the user to have a DX11 card to run a DX11 game or having a VGA capable screen to run Windows XP. There are many reasons that can led a user to cease using a certain application. Believe me, text size it is not among them. Even those near me that use their small 7 inch netbooks have their text set to 100%. I never had a discussion in my life with anyone regarding a piece of software having the text font set to 9 instead 8. My app cannot be scaled. If it does, text won't fit because there isn't room for controls to scale. Thanks -
How can I ignore window's font size scale settings? Because if the font size is set to 125% or above my app will be completely wasted as dozens of controls will overlap and text itself will be cut in 90% of the cases. Not to mention that one of my forms got destroyed when I opened it in my new Notebook which had the font size set to 125%. I had to reposition every damn control on that form when I set the font size back to 100%. So, how can I completely bypass window's auto font scale size? (The correct way to see it) I understand that I shouldn't override the user's chosen settings in windows, but I have no other way to let my custom controls function properly as everything is measured using pixel precision. (My way to see it) My app, my rules. Don't like it? Don't use it. Anyway, I understand I need to set control scale to none but I'm not sure how to stop text from scaling. Thanks.
-
And proof of that is that my ASP .NET sessions consist of 85% Googling and 15% actually coding. I just wish it could be the opposite.
-
Oh, I thought it was just me. I'm glad to know I'm not the only one thinking likewise. Don't give up Adam! Please tell me the same! lol
-
Just started with ASP .NET this Saturday and it was the most frustrating experience I ever had. I went to bed Saturday, completely demoralized with the feeling that I had never coded on my life. Really frustrating... Anyway, after 2 full days of bumping the head I managed to setup the website's main structure, I'm now struggling on how to achieve these basic things (well I guess point 3 is not that basic): 1 - How can I make the DIV's height fill the browser's available space? I know that setting the DIV to 100% means it will re-size of the div based on the controls within it. So, do I need to code it? How can I get the webpage's height to compute the DIV's height? Will I also need to create an event for that? 2 - I need to maintain selected a menu item in the ASP Menu Navigation control when the user opens a new page through it. I need to do this with CSS since I learned that this option: 'IncludeStyleBlock = false' should be set to true. Unfortunately if I set it to true I will loose the 'special' format that the CSS sets it to work with, because I need an extra horizontal space so that text don't get too close for each menu item. 3 - To handle a login / session on an ASP website do I need to use a database to handle all users? I don't have a clue how the login works in ASP so, if someone can point me to a good example I will really appreciate it. Web developing is really strange. Seriously, it is a mess, chunks of code in multi languages with most control settings requiring being done in CSS. So much for "visual development". I haven't still figured it out how C# will actually do anything in ASP .NET. I hope to get there soon, once I set up the website's skeleton.
-
This function is not fully working
EFileTahi-A replied to EFileTahi-A's topic in Graphics and Multimedia
Thanks to you both, I finally managed to understand how the whole thing works! This will be so cool in future! I think this way I can actually replace most of my GDI+ rendering procedures with pointers*. I'm still amazed by its speed! It is instantaneously! Too bad I still need to use the DrawImageUnscaled() to draw the backbuffer to avoid flickering. Nonetheless it's still be awesome! :D -
Can someone please try to figure out what is happening here? I'm trying to apply the Multiply filter, similar to the one Photoshop uses by crossing the RGB values between two images. I'm not a pointer* guy at all and most of the code was taken from internet so I can't really say what is wrong. The function is currently working partially, that is, it applies the filter only over a third of the image from top to bottom on the left side. private void button2_Click(object sender, EventArgs e) { Bitmap srcA = (Bitmap)this.lbl_map.Image; Bitmap srcB = (Bitmap)this.lbl_paper.Image; BitmapData dataA = SetImageToProcess(srcA, new Rectangle(0, 0, 1280, 800)); BitmapData dataB = SetImageToProcess(srcB, new Rectangle(0, 0, 1280, 800)); int width = dataA.Width; int height = dataA.Height; int offset = dataA.Stride - width; unsafe { byte* ptrA = (byte*)dataA.Scan0; byte* ptrB = (byte*)dataB.Scan0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++, ++ptrA, ++ptrB) { int result = (ptrB[0] * ptrA[0]) / 255; ptrA[0] = (byte)result > (byte)255 ? (byte)255 : (byte)result; } ptrA += offset; ptrB += offset; } } srcA.UnlockBits(dataA); srcB.UnlockBits(dataB); this.BackgroundImage = srcA; } static public BitmapData SetImageToProcess(Bitmap image, Rectangle roi) { if (image != null) return image.LockBits( roi, ImageLockMode.ReadWrite, image.PixelFormat); return null; } I really wish I could understand a bit more of how this function actually works. The filter seems to play instantaneously against the 10sec it takes doing it with GDI+. Thanks
-
Hmm... Well, lets wait and see. Thanks for mentioning it. Assembly; now that's what I call doing it the hard way. I wonder what would be the result if you put such passionate effort towards something done in a easier language but yet quite complex :D I'm going to send you a private message so you can read about my project.
-
Hey Snarfblam! Thanks for posting. Well, that would be my next question, that is, if we could develop .NET for ARM devices. Nice. But will mobile .NET apps require a special Mobile type project in visual studio or we can use standard VS projects? I'm in imminence of selling my Asus Transformer TF101 to get a surface device, mainly because I will be able to use my C# knowledge to quickly build .NET apps for it. PS: How busy are you now? I still have hope that some day we might develop something together. I've returned to my old fantasy roguelike RPG project which is something... well... never seen before... ;) I could post a link to its secret URL in case you are interested. :D
-
I know that surface tablets will have two flavors: ARM and Intel. But will both be able to run Visual Studio? I know Intel based tabs will but what about ARM tabs?
-
My bad! I had a hunch I was doing something wrong. The TextChanged event was not firing because I was setting the item's text directly to the sText variable instead of loading it to the this.Text proterty, whenever I clicked on the context box's items. Thanks SnarfBlam, once again. Thanks to you I now realize how the event thing works.
-
I want the event to be fired when the user changes the text on the control based on a custom property created by me. The current implementation does not fire anything. I don't know if I'm making myself clear. I have a Text property being override by me so I can force the Invalidate() instruction. Now, this control is a custom made combobox. When the user chooses an item (through a context menu) the Text property gets the value of the selected item. And it is at this time I want to trigger an event for the changed text. Don't I need to create a delegate for the whole thing? I'm really not sure of how the whole thing works. Thank you for replying!
-
I need o trigger events for my custom properties residing in a custom control. Basically, I need a trigger for each property the control has and whenever they change. I've seen some examples on the web but I did not get a clear picture of how the whole thing works. This is what I have so far: public partial class EFile_ComboBox : UserControl { public event EventHandler TextChanged; [Category("Appearance")] [Description("Specifies if a shadow should be draw for the button text.")] [DisplayName("Text")] [EditorBrowsable(EditorBrowsableState.Always), Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Bindable(true)] public override string Text { get { return sText; } set { sText = value; this.Invalidate(); } } private void TextBox_Validated(object sender, EventArgs e) { // invoke UserControl event here if (this.TextChanged != null) this.TextChanged(sender, e); } } What should I do from here? The Text property, in this case, is the one thing I need to trigger whenever it changes.
-
I use DrawImage without the darkness issue you both describe. Can I have a look your code?
-
How to move a Rectangle by MouseClick
EFileTahi-A replied to heater19's topic in Graphics and Multimedia
I've made some changes towards the way you draw things onto the screen: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { PointF charloc = new PointF(4,4); private bool mclick; float speed = 3f; float dx = 0f; float dy = 0f; float mX, mY; float ddx = 0f; float ddy = 0f; public Form1() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs e) { [color="Red"] //Here we clear the screen with a chosen color. No need to use FillRectangle. e.Graphics.Clear(Color.Black);[/color] movement(); e.Graphics.DrawRectangle(Pens.Green, charloc.X, charloc.Y, 30, 30); e.Graphics.DrawLine(Pens.Aqua, charloc.X, charloc.Y, mX, mY); } private void movement() { if (mclick) { charloc.X += ddx; charloc.Y += ddy; } } private void Form1_MouseClick(object sender, MouseEventArgs e) { mclick = true; mX = e.X; mY = e.Y; dx = mX - charloc.X; dy = mY - charloc.Y; double dist = Math.Sqrt((double)(dx * dx) + (double)(dy * dy)); ddx = (dx / (float)dist) * speed; ddy = (dy / (float)dist) * speed; } private void timer1_Tick_1(object sender, EventArgs e) { this.Invalidate(); } private void Form1_Load(object sender, EventArgs e) { } } } By using the "protected override OnPaint" event, drawing speed will be drastically increased. Simply use its built in graphics object to draw all that is needed. Don't forget to turn the form's DoubleBuffer On to avoid flicker. The Invalidate() forces the window to refresh by calling the OnPaint event. I hope this helps. -
C# GDI+ 3D sphere with texture
EFileTahi-A replied to EFileTahi-A's topic in Graphics and Multimedia
Sorry for the late response. Thank you anyway. I'm focused on other subjects at the moment. I will look into that again later on and if I find anything I'll post it over here. -
I would like to implement a 3D sphere to play an animated rotating planet for my game but using GDI+ ONLY. Since my math skills are next to zero, I definitely need to see an example. The problem is that I can't find any on the web. Is this too hard to be done with a texture? What about a an opaque wireframe version divided with vertical and horizontal circular lines?
-
Found the problem! I was using two array lists containing a class: ArrayList<c_star> & ArrayList<c_celestialBody> inside the class c_solarSystem. They were NOT marked as Serializable. I simply added the tag [serializable] to each one of them to make the whole thing work. All classes (c_star, c_solarSystem & c_celestialBody) are inside the main c_kaprical class (just a side note, kaprical is the name of the galaxy, yet the name of the game). I could only achieve this thanks to your superb explanation. Thanks! Once more...
-
But from a class that is inside another class. [serializable] public class c_kaprical { //my objects [color="Red"] [serializable] //<- this does not help.[/color] public class c_solarSystem { //my objects public class c_kaprical.c_solarSystem Clone(c_kaprical.c_solarSystem newClone) { MemoryStream m = new MemoryStream(); BinaryFormatter b = new BinaryFormatter(); b.Serialize(m, newClone); m.Position = 0; return (c_kaprical.c_solarSystem)b.Deserialize(m); } } } This gives me an error saying that the class c_kaprical.c_solarSystem is not refered as Serializable. I've tried to tag c_solarSystem also with [serializable] This works well for c_kaprical class but for c_kaprical.c_solarSystem... :( Any suggestions? I would love to keep this structure without removing the sub-classes from the main class. I just want to perform a deep copy of a given class despite of its method! Thanks