|
You physically can't create a bitmap that size. As you're, presumably, wanting to appear as though the image is stitched when scrolling, you need to actually allocate a bitmap area that is about twice the size of the visible viewport (this is roughly how things like Google maps handles their images). As you scroll around, you will display the area that you have preloaded - when you get near the edge of the viewport, discard a load of these bitmap images from the opposite (invisible) side of the viewport and load in more on the side you can see. If you think of them as tiles, you should get the idea of how to do this.
This space for rent
|
|
|
|
|
Thanks for all the feedback. As far as virtualization or blocked segments go, that doesn't work because i need the image to be archived for later use (after it's stitched of course). The best solution I've found so far is the create several small stitched images. ¯\_(ツ)_/¯
Perhaps, assuming i don't find a .net solution, I'll circle back when i have more time and take a stab at it in c++.
|
|
|
|
|
I'd recommend first calculating whether such a bitmap is feasible. And no, current description still does not show a 'need' for stitching.
What is the use-case for having such a large bitmap archived?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
JBHowl wrote: I'll circle back when i have more time and take a stab at it in c++.
If and when you do, seriously take a look att the open-source ImageMagick: Application Program Interfaces[^]. It is not overly difficult to use, and for large images such as you're describing, it implements its own disk-caching system. Its been around since Noah was a lad, so its relatively stable.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
Hi,
If you have a number of .bmp files, it isn't hard to create a stack of them in a new .bmp file without even using the Image or Bitmap classes, provided all images have equal width.
All it takes is some understanding of the BMP file format[^] (basically locate the height information, and the border between header and pixel data), creating the BMP header, and stitching the data half of each of the .bmp files together.
The input images don't even have to be files, you could apply the same to memory streams. So what I would suggest is this: open an output stream, emit the BMP header for the resulting image (could be based on an input image with the height adapted appropriately), then enumerate the images, and for each of them create the memory stream, then append the byte data skipping the input header.
However, I do agree with the others, my first approach would be to avoid the need for a huge image altogether, as working with huge images will cause heavy memory loads, big latency times, and/or fatal errors. When huge amounts of data are involved, streaming is the way to go; stitching things together statically goes the wrong way. If part of your system needs the whole data, then try and fix that if at all possible.
PS & FWIW: I guess it is easy to show your image using a ListBox where each item corresponds to one input image; make it user drawn so no time is wasted in loading and painting items that aren't currently visible.
modified 21-Oct-16 20:06pm.
|
|
|
|
|
hi guys,
I have developed a MVC implementation 5, it works perfectly locally
but I published it on IIS and I have had this problem
//
in the controller I
public ActionResult Index ()
{
CatalogModel m = new CatalogModel ();
m.LocalCodeColumn = 1;
m.PriceColumn = 2;
m.SelectedClientList = m.GetClientSelectedItems ();
return View (m);
}
and in the view:
Select Client: @ Html.DropDownListFor (m => m.SelectedClientList, Model.GetClientSelectedItems (), "--Select--", new {@id = "ddlClient"})
and this function :
public IEnumerable<SelectListItem> GetClientSelectedItems()
{
IEnumerable<SelectListItem> listClient = dataServices.GetClients();
return listClient;
}
i dont know if the problem with the framework on the server or else
Thank you
modified 20-Oct-16 11:12am.
|
|
|
|
|
This question would probably get a better response in the ASP.NET forum; it is not a pure C# issue.
|
|
|
|
|
|
I am attempting to design an interface for a set of calculation methods, inputs are:
MethodName
Collection of RateSet names
optional collection of tenors (key/value) per Rateset
Collection of Parameters (key/value)
Based on the MethodName the interface should then pass the collection values to the method
The method will crunch the values and output a collection of RateSets with Rates (key/value)
How would the implementation of MethodName to the actual method be done?
Reflections, case statement ???
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you are passing the MethodName as a string, then reflection is probably your best option for calling it.
However, having said that, if you are designing the interface, why not have it with a property that is a method delegate? That way, instead of passing the name of the method to your implementation, you can pass the method itself. No reflection needed, no limited switch-case constructs, and no nasty little bugs when the signature of MethodName does not quite match what was expected.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
Midi_Mick wrote: why not have it with a property that is a method delegate In which case what would be the benefit of using an interface, it would be no different to using the method direct.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I was thinking you were looking for something like this:
public delegate ICollection<RateSet> Method(ICollection RateNames, IDictionary Parameters, IDictionary Tenors = null);
interface IRatesCalculator {
Method Method { get; }
ICollection RateNames { get; set; }
IDictionary Parameters { get; set; }
IDictionary Tenors { get; set; }
ICollection<RateSet> Results { get; }
}
public class RatesCalculator1 : IRatesCalculator {
public RatesCalculator1() {
Method = (ICollection RateNames, IDictionary Parameters, IDictionary Tenors) => {
List<RateSet> rateSet;
return rateSet;
}
};
public Method Method { get; }
public IDictionary Parameters { get; set; }
public ICollection RateNames { get; set; }
public IDictionary Tenors { get; set; } = null;
public ICollection<RateSet> Results {
get {
return Method?.Invoke(RateNames, Parameters, Tenors);
}
}
}
public class RatesCalculator2 {
public RatesCalculator2(Method calculator) {
Method = calculator;
}
public Method Method { get; }
public IDictionary Parameters { get; set; }
public ICollection RateNames { get; set; }
public IDictionary Tenors { get; set; } = null;
public ICollection<RateSet> Results {
get {
return Method?.Invoke(RateNames, Parameters, Tenors);
}
}
}
You may even need to make Method a Read/Write property if you wanted to set it after the creation of the class object.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
This is a case where I would change my thinking around and use the Strategy patter[^] instead.
This space for rent
|
|
|
|
|
I think you are close to rediscovering abstract factory.
Calling a common interface which is implemented in number or classes and interface calling concrete methods according to some decision.
I suggest you read implementing factory/abstract factory before digging into reflection.
---
Pd.
|
|
|
|
|
So why aren't you just using a delegate here?
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
The methodname comes from a user selection and is a string!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If it is from a user-selection, that you don't need to use a string. Most controls have a "display" value for the string, while your real value may be an enum. As Pete said, a strategy-pattern
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, seems like an obvious reason to go with a delegate method. Don't even need to create new classes to handle it, and the delegate effectively takes the place of an interface.
Psudocode!
delegate object MyDelegate(IEnumerable<kvp> parameters, IEnumerable<kvp> tenors = null);
Dictionary<string,MyDelegate> UIDelegateAssociation = new{{Key = "uiSelection", Value = (p,t){}}};
UIDelegateAssociation["uiSelection"].Value.Invoke(params,tenors);
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Can we use Azure Table as database in CRM application?
|
|
|
|
|
Can we? Yes. Should we? Depends on lot of factors.
Azure table is basically NoSql key-value set up. Does you data fit into this model?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Thank's for answer.
How to maintain ACID properties and referential integrity in Azure Tables.
|
|
|
|
|
There is no referential integrity. Table Storage is just a key/value pair storage, like a Dictionary collection in .NET.
|
|
|
|
|
I'm trying to get a window to move along the x axis however currently the code(timer4_tick) that i have is having no effect. Is there something that i am missing? I'll try to post only the code that is relevant.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
public partial class Form1 : Form
{
private int WindowVx, WindowVy;
private int WindowX, WindowY;
private int width = Screen.PrimaryScreen.WorkingArea.Width;
private int height = Screen.PrimaryScreen.WorkingArea.Height;
private void timer1_Tick(object sender, EventArgs e)
{
WindowX = random.Next(width);
WindowY = random.Next(height);
int wx = random.Next(width / 2);
int wy = random.Next(height / 2);
WindowVx = random.Next (1, 4);
WindowVy = random.Next (1, 4);
this.Left = WindowX;
this.Top = WindowY;
this.Width = wx;
this.Height = wx;
}
private void timer4_Tick (object sender, EventArgs e)
{
WindowX += WindowVx;
if (WindowX < 0) {
WindowVx = -WindowVx;
} else if (WindowX + width > ClientSize.Width) {
WindowVx = -WindowVx;
}
this.Refresh ();
}
this.timer4 = new System.Windows.Forms.Timer (this.components);
this.timer4.Enabled = true;
this.timer4.Interval = 1000;
this.timer4.Tick += new System.EventHandler (this.timer4_Tick);
private System.Windows.Forms.Timer timer4;
|
|
|
|
|
That's because it doesn't move anything. All it does is change the values of your internal variables, which are only subsequently used in your timer1_tick method, but immediately overwritten.
You need to affect the Top and Left properties of the window itself in order to move it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Oh thank you! I got it working now!
|
|
|
|