drawing

How to flash a custom NSMenuItem view after selection?

放肆的年华 提交于 2019-12-11 02:43:25
问题 I need to assign a view to an NSMenuItem and do some custom drawing. Basically, I'm adding a little delete button next to the currently selected menu item, among other things. But I want my custom menu item to look and behave like a regular menu item in all other ways. According to the doc: A menu item with a view does not draw its title, state, font, or other standard drawing attributes, and assigns drawing responsibility entirely to the view. Ok, so I had to duplicate the look of the state

Getting a line that has the coordinates defined by the mouse location

两盒软妹~` 提交于 2019-12-11 02:39:47
问题 I'm trying to make a little graphics program that has a circle of diameter 100 on the screen and from the center of it, a line is coming out of it that is always attached to the mouse pointer until such time that the user does a click, and then the line is permanently drawn. It's exactly like MSPaint's line, except that starting point is always the center of the circle. I tried a few things that DON'T work. I can get the line to appear only after a mouse-click. That's not what I want. I want

CALayer and view disappeared

孤人 提交于 2019-12-11 02:36:39
问题 I have a large image managed with CATiledLayer (like the Large Image Downsizing iOS sample code). I had a drawing view (UIView overrided with drawing methods) on it but when I zoom a lot, I get the following message and my view disappeared.. -[<CALayer: 0xb253aa0> display]: Ignoring bogus layer size (25504.578125, 15940.361328) Is there a way to avoid this ? 回答1: Sounds like the levelsOfDetail and levelsOfDetailBias you are setting are allowing for more zoom than the tiled layer should allow

How do you apply a Scale Translation to a DrawingContext?

大兔子大兔子 提交于 2019-12-11 02:15:01
问题 I have a Canvas with a scale translation applied in XAML. Using DrawingContext I draw lines on the Canvas . I now need to add text to the screen. I thought with formatted text I could apply a translation, but neither Formatted Text or DrawingContext accepts RenderTransform . How do I apply a scale translation to the text so it will counter the scale translation of the canvas? ftext = New FormattedText("N", CultureInfo.GetCultureInfo("en-us"), Windows.FlowDirection.LeftToRight, face, Me

Adding undo function to drawing app

巧了我就是萌 提交于 2019-12-11 02:07:42
问题 I followed a raywenderlich tutorial on using the UIKit to make a drawing app. I'm now trying to add in the functionality to undo the last stroke. Ideally I would like to undo up to 10ish strokes. I'm trying to figure out what is the best way to go about doing this. I was thinking of creating another ImageView which has only the last stroke and making the ImageView.image = nil when the user presses back. In the code from the tutorial there's something similar to this. When the touches end, the

SWT anti-aliasing control shapes

∥☆過路亽.° 提交于 2019-12-11 01:57:48
问题 I have a NO_TRIM shell with rounded corners, created by applying a Region. The problem is, I'd like the edges of the shell to be anti-aliased, which I don't know how to do with applying a Region or any other way. Right now I have this: shell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { setRoundedShape(shell, 10); } }); //... void setRoundedShape(Control control, int r) { Region region = new Region(control.getDisplay()); // ... control.setRegion(region);

Blank screen using DrawImage method

放肆的年华 提交于 2019-12-11 01:35:10
问题 I have to draw a bitmap image using DrawingContext.DrawImage method. Using the code below everything is working correctly: BitmapImage myImage = new BitmapImage(); myImage.BeginInit(); myImage.UriSource = new Uri("image.png", UriKind.Relative); myImage.EndInit(); Rect area = new Rect(new Size(myImage.PixelWidth, myImage.PixelHeight)); DrawingVisual myVisual = new DrawingVisual(); using (DrawingContext context = myVisual.RenderOpen()) { context.DrawImage(myImage, area); } But only if the image

Graphpaper Background with XAML and Path Markup Language

空扰寡人 提交于 2019-12-11 01:16:20
问题 for some hours im trying to create a graphpaper background for a ListView. For a better understanding I'll describe what I mean. I want to realise it with XAML. Until now I finished the little rectangles with 10px margin, but I need another grid, with bigger lines which have a margin of 100px and I don't really understand the Path Markup Language. Here is my code: <DrawingBrush x:Key="ListBackgroundBrush" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing>

Drawing a rectangle multidimensional array

橙三吉。 提交于 2019-12-11 00:49:12
问题 I'm currently working on an inventory system however I'm having problem figuring out how I should draw it. I have an array of rectangles looking like this: Rectangle[] Inventoryslots = new Rectangle[24]; // 24 slots now I want to draw the slots like a 6*4 columns, 6 slots in width and 4 slots in height. I'm drawing them like this until I have figured out how I should draw them on y as well: for (int i = 0; i < Inventoryslots.Length; i++) { Inventoryslots[i] = new Rectangle(i * 33, 0, box

c# drawing on the panel and scrolling the result

杀马特。学长 韩版系。学妹 提交于 2019-12-10 23:42:54
问题 I have problem with showing a diagram which is too big to see on one panel. I have to scrollbars which should change the point of view on the diagram, but when i want to scroll the picture, the shapes are moving on the different position, everything getting crushed. it looks like this here link when i show it,and like this here link when i try to look on the bottom of the graph it looks like application drawing the shapes every time when i scroll the panel, and when i go on the bottom of