首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏DannyHoo的专栏

    iOS开发中压缩图片的质量以及缩小图片尺寸

    blog.csdn.net/u010105969/article/details/75133170 -(UIImage *)resizeImage:(UIImage *)image { float actualHeight maxHeight = 300.0;    // 图片的最大高度 float maxWidth = 400.0; // 图片的最大宽度 float imgRatio = actualWidth/actualHeight ;             actualWidth = imgRatio * actualWidth;             actualHeight = maxHeight;         = imgRatio * actualHeight;             actualWidth = maxWidth;         } else         {             (0.0, 0.0, actualWidth, actualHeight); UIGraphicsBeginImageContext(rect.size);     [image drawInRect

    1.8K30发布于 2018-09-13
  • 来自专栏Windows Community

    Extensions in UWP Community Toolkit - FrameworkElement Extensions

    Extensions 为 FrameworkElement 提供了一种简单的绑定实际尺寸的方式,扩展利用 EnableActualSizeBinding 来指定是否允许实时绑定实际尺寸中的 ActualWidth 和 ActualHeight 和 ActualWidrh 一直都是变为 False 时最后一个值,不管尺寸怎么改变都不会被更新和监听; 而通过扩展设置的绑定,和直接设置 ActualHeight 和 ActualWidth 的绑定的区别就是 -= UpdateActualSizeProperties; } } 在下面的 UpdateActualSizeProperties(sender, args) 方法中,可以看到绑定目标的 ActualHeight = baseElement.ActualHeight) { SetActualHeight(baseElement, baseElement.ActualHeight); baseElement.ActualWidth); } } 代码简单分析如上,大家在实际项目中可以对这个类进行扩展,比如把 Opacity,Color 等也作为可以实时绑定的值,实现方式和 ActualHeight

    1K80发布于 2018-04-28
  • 来自专栏个人编程笔记

    C#-利用自定义控件创建箭头控件

    new Point(this.ActualWidth / 3*2, 0); var point2 = new Point(this.ActualWidth / 3*2, this.ActualHeight /3*2); var point3 = new Point(this.ActualWidth, this.ActualHeight/3*2); var point4 = new Point(this.ActualWidth / 2, this.ActualHeight); var point5 = new Point(0, this.ActualHeight /3*2); var point6 = new Point(this.ActualWidth/3,this.ActualHeight/3*2); using

    1.6K20编辑于 2023-03-03
  • 来自专栏我的WPF笔记

    记一次自定义基因分类图实现(二)

    OvservedWidth = (sender as FrameworkElement).ActualWidth; OvseredHeight = (sender as FrameworkElement).ActualHeight True"> <Canvas > <ItemsControl x:Name="root1" Height="{Binding Path=<em>ActualHeight</em> Right"VerticalAlignment="Stretch" Opacity="0.5"ViewportSize="{Binding ElementName=ContentBorder, Path=<em>ActualHeight</em> " /> <Binding ElementName="ContentItemsControl" Path="<em>ActualHeight</em>" /> " /> <Binding ElementName="ContentItemsControl" Path="<em>ActualHeight</em>" />

    23600编辑于 2025-04-26
  • 来自专栏我和未来有约会

    [Silverlight动画]转向行为 - 机车

    position.x = 0; velocity.x *= -1; } if (position.y > stage.ActualHeight ) { position.y = stage.ActualHeight; velocity.y *= -1; { position.x = stage.ActualWidth; } if (position.y > stage.ActualHeight = 0; } if (position.y < 0) { position.y = stage.ActualHeight

    1.1K60发布于 2018-01-16
  • 来自专栏独立观察员博客

    WPF 窗口居中 & 变更触发机制

    screen.Bounds.Top / dpiYRatio + (screen.Bounds.Height / dpiYRatio - subWindow.ActualHeight parentWindow.ActualWidth - subWindow.ActualWidth) / 2; subWindow.Top = parentWindow.Top + (parentWindow.ActualHeight - subWindow.ActualHeight) / 2; } } 2)当前屏幕内居中-CenterScreen; 窗口位置设置和上面的一样,值得注意的是DPI。 screen.Bounds.Top / dpiYRatio + (screen.Bounds.Height / dpiYRatio - subWindow.ActualHeight

    1.7K20编辑于 2022-12-06
  • 来自专栏sofu456

    wpf绘图性能分析

    canvas.ActualWidth - 100)); Canvas.SetTop(canvas.Children[canvas.Children.Count - 1], rd.Next(0, (int)canvas.ActualHeight (double)rd.Next(0, (int)win.ActualWidth - 100), (double)rd.Next(0, (int)win.ActualHeight bitmapImage; } } 调用gdi+绘制,10000个1-2s,10w个3-4s _bitmap = new System.Drawing.Bitmap((int)ActualWidth, (int)ActualHeight System.Windows.Point((double)rd.Next(0, (int)ActualWidth - 100), (double)rd.Next(0, (int)ActualHeight

    1.4K30编辑于 2022-10-31
  • 来自专栏dino.c的专栏

    [UWP]不怎么实用的Shape指南:自定义Shape

    ActualWidth, 0); var segment = new LineSegment { Point = new Point(ActualWidth, ActualHeight break; case Direction.Up: figure.StartPoint = new Point(0, ActualHeight figure.Segments.Add(segment); segment = new LineSegment { Point = new Point(ActualWidth, ActualHeight figure.StartPoint = new Point(0, 0); segment = new LineSegment { Point = new Point(ActualWidth, ActualHeight figure.Segments.Add(segment); segment = new LineSegment { Point = new Point(ActualWidth / 2, ActualHeight

    73140发布于 2019-01-18
  • 来自专栏walterlv - 吕毅的博客

    准确判断一个 WPF 控件 / UI 元素当前是否显示在屏幕内

    target.PointToScreen(new Point()); var bottomRight = target.PointToScreen(new Point(target.ActualWidth, target.ActualHeight visual.ActualWidth, 0))); pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, visual.ActualHeight ))); pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, visual.ActualHeight visual.ActualWidth, 0))); pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, visual.ActualHeight ))); pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, visual.ActualHeight

    1.9K40编辑于 2023-10-22
  • 来自专栏码客

    WPF坐标转换

    double GetScalingRatio() { var logicalHeight = GetLogicalHeight(); var actualHeight = GetActualHeight(); if (logicalHeight > 0 && actualHeight > 0) { return logicalHeight / actualHeight; } return 1; } private var mouse = transform.Transform(GetMousePosition()); Left = mouse.X + 2; Top = mouse.Y - ActualHeight

    75420编辑于 2022-10-05
  • 来自专栏我和未来有约会

    CaseStudy(showcase)数据篇-Loading的制作

    e.ProgressPercentage) / Convert.ToDouble(100);             loadBar.Height = (App.Current.Host.Content.ActualHeight App.Current.Host.Content.ActualWidth;             (this as UserControl).Height = App.Current.Host.Content.ActualHeight

    74370发布于 2018-01-16
  • 来自专栏施炯的IoT开发专栏

    How-to: 创建Windows Phone 7自定义控件

    ; if (left > width + ActualWidth) return true; if (top < -ActualHeight random.NextDouble() * ContentCanvas.ActualWidth; var top = random.NextDouble() * ContentCanvas.ActualHeight bubblecontrol.UpdatePosition(currentTransform); if (bubblecontrol.IsOutOfBounds(ActualWidth, ActualHeight ContentCanvas.ActualWidth; var size = random.Next(10, 50); CreateBubble(left, ContentCanvas.ActualHeight

    1.1K70发布于 2018-01-10
  • 来自专栏菩提树下的杨过

    silverlight:ScrollViewer的各种高度研究

    ShowHeight(); } void ShowHeight() { tb1.Text = string.Format("ActualHeight :{0},VerticalOffset:{1},ViewportHeight:{2},ExtentHeight:{3}", sv.ActualHeight, sv.VerticalOffset, sv.ViewportHeight

    82180发布于 2018-01-24
  • 来自专栏林德熙的博客

    win10 uwp 自定义控件初始化

    同时无法获得 ActualHeight 和 ActualWidth 的值。 在 Loaded 的时候,可以获得属性的值,而且可以获得 ActualHeight 和 ActualWidth 的值。

    71710发布于 2018-09-18
  • 来自专栏林德熙的博客

    WPF 动画性能测试应用 一千个半透明矩形做动画

    { drawingContext.DrawRectangle(Brushes.White, null, new Rect(0, 0, ActualWidth, ActualHeight Random.Shared.Next((int) (ActualWidth - size.Width)), Random.Shared.Next((int) (ActualHeight Random.Shared.Next((int) (ActualWidth - size.Width)), Random.Shared.Next((int) (ActualHeight Random.Shared.Next((int) (ActualWidth - size.Width)), Random.Shared.Next((int) (ActualHeight Random.Shared.Next((int) (ActualWidth - size.Width)), Random.Shared.Next((int) (ActualHeight

    89140编辑于 2023-04-07
  • 来自专栏独立观察员博客

    WPF 实现扇形统计图

    return; _canvas.Children.Clear(); var pieWidth = _canvas.ActualWidth > _canvas.ActualHeight _canvas.ActualHeight : _canvas.ActualWidth; var pieHeight = _canvas.ActualWidth > _canvas.ActualHeight _canvas.ActualHeight : _canvas.ActualWidth; centenrX = pieWidth / 2; centenrY = pieHeight / 2; radius = this.ActualWidth > this.ActualHeight ? this.ActualHeight / 2 : this.ActualWidth / 2; double angle = 0; double prevAngle

    1.8K10编辑于 2022-12-06
  • 来自专栏码客

    WPF开发-列表点击悬浮框跟随

    relativeLocationY = relativeLocation.Y + 12; //防止悬浮框超出列表区域 if (relativeLocationY + ShowArea.Height > TjSv.ActualHeight ) { relativeLocationY = TjSv.ActualHeight - ShowArea.Height; } ShowArea.Margin =

    60710编辑于 2024-06-15
  • 来自专栏前端二次元

    开发一个Canvas小游戏 实现一个游戏“引擎”

    * */ const actualWidth = getActualPixel(width); const actualHeight = getActualPixel(height); dom.width = actualWidth; dom.height = actualHeight; Object.assign(this, { width, height , actualWidth, actualHeight }); } translateX: number = 0; translateY: number = 0; translate render(scene: Scene, camera: Camera) { const { ctx, entityRenderMap, actualWidth, actualHeight ctx.clearRect( renderX, renderY, renderX + actualWidth, renderY + actualHeight

    96510编辑于 2023-11-25
  • 来自专栏林德熙的博客

    win10 uwp 毛玻璃 Compositor 创建毛玻璃win2D最简单方法

    }; session.DrawImage(blur, new Rect(0, 0, sender.ActualWidth, sender.ActualHeight }; session.DrawImage(blur, new Rect(0, 0, sender.ActualWidth, sender.ActualHeight return; //我们剪辑覆盖,用于显示下面的图片 Clip.Rect = new Rect(0, 0, _x, this.ImagePanel2.ActualHeight / 重置剪辑显示完整的覆盖 Clip.Rect = new Rect(0, 0, this.ImagePanel2.ActualWidth, this.ImagePanel2.ActualHeight }; session.DrawImage(blur, new Rect(0, 0, sender.ActualWidth, sender.ActualHeight

    1.4K10发布于 2018-09-18
  • 来自专栏独立观察员博客

    WPF怎么做新手引导界面?

    rg1 = new RectangleGeometry(); rg1.Rect = new Rect(point.X - 5, point.Y - 5, fe.ActualWidth + 10, fe.ActualHeight new RectangleGeometry(); rg1.Rect = new Rect(point.X - 5, point.Y - 5, fe.ActualWidth + 10, fe.ActualHeight con, vis); Canvas.SetLeft(hit, point.X + fe.ActualWidth + 3); Canvas.SetTop(hit, point.Y + fe.ActualHeight

    1.5K10编辑于 2022-12-06
领券